Skip to content

Commit 59efcb7

Browse files
committed
Guard MCP reasoning stream from whitespace <think> blocks
1 parent 82036e7 commit 59efcb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/server/textGeneration/mcp/runMcpFlow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ export async function* runMcpFlow({
493493
// Merge reasoning + content into a single combined token stream, mirroring
494494
// the OpenAI adapter so the UI can auto-detect <think> blocks.
495495
let combined = "";
496-
if (deltaReasoning && deltaReasoning.length > 0) {
496+
if (deltaReasoning.trim().length > 0) {
497497
if (!thinkOpen) {
498498
combined += "<think>" + deltaReasoning;
499499
thinkOpen = true;

0 commit comments

Comments
 (0)