mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
refactor(models): unify provider metadata around backend catalog (#2896)
* feat(models): unify provider metadata around backend catalog - Move shared provider metadata and alias normalization into backend-owned provider catalog - Expose display, fetch, auth, and default model metadata through /api/models provider_options - Replace frontend static provider registry with catalog-driven selection, validation, grouping, and fallback rendering - Treat provider default api_base as placeholder and effective fetch/test base while keep submitted api_base separate from derived defaults - Add model page retry handling, touched locale updates, and provider metadata assertions in backend tests * fix(models): canonicalize backend provider aliases and common models * fix(models): restore deepseek common model recommendations
This commit is contained in:
@@ -1900,6 +1900,12 @@ func TestHandleListModels_ReturnsProviderOptionsWithoutPersistingLegacyMigration
|
||||
t.Fatal("openai provider option missing")
|
||||
} else if option.DefaultAPIBase != "https://api.openai.com/v1" {
|
||||
t.Fatalf("openai default_api_base = %q, want %q", option.DefaultAPIBase, "https://api.openai.com/v1")
|
||||
} else if !option.SupportsFetch {
|
||||
t.Fatal("openai provider option should report supports_fetch")
|
||||
} else if option.DisplayName != "OpenAI" {
|
||||
t.Fatalf("openai display_name = %q, want %q", option.DisplayName, "OpenAI")
|
||||
} else if len(option.CommonModels) == 0 {
|
||||
t.Fatal("openai common_models should not be empty")
|
||||
}
|
||||
if option, ok := optionsByID["anthropic"]; !ok {
|
||||
t.Fatal("anthropic provider option missing")
|
||||
@@ -1913,6 +1919,8 @@ func TestHandleListModels_ReturnsProviderOptionsWithoutPersistingLegacyMigration
|
||||
t.Fatal("github-copilot provider option missing")
|
||||
} else if option.DefaultAPIBase != "localhost:4321" {
|
||||
t.Fatalf("github-copilot default_api_base = %q, want %q", option.DefaultAPIBase, "localhost:4321")
|
||||
} else if !option.Local {
|
||||
t.Fatal("github-copilot should be marked local")
|
||||
}
|
||||
if option, ok := optionsByID["elevenlabs"]; !ok {
|
||||
t.Fatal("elevenlabs provider option missing")
|
||||
@@ -1953,6 +1961,11 @@ func TestHandleListModels_ReturnsProviderOptionsWithoutPersistingLegacyMigration
|
||||
t.Fatal("antigravity auth method should be locked")
|
||||
}
|
||||
}
|
||||
if option, ok := optionsByID["qwen-portal"]; !ok {
|
||||
t.Fatal("qwen-portal provider option missing")
|
||||
} else if len(option.Aliases) == 0 || option.Aliases[0] != "qwen" {
|
||||
t.Fatalf("qwen-portal aliases = %#v, want to include qwen", option.Aliases)
|
||||
}
|
||||
|
||||
updated, err := config.LoadConfig(configPath)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user