feat(backend): add kiro account support
This commit is contained in:
@@ -22,6 +22,7 @@ const (
|
||||
PlatformOpenAI = "openai"
|
||||
PlatformGemini = "gemini"
|
||||
PlatformAntigravity = "antigravity"
|
||||
PlatformKiro = "kiro"
|
||||
)
|
||||
|
||||
// Account type constants
|
||||
@@ -116,6 +117,21 @@ var DefaultAntigravityModelMapping = map[string]string{
|
||||
"tab_flash_lite_preview": "tab_flash_lite_preview",
|
||||
}
|
||||
|
||||
// DefaultKiroModelMapping 是 Kiro 平台的默认模型映射。
|
||||
// 键为对外暴露/允许请求的模型名,值为实际发送到 Kiro 上游的模型名。
|
||||
var DefaultKiroModelMapping = map[string]string{
|
||||
"claude-opus-4-6": "claude-opus-4.6",
|
||||
"claude-opus-4-6-thinking": "claude-opus-4.6",
|
||||
"claude-sonnet-4-6": "claude-sonnet-4.6",
|
||||
"claude-sonnet-4-6-thinking": "claude-sonnet-4.6",
|
||||
"claude-opus-4-5-20251101": "claude-opus-4.5",
|
||||
"claude-opus-4-5-20251101-thinking": "claude-opus-4.5",
|
||||
"claude-sonnet-4-5-20250929": "claude-sonnet-4.5",
|
||||
"claude-sonnet-4-5-20250929-thinking": "claude-sonnet-4.5",
|
||||
"claude-haiku-4-5-20251001": "claude-haiku-4.5",
|
||||
"claude-haiku-4-5-20251001-thinking": "claude-haiku-4.5",
|
||||
}
|
||||
|
||||
// DefaultBedrockModelMapping 是 AWS Bedrock 平台的默认模型映射
|
||||
// 将 Anthropic 标准模型名映射到 Bedrock 模型 ID
|
||||
// 注意:此处的 "us." 前缀仅为默认值,ResolveBedrockModelID 会根据账号配置的
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package domain
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDefaultAntigravityModelMapping_ImageCompatibilityAliases(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -24,3 +27,54 @@ func TestDefaultAntigravityModelMapping_ImageCompatibilityAliases(t *testing.T)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultKiroModelMapping_MatchesKiroReferenceModels(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
expected := map[string]string{
|
||||
"claude-opus-4-6": "claude-opus-4.6",
|
||||
"claude-opus-4-6-thinking": "claude-opus-4.6",
|
||||
"claude-sonnet-4-6": "claude-sonnet-4.6",
|
||||
"claude-sonnet-4-6-thinking": "claude-sonnet-4.6",
|
||||
"claude-opus-4-5-20251101": "claude-opus-4.5",
|
||||
"claude-opus-4-5-20251101-thinking": "claude-opus-4.5",
|
||||
"claude-sonnet-4-5-20250929": "claude-sonnet-4.5",
|
||||
"claude-sonnet-4-5-20250929-thinking": "claude-sonnet-4.5",
|
||||
"claude-haiku-4-5-20251001": "claude-haiku-4.5",
|
||||
"claude-haiku-4-5-20251001-thinking": "claude-haiku-4.5",
|
||||
}
|
||||
|
||||
if len(DefaultKiroModelMapping) != len(expected) {
|
||||
t.Fatalf("expected %d Kiro mappings, got %d", len(expected), len(DefaultKiroModelMapping))
|
||||
}
|
||||
for model, want := range expected {
|
||||
if got := DefaultKiroModelMapping[model]; got != want {
|
||||
t.Fatalf("unexpected Kiro mapping for %q: got %q want %q", model, got, want)
|
||||
}
|
||||
}
|
||||
|
||||
for _, model := range []string{
|
||||
"claude-opus-4-5",
|
||||
"claude-sonnet-4-5",
|
||||
"claude-sonnet-4",
|
||||
"gpt-4o",
|
||||
"gpt-4",
|
||||
"deepseek-3-2",
|
||||
"minimax-m2-1",
|
||||
"qwen3-coder-next",
|
||||
"claude-opus-4-7",
|
||||
"claude-sonnet-4-6-chat",
|
||||
} {
|
||||
if _, ok := DefaultKiroModelMapping[model]; ok {
|
||||
t.Fatalf("did not expect %q to remain in DefaultKiroModelMapping", model)
|
||||
}
|
||||
}
|
||||
for model := range DefaultKiroModelMapping {
|
||||
if strings.HasSuffix(model, "-agentic") {
|
||||
t.Fatalf("did not expect agentic Kiro mapping %q", model)
|
||||
}
|
||||
if strings.HasSuffix(model, "-chat") {
|
||||
t.Fatalf("did not expect chat-only Kiro mapping %q", model)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user