mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-07 09:55:29 +08:00
- 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
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package util
|
|
|
|
import "testing"
|
|
|
|
func TestResolveThinkingEnabledPriority(t *testing.T) {
|
|
req := map[string]any{
|
|
"thinking": map[string]any{"type": "disabled"},
|
|
"extra_body": map[string]any{
|
|
"thinking": map[string]any{"type": "enabled"},
|
|
},
|
|
"reasoning_effort": "high",
|
|
}
|
|
if got := ResolveThinkingEnabled(req, true); got {
|
|
t.Fatalf("expected top-level thinking to win, got enabled=%v", got)
|
|
}
|
|
}
|
|
|
|
func TestResolveThinkingEnabledUsesExtraBodyFallback(t *testing.T) {
|
|
req := map[string]any{
|
|
"extra_body": map[string]any{
|
|
"thinking": map[string]any{"type": "disabled"},
|
|
},
|
|
}
|
|
if got := ResolveThinkingEnabled(req, true); got {
|
|
t.Fatalf("expected extra_body thinking to disable, got enabled=%v", got)
|
|
}
|
|
}
|
|
|
|
func TestResolveThinkingEnabledMapsReasoningEffortToEnabled(t *testing.T) {
|
|
for _, effort := range []string{"low", "medium", "high", "xhigh"} {
|
|
if got := ResolveThinkingEnabled(map[string]any{"reasoning_effort": effort}, false); !got {
|
|
t.Fatalf("expected reasoning_effort=%s to enable thinking", effort)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestResolveThinkingEnabledDefaultsWhenUnset(t *testing.T) {
|
|
if !ResolveThinkingEnabled(nil, true) {
|
|
t.Fatal("expected default thinking=true when unset")
|
|
}
|
|
if ResolveThinkingEnabled(nil, false) {
|
|
t.Fatal("expected default thinking=false when unset")
|
|
}
|
|
}
|