fix: 修正 DeepSeek 默认 base_url 去除多余 /v1 后缀
This commit is contained in:
@@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
暂无。
|
### 🐞 错误修复
|
||||||
|
- 修复 DeepSeek 默认 `base_url` 误带 `/v1` 后缀的问题:该后缀会使用于校验凭据的 `GET /user/balance` 被拼成 `/v1/user/balance` 而失败,并在生成前被笼统报为 `LLM provider 'deepseek' is not available`。默认地址改为 `https://api.deepseek.com`,与官方 API 路径一致;已有配置若显式写入过 `.../v1`,需用 `quicommit config set-llm deepseek` 重新选择或手动修改
|
||||||
|
|
||||||
|
### 📚 文档
|
||||||
|
- README(中/英文)DeepSeek 配置示例的 `--base-url` 同步去掉 `/v1`
|
||||||
|
|
||||||
## [0.8.1] - 2026-08-31
|
## [0.8.1] - 2026-08-31
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "quicommit"
|
name = "quicommit"
|
||||||
version = "0.8.1"
|
version = "0.8.2"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["Sidney Zhang <zly@lyzhang.me>"]
|
authors = ["Sidney Zhang <zly@lyzhang.me>"]
|
||||||
description = "A powerful Git assistant tool with AI-powered commit/tag/changelog generation"
|
description = "A powerful Git assistant tool with AI-powered commit/tag/changelog generation"
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ quicommit config set-llm kimi --base-url https://api.moonshot.cn/v1 --model moon
|
|||||||
# Configure DeepSeek
|
# Configure DeepSeek
|
||||||
quicommit config set-llm deepseek
|
quicommit config set-llm deepseek
|
||||||
quicommit config set-api-key YOUR_API_KEY
|
quicommit config set-api-key YOUR_API_KEY
|
||||||
quicommit config set-llm deepseek --base-url https://api.deepseek.com/v1 --model deepseek-chat
|
quicommit config set-llm deepseek --base-url https://api.deepseek.com --model deepseek-chat
|
||||||
|
|
||||||
# Configure OpenRouter
|
# Configure OpenRouter
|
||||||
quicommit config set-llm openrouter
|
quicommit config set-llm openrouter
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ quicommit config set-llm kimi --base-url https://api.moonshot.cn/v1 --model moon
|
|||||||
# 配置DeepSeek
|
# 配置DeepSeek
|
||||||
quicommit config set-llm deepseek
|
quicommit config set-llm deepseek
|
||||||
quicommit config set-api-key YOUR_API_KEY
|
quicommit config set-api-key YOUR_API_KEY
|
||||||
quicommit config set-llm deepseek --base-url https://api.deepseek.com/v1 --model deepseek-chat
|
quicommit config set-llm deepseek --base-url https://api.deepseek.com --model deepseek-chat
|
||||||
|
|
||||||
# 配置OpenRouter
|
# 配置OpenRouter
|
||||||
quicommit config set-llm openrouter
|
quicommit config set-llm openrouter
|
||||||
|
|||||||
@@ -726,7 +726,7 @@ mod tests {
|
|||||||
let backend = Backend::DeepSeek(
|
let backend = Backend::DeepSeek(
|
||||||
deepseek::Client::builder()
|
deepseek::Client::builder()
|
||||||
.api_key("sk-test")
|
.api_key("sk-test")
|
||||||
.base_url("https://api.deepseek.com/v1")
|
.base_url("https://api.deepseek.com")
|
||||||
.http_client(recorder.clone())
|
.http_client(recorder.clone())
|
||||||
.build()
|
.build()
|
||||||
.expect("build deepseek client with mock backend"),
|
.expect("build deepseek client with mock backend"),
|
||||||
@@ -843,7 +843,7 @@ mod tests {
|
|||||||
let captured = recorder.requests();
|
let captured = recorder.requests();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
captured[0].uri,
|
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();
|
let body: serde_json::Value = serde_json::from_slice(&captured[0].body).unwrap();
|
||||||
assert_eq!(body["model"], "deepseek-v4-flash");
|
assert_eq!(body["model"], "deepseek-v4-flash");
|
||||||
@@ -911,7 +911,7 @@ mod tests {
|
|||||||
let backend = Backend::DeepSeek(
|
let backend = Backend::DeepSeek(
|
||||||
deepseek::Client::builder()
|
deepseek::Client::builder()
|
||||||
.api_key("sk-test")
|
.api_key("sk-test")
|
||||||
.base_url("https://api.deepseek.com/v1")
|
.base_url("https://api.deepseek.com")
|
||||||
.http_client(MockStreamingClient {
|
.http_client(MockStreamingClient {
|
||||||
sse_bytes: sse.to_string().into(),
|
sse_bytes: sse.to_string().into(),
|
||||||
})
|
})
|
||||||
@@ -1438,7 +1438,7 @@ mod tests {
|
|||||||
let backend = Backend::DeepSeek(
|
let backend = Backend::DeepSeek(
|
||||||
deepseek::Client::builder()
|
deepseek::Client::builder()
|
||||||
.api_key(&key)
|
.api_key(&key)
|
||||||
.base_url("https://api.deepseek.com/v1")
|
.base_url("https://api.deepseek.com")
|
||||||
.http_client(smoke_http())
|
.http_client(smoke_http())
|
||||||
.build()
|
.build()
|
||||||
.expect("build deepseek client"),
|
.expect("build deepseek client"),
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ pub fn get_default_base_url(provider: &str) -> &'static str {
|
|||||||
"openai" => "https://api.openai.com/v1",
|
"openai" => "https://api.openai.com/v1",
|
||||||
"anthropic" => "https://api.anthropic.com/v1",
|
"anthropic" => "https://api.anthropic.com/v1",
|
||||||
"kimi" => "https://api.moonshot.cn/v1",
|
"kimi" => "https://api.moonshot.cn/v1",
|
||||||
"deepseek" => "https://api.deepseek.com/v1",
|
"deepseek" => "https://api.deepseek.com",
|
||||||
"openrouter" => "https://openrouter.ai/api/v1",
|
"openrouter" => "https://openrouter.ai/api/v1",
|
||||||
"ollama" => "http://localhost:11434",
|
"ollama" => "http://localhost:11434",
|
||||||
_ => "",
|
_ => "",
|
||||||
@@ -294,10 +294,7 @@ mod tests {
|
|||||||
"https://api.anthropic.com/v1"
|
"https://api.anthropic.com/v1"
|
||||||
);
|
);
|
||||||
assert_eq!(get_default_base_url("kimi"), "https://api.moonshot.cn/v1");
|
assert_eq!(get_default_base_url("kimi"), "https://api.moonshot.cn/v1");
|
||||||
assert_eq!(
|
assert_eq!(get_default_base_url("deepseek"), "https://api.deepseek.com");
|
||||||
get_default_base_url("deepseek"),
|
|
||||||
"https://api.deepseek.com/v1"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
get_default_base_url("openrouter"),
|
get_default_base_url("openrouter"),
|
||||||
"https://openrouter.ai/api/v1"
|
"https://openrouter.ai/api/v1"
|
||||||
|
|||||||
Reference in New Issue
Block a user