mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 05:45:04 +03:00
chore(sanitizer): remove explanatory reasoning comments
Keep the tool/function-call preservation logic intact while removing noisy implementation comments from the PR diff. Co-Authored-By: OpenClaude (dmassoneto) <openclaude@gitlawb.com>
This commit is contained in:
@@ -285,10 +285,6 @@ function sanitizeMessage(msg: unknown): unknown {
|
||||
// Non-streaming responses should not expose both visible content and reasoning_content.
|
||||
// Some clients drop the visible assistant text or render duplicated panels when both fields
|
||||
// are present in the final payload. Keep reasoning_content only for reasoning-only messages.
|
||||
// EXCEPTION: When tool_calls (or legacy function_call) are present, reasoning_content
|
||||
// must be preserved because thinking-enabled providers (e.g., Kimi) require it on
|
||||
// assistant tool call messages. Without it, subsequent requests fail with:
|
||||
// "thinking is enabled but reasoning_content is missing in assistant tool call message"
|
||||
if (
|
||||
sanitized.reasoning_content !== undefined &&
|
||||
hasVisibleMessageContent(sanitized.content) &&
|
||||
|
||||
@@ -58,8 +58,6 @@ test("sanitizeOpenAIResponse extracts thinking, collapses newlines, preserves re
|
||||
assert.equal((sanitized as any).choices[0].index, 2);
|
||||
assert.equal((sanitized as any).choices[0].finish_reason, "tool_calls");
|
||||
(assert as any).equal((sanitized as any).choices[0].message.content, "Hello\n\nworld");
|
||||
// reasoning_content extracted from <think> tags is preserved when tool_calls exist
|
||||
// because thinking-enabled providers require it on assistant tool call messages
|
||||
assert.equal((sanitized as any).choices[0].message.reasoning_content, "internal chain");
|
||||
(assert as any).deepEqual((sanitized as any).choices[0].message.tool_calls, [{ id: "call_1" }]);
|
||||
assert.deepEqual((sanitized as any).choices[0].message.function_call, { name: "legacy" });
|
||||
|
||||
Reference in New Issue
Block a user