feat(openai_compat): map DeepSeek thinking fields

This commit is contained in:
lc6464
2026-05-23 00:04:28 +08:00
parent f09a7d67f7
commit 3a454593ca
5 changed files with 247 additions and 1 deletions
+37
View File
@@ -605,6 +605,43 @@ func TestProcessMessage_PassesExplicitThinkingOffToProviderWithoutThinkingCapabi
}
}
func TestProcessMessage_PassesDeepSeekThinkingLevelToThinkingCapableProvider(t *testing.T) {
cfg := &config.Config{
Agents: config.AgentsConfig{
Defaults: config.AgentDefaults{
Workspace: t.TempDir(),
ModelName: "deepseek-v4-flash",
MaxTokens: 4096,
MaxToolIterations: 10,
},
},
ModelList: []*config.ModelConfig{{
ModelName: "deepseek-v4-flash",
Provider: "deepseek",
Model: "deepseek-v4-flash",
ThinkingLevel: "xhigh",
}},
}
provider := &thinkingRecordingProvider{}
al := NewAgentLoop(cfg, bus.NewMessageBus(), provider)
response, err := al.processMessage(context.Background(), testInboundMessage(bus.InboundMessage{
Channel: "pico",
ChatID: "chat-1",
Content: "hello",
}))
if err != nil {
t.Fatalf("processMessage() error = %v", err)
}
if response != "Mock response" {
t.Fatalf("processMessage() response = %q, want %q", response, "Mock response")
}
if got := provider.lastOptions["thinking_level"]; got != "xhigh" {
t.Fatalf("thinking_level option = %#v, want %q", got, "xhigh")
}
}
func TestProcessMessage_SuppressesReasoningWhenThinkingOff(t *testing.T) {
cfg := &config.Config{
Agents: config.AgentsConfig{