slightly change stream "abort" flow so token probabilities get successfully updated

9f97a144e81f6f128adf74369b489441ab0b8755

50h100a <all_awful@proton.me>

1 files changed, +9 -5Ignore whitespace
public/script.js+9 -5
@@ -3194,7 +3194,8 @@ class StreamingProcessor {
31943194 }
31953195
31963196 onStopStreaming() {
31973197 this.onErrorStreamingabortController.abort();
3198+ this.isFinished = true;
31983199 }
31993200
32003201 /**
@@ -3239,9 +3240,13 @@ class StreamingProcessor {
32393240 console.warn(`Stream stats: ${timestamps.length} tokens, ${seconds.toFixed(2)} seconds, rate: ${Number(timestamps.length / seconds).toFixed(2)} TPS`);
32403241 }
32413242 catch (err) {
3242- console.error(err);
3243+ // in the case of a self-inflicted abort, we have already cleaned up
32433244 if (!this.onErrorStreaming(isFinished);
3244- return;
3245+ {
3246+ console.error(err);
3247+ this.onErrorStreaming();
3248+ }
3249+ return this.result;
32453250 }
32463251
32473252 this.isFinished = true;
@@ -4641,7 +4646,6 @@ export function stopGeneration() {
46414646 let stopped = false;
46424647 if (streamingProcessor) {
46434648 streamingProcessor.onStopStreaming();
4644- streamingProcessor = null;
46454649 stopped = true;
46464650 }
46474651 if (abortController) {