fix: preserve empty reasoning_content for DeepSeek V4 thinking mode (#24146)
Co-authored-by: Simon Klee <hello@simonklee.dk>
This commit is contained in:
@@ -185,8 +185,9 @@ function normalizeMessages(
|
|||||||
// Filter out reasoning parts from content
|
// Filter out reasoning parts from content
|
||||||
const filteredContent = msg.content.filter((part: any) => part.type !== "reasoning")
|
const filteredContent = msg.content.filter((part: any) => part.type !== "reasoning")
|
||||||
|
|
||||||
// Include reasoning_content | reasoning_details directly on the message for all assistant messages
|
// Include reasoning_content | reasoning_details directly on the message for all assistant messages.
|
||||||
if (reasoningText) {
|
// 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 {
|
return {
|
||||||
...msg,
|
...msg,
|
||||||
content: filteredContent,
|
content: filteredContent,
|
||||||
@@ -200,12 +201,6 @@ function normalizeMessages(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
|
||||||
...msg,
|
|
||||||
content: filteredContent,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user