diff --git a/crates/agent-gui/src/lib/providers/deepSeekProviderAdapter.ts b/crates/agent-gui/src/lib/providers/deepSeekProviderAdapter.ts index 91df5fdae..b5c42ddba 100644 --- a/crates/agent-gui/src/lib/providers/deepSeekProviderAdapter.ts +++ b/crates/agent-gui/src/lib/providers/deepSeekProviderAdapter.ts @@ -377,6 +377,8 @@ export function attachDeepSeekProviderPayloadAdapter { assert.equal(captured.options.toolChoice, "auto"); }); -test("DeepSeek Codex models force Chat Completions compat", () => { - const model = providers.createModelFromConfig( - "codex", - "deepseek-v4-pro", - "https://api.deepseek.com", - "openai-responses", - ); - - assert.equal(model.api, "openai-completions"); - assert.equal(model.reasoning, true); - assert.equal(model.compat.thinkingFormat, "deepseek"); - assert.equal(model.compat.requiresReasoningContentOnAssistantMessages, true); - assert.equal(model.compat.supportsStrictMode, false); - assert.equal(model.compat.maxTokensField, "max_tokens"); - // 档位来自生成目录:deepseek-v4-pro 只有 high/max(minimal/low/medium=null), - // xhigh 目录未声明故不复活;wire 改写只补到已支持档位(high→"high")。 - assert.equal(model.thinkingLevelMap.minimal, null); - assert.equal(model.thinkingLevelMap.high, "high"); - assert.equal(model.thinkingLevelMap.xhigh, undefined); - assert.equal(model.thinkingLevelMap.max, "max"); -}); - -test("DeepSeek OpenAI payload adapter injects thinking and reasoning_content", async () => { - let captured; - const localLoader = createTsModuleLoader({ - mocks: { - "@earendil-works/pi-ai/api/openai-completions": { - stream(model, context, options) { - captured = { model, context, options }; - return createMockAssistantStream(); - }, - }, - }, - }); - const localProviders = localLoader.loadModule("src/lib/providers/llm.ts"); - const model = localProviders.createModelFromConfig( - "codex", - "deepseek-v4-pro", - "https://api.deepseek.com", - "openai-responses", - ); - - const result = localProviders.streamSimpleByApi( - model, - { messages: [] }, - { reasoning: "minimal", toolChoice: "auto" }, - ); - assert.equal(typeof result.result, "function"); - assert.equal(typeof captured.options.onPayload, "function"); - - const adapted = await captured.options.onPayload( - { - messages: [ - { - role: "assistant", - content: null, - tool_calls: [ - { - id: "call_1", - type: "function", - function: { name: "Read", arguments: "{}" }, - }, - ], - }, - ], - }, - model, - ); - - assert.deepEqual(adapted.thinking, { type: "enabled" }); - assert.equal(adapted.reasoning_effort, "high"); - assert.equal(adapted.messages[0].reasoning_content, ""); -}); - test("DeepSeek Anthropic streamSimpleByApi strips aborted tool calls before conversion", () => { const { localProviders, state } = loadProvidersWithCapturedAnthropicStream(); const model = createDeepSeekAnthropicModel();