fix: ShengSuanYun default BaseUrl config and model ID normalize.
This commit is contained in:
parent
cb0c8703fb
commit
db349e0be0
3 changed files with 24 additions and 7 deletions
|
|
@ -224,11 +224,11 @@ func DefaultConfig() *Config {
|
|||
APIKey: "",
|
||||
},
|
||||
|
||||
// ShengsuanYun (神算云)
|
||||
// ShengSuanYun (胜算云)
|
||||
{
|
||||
ModelName: "deepseek-v3",
|
||||
Model: "shengsuanyun/deepseek-v3",
|
||||
APIBase: "https://api.shengsuanyun.com/v1",
|
||||
ModelName: "deepseek-v3.2-exp",
|
||||
Model: "shengsuanyun/deepseek/deepseek-v3.2-exp",
|
||||
APIBase: "https://router.shengsuanyun.com/api/v1",
|
||||
APIKey: "",
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -234,7 +234,11 @@ func normalizeModel(model, apiBase string) string {
|
|||
return model
|
||||
}
|
||||
|
||||
if strings.Contains(strings.ToLower(apiBase), "openrouter.ai") {
|
||||
lowerAPIBase := strings.ToLower(apiBase)
|
||||
if strings.Contains(lowerAPIBase, "openrouter.ai") {
|
||||
return model
|
||||
}
|
||||
if strings.Contains(lowerAPIBase, "shengsuanyun.com") {
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -274,10 +274,23 @@ func TestProviderChat_AcceptsNumericOptionTypes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNormalizeModel_UsesAPIBase(t *testing.T) {
|
||||
if got := normalizeModel("deepseek/deepseek-chat", "https://api.deepseek.com/v1"); got != "deepseek-chat" {
|
||||
if got := normalizeModel(
|
||||
"deepseek/deepseek-chat",
|
||||
"https://api.deepseek.com/v1",
|
||||
); got != "deepseek-chat" {
|
||||
t.Fatalf("normalizeModel(deepseek) = %q, want %q", got, "deepseek-chat")
|
||||
}
|
||||
if got := normalizeModel("openrouter/auto", "https://openrouter.ai/api/v1"); got != "openrouter/auto" {
|
||||
if got := normalizeModel(
|
||||
"openrouter/auto",
|
||||
"https://openrouter.ai/api/v1",
|
||||
); got != "openrouter/auto" {
|
||||
t.Fatalf("normalizeModel(openrouter) = %q, want %q", got, "openrouter/auto")
|
||||
}
|
||||
// ShengSuanYun supports full model paths like deepseek/deepseek-v3.2
|
||||
if got := normalizeModel(
|
||||
"deepseek/deepseek-v3.2-exp",
|
||||
"https://router.shengsuanyun.com/api/v1",
|
||||
); got != "deepseek/deepseek-v3.2-exp" {
|
||||
t.Fatalf("normalizeModel(shengsuanyun) = %q, want %q", got, "deepseek/deepseek-v3.2-exp")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue