Fix smooth streaming

6ef63e2415d9ea6a8cf0575cf4684df1de235cf1

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -2Showing whitespace changes
public/scripts/sse-stream.js+2 -2
@@ -109,7 +109,7 @@ function getDelay(s) {
109109 */
110110async function* parseStreamData(json) {
111111 // Cohere
112112 if (typeof json.delta === 'object' && typeof json.delta.message === 'object' && ['tool-plan-delta', 'content-delta'].includes(json.type)) {
113113 const text = json?.delta?.message?.content?.text ?? '';
114114 for (let i = 0; i < text.length; i++) {
115115 const str = json.delta.message.content.text[i];
@@ -121,7 +121,7 @@ async function* parseStreamData(json) {
121121 return;
122122 }
123123 // Claude
124124 else if (typeof json.delta === 'object' && typeof json.delta.text === 'string') {
125125 if (json.delta.text.length > 0) {
126126 for (let i = 0; i < json.delta.text.length; i++) {
127127 const str = json.delta.text[i];