Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
61
backend/internal/modelconfig/model_info_test.go
Normal file
61
backend/internal/modelconfig/model_info_test.go
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package modelconfig
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/router-for-me/CLIProxyAPI/v7/internal/registry"
|
||||
)
|
||||
|
||||
func TestResolveModelInfoUsesSuffixFreeStaticCapabilities(t *testing.T) {
|
||||
info := ResolveModelInfo("claude-opus-4-6(high)", "claude", nil)
|
||||
if info == nil || info.Thinking == nil {
|
||||
t.Fatalf("ResolveModelInfo() = %+v, want inherited thinking support", info)
|
||||
}
|
||||
if info.ID != "claude-opus-4-6(high)" {
|
||||
t.Fatalf("model ID = %q, want configured upstream name", info.ID)
|
||||
}
|
||||
if info.UserDefined {
|
||||
t.Fatal("resolved capability snapshot must not be user-defined")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveModelInfoExplicitThinkingOverridesAndClones(t *testing.T) {
|
||||
support := ®istry.ThinkingSupport{Levels: []string{" XHIGH ", "xhigh", " High "}}
|
||||
info := ResolveModelInfo("custom-model", "codex", support)
|
||||
if info == nil || info.Thinking == nil {
|
||||
t.Fatalf("ResolveModelInfo() = %+v, want explicit thinking support", info)
|
||||
}
|
||||
if got := info.Thinking.Levels; len(got) != 2 || got[0] != "xhigh" || got[1] != "high" {
|
||||
t.Fatalf("normalized levels = %v, want [xhigh high]", got)
|
||||
}
|
||||
support.Levels[0] = "low"
|
||||
if info.Thinking.Levels[0] != "xhigh" {
|
||||
t.Fatal("resolved thinking support shares mutable config storage")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeThinkingSupportDerivesSpecialLevelFlags(t *testing.T) {
|
||||
support := NormalizeThinkingSupport(®istry.ThinkingSupport{Levels: []string{"low", "none", "auto"}})
|
||||
if support == nil {
|
||||
t.Fatal("NormalizeThinkingSupport() = nil")
|
||||
}
|
||||
if !support.ZeroAllowed {
|
||||
t.Fatal("none level did not enable ZeroAllowed")
|
||||
}
|
||||
if !support.DynamicAllowed {
|
||||
t.Fatal("auto level did not enable DynamicAllowed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveModelInfoUnknownModelKeepsMissingCapability(t *testing.T) {
|
||||
info := ResolveModelInfo("unknown-configured-model", "claude", nil)
|
||||
if info == nil {
|
||||
t.Fatal("ResolveModelInfo() = nil")
|
||||
}
|
||||
if info.Thinking != nil {
|
||||
t.Fatalf("unknown model thinking = %+v, want nil", info.Thinking)
|
||||
}
|
||||
if info.UserDefined {
|
||||
t.Fatal("unknown configured model must use its exact bound capability")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue