mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-09-11 14:47:58 +08:00
- Added `is-compat` model metadata plumbing from config through executor and helpers, including hash computation. - Introduced a compatibility-aware translation path (`TranslateRequestWithAPIKeyModelCompatibility`) and wired it into Claude/Gemini/Codex/Interactions request flows. - Updated Claude message sanitization/translation behavior to keep empty-thinking compatibility blocks (including signatures) when `is-compat` is enabled, while keeping default behavior unchanged.
30 lines
974 B
Go
30 lines
974 B
Go
package auth
|
|
|
|
import (
|
|
"testing"
|
|
|
|
internalconfig "github.com/router-for-me/CLIProxyAPI/v7/internal/config"
|
|
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/executor"
|
|
)
|
|
|
|
func TestResolvedAPIKeyModelInfoPropagatesIsCompat(t *testing.T) {
|
|
manager := NewManager(nil, nil, nil)
|
|
manager.SetConfig(&internalconfig.Config{ClaudeKey: []internalconfig.ClaudeKey{{
|
|
APIKey: "compat-key",
|
|
Prefix: "tenant",
|
|
Models: []internalconfig.ClaudeModel{{
|
|
Name: "deepseek-upstream",
|
|
Alias: "deepseek-alias",
|
|
IsCompat: true,
|
|
}},
|
|
}}})
|
|
auth := configuredCapabilityTestAuth("compat-auth", "compat-key")
|
|
registerCapabilityTestAuth(t, manager, auth)
|
|
|
|
req := manager.attachResolvedAPIKeyModelInfo(cliproxyexecutor.Request{}, auth, "tenant/deepseek-alias", "deepseek-upstream")
|
|
info, ok := ResolvedAPIKeyModelInfo(req)
|
|
if !ok || info == nil || !info.IsCompat {
|
|
t.Fatalf("ResolvedAPIKeyModelInfo() = (%+v, %t), want IsCompat=true", info, ok)
|
|
}
|
|
}
|