From 8d1824edfc79ce0a053eab678d0f24fea408ef29 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Wed, 10 Dec 2025 11:12:23 -0600 Subject: [PATCH] fixes --- packages/opencode/src/provider/transform.ts | 50 +++------------------ 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index 23b2f269c1..3de7f92a03 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -74,52 +74,12 @@ export namespace ProviderTransform { return result } - // TODO: is this actually correct??? Or should it just match the other reasoning_content handling - // DeepSeek: Handle reasoning_content for tool call continuations - // - With tool calls: Include reasoning_content in providerOptions so model can continue reasoning - // - Without tool calls: Strip reasoning (new turn doesn't need previous reasoning) - // See: https://api-docs.deepseek.com/guides/thinking_mode - if (model.providerID === "deepseek" || model.api.id.toLowerCase().includes("deepseek")) { - return msgs.map((msg) => { - if (msg.role === "assistant" && Array.isArray(msg.content)) { - const reasoningParts = msg.content.filter((part: any) => part.type === "reasoning") - const hasToolCalls = msg.content.some((part: any) => part.type === "tool-call") - const reasoningText = reasoningParts.map((part: any) => part.text).join("") - - // Filter out reasoning parts from content - const filteredContent = msg.content.filter((part: any) => part.type !== "reasoning") - - // If this message has tool calls and reasoning, include reasoning_content - // so DeepSeek can continue reasoning after tool execution - if (hasToolCalls && reasoningText) { - return { - ...msg, - content: filteredContent, - providerOptions: { - ...msg.providerOptions, - openaiCompatible: { - ...(msg.providerOptions as any)?.openaiCompatible, - reasoning_content: reasoningText, - }, - }, - } - } - - // For final answers (no tool calls), just strip reasoning - return { - ...msg, - content: filteredContent, - } - } - - return msg - }) - } - if ( - model.capabilities.interleaved && - typeof model.capabilities.interleaved === "object" && - model.capabilities.interleaved.field === "reasoning_content" + model.providerID === "deepseek" || + model.api.id.toLowerCase().includes("deepseek") || + (model.capabilities.interleaved && + typeof model.capabilities.interleaved === "object" && + model.capabilities.interleaved.field === "reasoning_content") ) { return msgs.map((msg) => { if (msg.role === "assistant" && Array.isArray(msg.content)) {