Fix smooth streaming not working with multiswipe

This commit is contained in:
Cohee 2024-05-19 16:41:55 +03:00
parent dd06fddd17
commit a17588fb1b
1 changed files with 2 additions and 2 deletions

View File

@ -174,7 +174,7 @@ async function* parseStreamData(json) {
else if (Array.isArray(json.choices)) {
const isNotPrimary = json?.choices?.[0]?.index > 0;
if (isNotPrimary || json.choices.length === 0) {
return null;
throw new Error('Not a primary swipe');
}
if (typeof json.choices[0].text === 'string' && json.choices[0].text.length > 0) {
@ -271,7 +271,7 @@ export class SmoothEventSourceStream extends EventSourceStream {
hasFocus && await eventSource.emit(event_types.SMOOTH_STREAM_TOKEN_RECEIVED, parsed.chunk);
}
} catch (error) {
console.error('Smooth Streaming parsing error', error);
console.debug('Smooth Streaming parsing error', error);
controller.enqueue(event);
}
},