feat: 完整游戏运维功能

This commit is contained in:
npc0-hue
2026-07-18 09:04:01 +08:00
parent f3b14b7945
commit 48b8ad8d6c
187 changed files with 16607 additions and 1140 deletions
+8 -5
View File
@@ -7,7 +7,7 @@ import (
"browser.local/platform/domain"
)
func TestAIProviderResponseExposesOnlyKeyReference(t *testing.T) {
func TestAIProviderResponseExposesOnlyKeyPresence(t *testing.T) {
responseType := reflect.TypeOf(AIProviderResponse{})
if _, ok := responseType.FieldByName("APIKey"); ok {
t.Fatal("AI provider response must not expose raw API key")
@@ -15,8 +15,11 @@ func TestAIProviderResponseExposesOnlyKeyReference(t *testing.T) {
if _, ok := responseType.FieldByName("RawAPIKey"); ok {
t.Fatal("AI provider response must not expose raw API key")
}
if _, ok := responseType.FieldByName("APIKeyRef"); !ok {
t.Fatal("AI provider response must expose API key reference")
if _, ok := responseType.FieldByName("APIKeyRef"); ok {
t.Fatal("AI provider response must not expose internal API key reference")
}
if _, ok := responseType.FieldByName("APIKeyConfigured"); !ok {
t.Fatal("AI provider response must expose API key presence")
}
}
@@ -41,8 +44,8 @@ func TestAIProviderFromDomainCopiesModels(t *testing.T) {
if provider.Models[0] != "gpt-4.1" {
t.Fatalf("expected response models to be copied, got source models %+v", provider.Models)
}
if response.APIKeyRef != provider.APIKeyRef {
t.Fatalf("expected API key reference to be preserved, got %q", response.APIKeyRef)
if !response.APIKeyConfigured {
t.Fatal("expected configured API key presence")
}
}