fix(registry): include copilot in static model lookup

Add Copilot models and use embedded Meta definitions in
LookupStaticModelInfo so configured Codex models inherit static
thinking presets. Add regression test covering Copilot and
Claude presets.
This commit is contained in:
hkfires
2026-11-22 09:29:54 +08:00
parent 94b164bf16
commit cbfc90ade8
2 changed files with 24 additions and 1 deletions

View File

@@ -662,7 +662,8 @@ func LookupStaticModelInfo(modelID string) *ModelInfo {
data.Antigravity,
data.XAI,
GetDevinModels(),
GetMetaModels(),
data.Meta,
data.Copilot,
}
for _, models := range allModels {
for _, m := range models {

View File

@@ -1,6 +1,7 @@
package cliproxy
import (
"reflect"
"testing"
"github.com/router-for-me/CLIProxyAPI/v8/internal/config"
@@ -98,6 +99,27 @@ func TestBuildCodexConfigModelsSelectsDefaultsOrConfiguredModels(t *testing.T) {
}
}
func TestBuildCodexConfigModelsInheritsStaticThinking(t *testing.T) {
for _, tt := range []struct{ id, channel string }{
{"mai-code-2-flash", "copilot"},
{"claude-sonnet-5", "claude"},
} {
t.Run(tt.id, func(t *testing.T) {
preset := registry.LookupStaticModelInfoByChannel(tt.id, tt.channel)
if preset == nil || preset.Thinking == nil {
t.Fatalf("missing thinking preset for %s in %s", tt.id, tt.channel)
}
models := buildCodexConfigModels(&config.CodexKey{Models: []config.CodexModel{{Name: tt.id}}})
if len(models) != 1 {
t.Fatalf("got %d configured models, want 1", len(models))
}
if !reflect.DeepEqual(models[0].Thinking, preset.Thinking) {
t.Errorf("thinking = %+v, want %s preset %+v", models[0].Thinking, tt.channel, preset.Thinking)
}
})
}
}
func TestBuildConfigModelsDisplayNameFallback(t *testing.T) {
model := buildClaudeConfigModels(&config.ClaudeKey{Models: []config.ClaudeModel{{
Name: "claude-upstream", Alias: "claude-catalog",