Files
ds2api/internal/adapter/openai/responses_input_items_test.go
CJACK 131ca7d398 feat: revamp DeepSeek v4 model handling
- replace legacy DeepSeek ids with the new deepseek-v4 model family\n- move thinking control to request parameters and preserve assistant reasoning content\n- switch history split to IGNORE transcript injection and map upload auth failures to 401\n- update admin defaults, API docs, samples, and tests for the new model scheme
2026-04-26 00:02:14 +08:00

51 lines
1.3 KiB
Go

package openai
import "testing"
func TestNormalizeResponsesInputItemPreservesAssistantReasoningContent(t *testing.T) {
item := map[string]any{
"role": "assistant",
"reasoning_content": "hidden reasoning",
"tool_calls": []any{
map[string]any{
"type": "function",
"function": map[string]any{
"name": "search",
"arguments": `{"q":"docs"}`,
},
},
},
}
got := normalizeResponsesInputItem(item)
if got == nil {
t.Fatal("expected assistant item to be preserved")
}
if got["role"] != "assistant" {
t.Fatalf("unexpected role: %#v", got["role"])
}
if got["reasoning_content"] != "hidden reasoning" {
t.Fatalf("expected reasoning_content preserved, got %#v", got["reasoning_content"])
}
}
func TestNormalizeResponsesInputItemAssistantMessageWithReasoningBlocks(t *testing.T) {
item := map[string]any{
"type": "message",
"role": "assistant",
"content": []any{
map[string]any{"type": "reasoning", "text": "internal chain"},
map[string]any{"type": "output_text", "text": "visible answer"},
},
}
got := normalizeResponsesInputItem(item)
if got == nil {
t.Fatal("expected assistant message item to be preserved")
}
content, _ := got["content"].([]any)
if len(content) != 2 {
t.Fatalf("expected content blocks preserved, got %#v", got["content"])
}
}