package ai import "testing" func TestTTSAlwaysUsesExplicitlyApprovedWebSocketProtocol(t *testing.T) { for _, model := range []string{"qwen3-tts-flash", "cosyvoice-v3-flash", "unknown-model"} { task, ps := currentFixture(t, "full_ai") task = changeCurrentAgent(t, task, func(a map[string]any) { a["tts"].(map[string]any)["model"] = model }) b, err := Bind(task, ps) if err != nil || b.TTS.Protocol != TTSProtocolDashScopeTask { t.Fatal("model selected the protocol", err) } } task, ps := currentFixture(t, "full_ai") p := ps["ali_bailian"] p.WSEndpoint = "" ps[p.Code] = p if _, err := Bind(task, ps); err == nil { t.Fatal("missing WS endpoint silently fell back to HTTP") } }