package orchestrator import ( "encoding/json" "net/http" "net/http/httptest" "strings" "testing" "github.com/muyue/muyue/internal/config" ) func TestCleanAIResponse(t *testing.T) { tests := []struct { name string input string expected string }{ { "malformed think tags pass through", "reasoningresponse", "response", }, { "think with attrs, no closing bracket", "reasoningreasoning>\nvisible", "text\nvisible", }, { "removes triple markers", "text\n<<<\ninternal\n>>>\nvisible", "text\nvisible", }, { "plain text unchanged", "Hello world", "Hello world", }, { "empty input", "", "", }, { "malformed think block no closing bracket", " on opening tag, so won't match regex if result3 != ", so won't match if result4 != "reasoning after it, so won't match if result_real != "prefix