#2267 Fix multiswipe mutating the array returning by the streaming provider

This commit is contained in:
Cohee 2024-05-19 16:38:18 +03:00
parent e9c5618b10
commit dd06fddd17

View File

@ -2889,6 +2889,9 @@ class StreamingProcessor {
this.onErrorStreaming();
}
/**
* @returns {Generator<{ text: string, swipes: string[], logprobs: import('./scripts/logprobs.js').TokenLogprobs }, void, void>}
*/
*nullStreamingGeneration() {
throw new Error('Generation function for streaming is not hooked up');
}
@ -2916,7 +2919,7 @@ class StreamingProcessor {
}
this.result = text;
this.swipes = swipes;
this.swipes = Array.from(swipes ?? []);
if (logprobs) {
this.messageLogprobs.push(...(Array.isArray(logprobs) ? logprobs : [logprobs]));
}