fix provider

This commit is contained in:
lpf
2026-02-18 23:44:52 +08:00
parent 8e9d5d71ca
commit 9ebc951441
2 changed files with 31 additions and 7 deletions

View File

@@ -117,6 +117,24 @@ func TestEndpointForResponsesCompact(t *testing.T) {
}
}
func TestToResponsesInputItems_AssistantUsesOutputText(t *testing.T) {
items := toResponsesInputItems(Message{
Role: "assistant",
Content: "hello",
})
if len(items) != 1 {
t.Fatalf("expected 1 item, got %d", len(items))
}
content, ok := items[0]["content"].([]map[string]interface{})
if !ok || len(content) == 0 {
t.Fatalf("unexpected content shape: %#v", items[0]["content"])
}
gotType, _ := content[0]["type"].(string)
if gotType != "output_text" {
t.Fatalf("assistant content type = %q, want output_text", gotType)
}
}
func containsFunctionCallMarkup(s string) bool {
return len(s) > 0 && (strings.Contains(s, "<function_call>") || strings.Contains(s, "</function_call>"))
}