package proxy import ( "strings" "testing" ) func TestIsIdentityQuestion(t *testing.T) { yes := []string{ "你是谁?", "你是什么模型", "你叫什么名字", "什么模型", "哪个模型", "你基于什么", "你是哪个AI", "你的身份是什么", "who are you", "what are you", "what model are you", "which model do you use", "tell me about yourself", "identify yourself", "what is your name", "what AI are you", } no := []string{ "帮我写一段 Go 代码", "fix this bug", "explain this function", "what does this code do", "你是怎么实现这个功能的", // "how did you implement" - not identity "what is the weather today", } for _, q := range yes { if !isIdentityQuestion(q) { t.Errorf("expected isIdentityQuestion(%q)=true", q) } } for _, q := range no { if isIdentityQuestion(q) { t.Errorf("expected isIdentityQuestion(%q)=false", q) } } } func TestFriendlyModelName(t *testing.T) { cases := []struct{ in, want string }{ {"claude-opus-4.7", "Claude Opus 4.7"}, {"claude-opus-4-7", "Claude Opus 4.7"}, {"claude-opus-4.7-thinking", "Claude Opus 4.7"}, {"claude-sonnet-4.5", "Claude Sonnet 4.5"}, {"claude-sonnet-4-5", "Claude Sonnet 4.5"}, {"claude-sonnet-4.6", "Claude Sonnet 4.6"}, {"claude-sonnet-4.7", "Claude Sonnet 4.7"}, {"claude-sonnet-4", "Claude Sonnet 4"}, {"claude-haiku-4.5", "Claude Haiku 4.5"}, {"claude-haiku-4-5", "Claude Haiku 4.5"}, } for _, tc := range cases { got := friendlyModelName(tc.in) if got != tc.want { t.Errorf("friendlyModelName(%q) = %q; want %q", tc.in, got, tc.want) } } } func TestClaudeIdentityTextLanguage(t *testing.T) { zhText := claudeIdentityText("claude-opus-4.7", "你是谁") if !hasChinese(zhText) { t.Errorf("expected Chinese response for Chinese question, got %q", zhText) } if !strings.Contains(zhText, "Claude Opus 4.7") { t.Errorf("expected model name in response, got %q", zhText) } if !strings.Contains(zhText, "Anthropic") { t.Errorf("expected Anthropic in response, got %q", zhText) } enText := claudeIdentityText("claude-sonnet-4.5", "who are you") if hasChinese(enText) { t.Errorf("expected English response for English question, got %q", enText) } if !strings.Contains(enText, "Claude Sonnet 4.5") { t.Errorf("expected model name in English response, got %q", enText) } }