Support Gradio 6 Chatbot format and multi-output spaces like tdecae-personal-chatbot

This commit is contained in:
Luxferre
2026-09-07 11:16:09 +03:00
parent c5ea129b44
commit 9f2a5068f8
2 changed files with 249 additions and 107 deletions
+7
View File
@@ -298,6 +298,13 @@ func TestParseGradioStreamOutput(t *testing.T) {
if !frame7.OK || frame7.Content != "Mocked answer" || frame7.Reasoning != "Mocked reasoning" || len(frame7.ToolCalls) != 0 {
t.Errorf("unexpected frame7: %+v", frame7)
}
// 8. Gradio 6 Chatbot multi-output format with TextMessage list
g6Raw := `["", [{"role": "user", "content": [{"text": "weather in Tokyo?", "type": "text"}]}, {"role": "assistant", "content": [{"text": "<tool_call>\n{\"name\": \"get_weather\", \"arguments\": {\"city\": \"Tokyo\"}}\n</tool_call>", "type": "text"}]}]]`
frame8 := ParseGradioStreamOutput(g6Raw)
if !frame8.OK || len(frame8.ToolCalls) != 1 || frame8.ToolCalls[0].Function.Name != "get_weather" {
t.Errorf("unexpected frame8: %+v", frame8)
}
}
func TestHunyuan3BuildPayload(t *testing.T) {