mirror of
https://github.com/instructkr/claw-code.git
synced 2026-05-19 05:51:26 +08:00
omx(team): auto-checkpoint worker-3 [unknown]
This commit is contained in:
@@ -146,6 +146,12 @@ impl OpenAiCompatClient {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn with_http_client(mut self, http: reqwest::Client) -> Self {
|
||||||
|
self.http = http;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn with_retry_policy(
|
pub fn with_retry_policy(
|
||||||
mut self,
|
mut self,
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ use std::sync::{Mutex as StdMutex, OnceLock};
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use api::{
|
use api::{
|
||||||
ApiError, ContentBlockDelta, ContentBlockDeltaEvent, ContentBlockStartEvent,
|
build_http_client_with, ApiError, ContentBlockDelta, ContentBlockDeltaEvent,
|
||||||
ContentBlockStopEvent, InputContentBlock, InputMessage, MessageDeltaEvent, MessageRequest,
|
ContentBlockStartEvent, ContentBlockStopEvent, InputContentBlock, InputMessage,
|
||||||
OpenAiCompatClient, OpenAiCompatConfig, OutputContentBlock, ProviderClient, StreamEvent,
|
MessageDeltaEvent, MessageRequest, OpenAiCompatClient, OpenAiCompatConfig, OutputContentBlock,
|
||||||
ToolChoice, ToolDefinition,
|
ProviderClient, ProxyConfig, StreamEvent, ToolChoice, ToolDefinition,
|
||||||
};
|
};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
@@ -535,14 +535,11 @@ async fn openai_compatible_client_honors_http_proxy_for_requests() {
|
|||||||
)],
|
)],
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
let _http_proxy = ScopedEnvVar::set("HTTP_PROXY", proxy.base_url());
|
let proxied_http = build_http_client_with(&ProxyConfig::from_proxy_url(proxy.base_url()))
|
||||||
let _https_proxy = ScopedEnvVar::unset("HTTPS_PROXY");
|
.expect("proxy client should build");
|
||||||
let _no_proxy = ScopedEnvVar::unset("NO_PROXY");
|
|
||||||
let _http_proxy_lower = ScopedEnvVar::unset("http_proxy");
|
|
||||||
let _https_proxy_lower = ScopedEnvVar::unset("https_proxy");
|
|
||||||
let _no_proxy_lower = ScopedEnvVar::unset("no_proxy");
|
|
||||||
|
|
||||||
let client = OpenAiCompatClient::new("openai-test-key", OpenAiCompatConfig::openai())
|
let client = OpenAiCompatClient::new("openai-test-key", OpenAiCompatConfig::openai())
|
||||||
|
.with_http_client(proxied_http)
|
||||||
.with_base_url("http://origin.invalid/v1");
|
.with_base_url("http://origin.invalid/v1");
|
||||||
let response = client
|
let response = client
|
||||||
.send_message(&MessageRequest {
|
.send_message(&MessageRequest {
|
||||||
|
|||||||
Reference in New Issue
Block a user