Skip to content

Commit 885188c

Browse files
fix: Ignore parse errors for incomplete JSON chunks during streaming
2 parents d10620f + 3f5ae2e commit 885188c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/App/src/components/Chat/Chat.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const Chat: React.FC<ChatProps> = ({
139139

140140
return toolMessage.citations;
141141
} catch {
142-
console.log("ERROR WHIEL PARSING TOOL CONTENT");
142+
// Silently ignore parse errors for incomplete JSON chunks. This is expected during streaming
143143
}
144144
return [];
145145
};
@@ -255,7 +255,7 @@ const Chat: React.FC<ChatProps> = ({
255255
runningText = text;
256256
}
257257
} catch (e) {
258-
console.error("error while parsing text before split", e);
258+
// Silently ignore parse errors for incomplete JSON chunks. This is expected during streaming
259259
}
260260

261261
}
@@ -337,7 +337,7 @@ const Chat: React.FC<ChatProps> = ({
337337
scrollChatToBottom();
338338
}
339339
} catch (e) {
340-
console.log("Error while parsing charts response", e);
340+
// Silently ignore parse errors for incomplete JSON chunks for chart response. This is expected during streaming
341341
}
342342
}
343343
}
@@ -455,7 +455,7 @@ const Chat: React.FC<ChatProps> = ({
455455
runningText = text;
456456
}
457457
} catch (e) {
458-
console.error("error while parsing text before split", e);
458+
// Ignore - will process individual chunks after splitting
459459
}
460460
if (!isChartResponseReceived) {
461461
//text based streaming response
@@ -510,7 +510,7 @@ const Chat: React.FC<ChatProps> = ({
510510
}
511511
}
512512
} catch (e) {
513-
console.log("Error while parsing and appending content", e);
513+
// Skip incomplete JSON chunks in stream
514514
}
515515
});
516516
if (hasError) {

0 commit comments

Comments
 (0)