fix: 兼容 base_url 末尾斜杠,避免拼接产生双斜杠导致 404
anthropic.rs 和 openai.rs 在构造时 trim_end_matches('/'),兼容如 https://opencode.ai/zen/go/v1/ 带末尾斜杠的 base_url。
This commit is contained in:
parent
4da7b5f505
commit
f264a7b307
@ -159,6 +159,9 @@ impl AnthropicProvider {
|
||||
.build()
|
||||
.unwrap_or_else(|_| Client::new());
|
||||
|
||||
// 兼容带末尾斜杠的 base_url,避免 format!("{}/v1/messages", base_url) 产生双斜杠
|
||||
let base_url = base_url.trim_end_matches('/').to_string();
|
||||
|
||||
Self {
|
||||
client,
|
||||
name,
|
||||
|
||||
@ -263,6 +263,10 @@ impl OpenAIProvider {
|
||||
.build()
|
||||
.unwrap_or_else(|_| Client::new());
|
||||
|
||||
// 兼容带末尾斜杠的 base_url(如 https://opencode.ai/zen/go/v1/),
|
||||
// 否则 format!("{}/chat/completions", base_url) 会产生双斜杠导致 404
|
||||
let base_url = base_url.trim_end_matches('/').to_string();
|
||||
|
||||
Self {
|
||||
client,
|
||||
name,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user