mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
Merge pull request #9470 from Kilo-Org/fix/cli-preserve-empty-reasoning-content
fix(cli): preserve empty reasoning_content in interleaved transform
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
---
|
||||
|
||||
Fix multi-turn tool calls with DeepSeek thinking mode by preserving empty `reasoning_content` in the interleaved transform.
|
||||
@@ -193,25 +193,23 @@ function normalizeMessages(
|
||||
// Filter out reasoning parts from content
|
||||
const filteredContent = msg.content.filter((part: any) => part.type !== "reasoning")
|
||||
|
||||
// Include reasoning_content | reasoning_details directly on the message for all assistant messages
|
||||
if (reasoningText) {
|
||||
return {
|
||||
...msg,
|
||||
content: filteredContent,
|
||||
providerOptions: {
|
||||
...msg.providerOptions,
|
||||
openaiCompatible: {
|
||||
...msg.providerOptions?.openaiCompatible,
|
||||
[field]: reasoningText,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// kilocode_change start - cherry-picked from anomalyco/opencode#24146;
|
||||
// will be reverted on the next wholesale upstream merge.
|
||||
// Include reasoning_content | reasoning_details directly on the message for all assistant messages.
|
||||
// Always set the field even when empty — some providers (e.g. DeepSeek) may return empty
|
||||
// reasoning_content which still needs to be sent back in subsequent requests.
|
||||
return {
|
||||
...msg,
|
||||
content: filteredContent,
|
||||
providerOptions: {
|
||||
...msg.providerOptions,
|
||||
openaiCompatible: {
|
||||
...msg.providerOptions?.openaiCompatible,
|
||||
[field]: reasoningText,
|
||||
},
|
||||
},
|
||||
}
|
||||
// kilocode_change end
|
||||
}
|
||||
|
||||
return msg
|
||||
|
||||
Reference in New Issue
Block a user