fix: 修正 DeepSeek 默认 base_url 去除多余 /v1 后缀
This commit is contained in:
@@ -726,7 +726,7 @@ mod tests {
|
||||
let backend = Backend::DeepSeek(
|
||||
deepseek::Client::builder()
|
||||
.api_key("sk-test")
|
||||
.base_url("https://api.deepseek.com/v1")
|
||||
.base_url("https://api.deepseek.com")
|
||||
.http_client(recorder.clone())
|
||||
.build()
|
||||
.expect("build deepseek client with mock backend"),
|
||||
@@ -843,7 +843,7 @@ mod tests {
|
||||
let captured = recorder.requests();
|
||||
assert_eq!(
|
||||
captured[0].uri,
|
||||
"https://api.deepseek.com/v1/chat/completions"
|
||||
"https://api.deepseek.com/chat/completions"
|
||||
);
|
||||
let body: serde_json::Value = serde_json::from_slice(&captured[0].body).unwrap();
|
||||
assert_eq!(body["model"], "deepseek-v4-flash");
|
||||
@@ -911,7 +911,7 @@ mod tests {
|
||||
let backend = Backend::DeepSeek(
|
||||
deepseek::Client::builder()
|
||||
.api_key("sk-test")
|
||||
.base_url("https://api.deepseek.com/v1")
|
||||
.base_url("https://api.deepseek.com")
|
||||
.http_client(MockStreamingClient {
|
||||
sse_bytes: sse.to_string().into(),
|
||||
})
|
||||
@@ -1438,7 +1438,7 @@ mod tests {
|
||||
let backend = Backend::DeepSeek(
|
||||
deepseek::Client::builder()
|
||||
.api_key(&key)
|
||||
.base_url("https://api.deepseek.com/v1")
|
||||
.base_url("https://api.deepseek.com")
|
||||
.http_client(smoke_http())
|
||||
.build()
|
||||
.expect("build deepseek client"),
|
||||
|
||||
@@ -248,7 +248,7 @@ pub fn get_default_base_url(provider: &str) -> &'static str {
|
||||
"openai" => "https://api.openai.com/v1",
|
||||
"anthropic" => "https://api.anthropic.com/v1",
|
||||
"kimi" => "https://api.moonshot.cn/v1",
|
||||
"deepseek" => "https://api.deepseek.com/v1",
|
||||
"deepseek" => "https://api.deepseek.com",
|
||||
"openrouter" => "https://openrouter.ai/api/v1",
|
||||
"ollama" => "http://localhost:11434",
|
||||
_ => "",
|
||||
@@ -294,10 +294,7 @@ mod tests {
|
||||
"https://api.anthropic.com/v1"
|
||||
);
|
||||
assert_eq!(get_default_base_url("kimi"), "https://api.moonshot.cn/v1");
|
||||
assert_eq!(
|
||||
get_default_base_url("deepseek"),
|
||||
"https://api.deepseek.com/v1"
|
||||
);
|
||||
assert_eq!(get_default_base_url("deepseek"), "https://api.deepseek.com");
|
||||
assert_eq!(
|
||||
get_default_base_url("openrouter"),
|
||||
"https://openrouter.ai/api/v1"
|
||||
|
||||
Reference in New Issue
Block a user