Merge pull request #3002 from 50h100a/streamprobs Correctly view token probabilities when 'Continue'-ing a response.

0a79d55983be94cadbb57fe31717cd3fa51c16e7

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

Signed
2 files changed, +7 -3Showing whitespace changes
public/css/logprobs.css+1 -0
@@ -56,6 +56,7 @@
56 user-select: none;56 user-select: none;
57 height: 100%;57 height: 100%;
58 overflow-y: auto;58 overflow-y: auto;
59 word-break: break-all;
59}60}
6061
61.logprobs_empty_state {62.logprobs_empty_state {
public/script.js+6 -3
@@ -3194,7 +3194,8 @@ class StreamingProcessor {
3194 }3194 }
31953195
3196 onStopStreaming() {3196 onStopStreaming() {
3197 this.onErrorStreaming();3197 this.abortController.abort();
3198 this.isFinished = true;
3198 }3199 }
31993200
3200 /**3201 /**
@@ -3239,9 +3240,12 @@ class StreamingProcessor {
3239 console.warn(`Stream stats: ${timestamps.length} tokens, ${seconds.toFixed(2)} seconds, rate: ${Number(timestamps.length / seconds).toFixed(2)} TPS`);3240 console.warn(`Stream stats: ${timestamps.length} tokens, ${seconds.toFixed(2)} seconds, rate: ${Number(timestamps.length / seconds).toFixed(2)} TPS`);
3240 }3241 }
3241 catch (err) {3242 catch (err) {
3243 // in the case of a self-inflicted abort, we have already cleaned up
3244 if (!this.isFinished) {
3242 console.error(err);3245 console.error(err);
3243 this.onErrorStreaming();3246 this.onErrorStreaming();
3244 return;3247 }
3248 return this.result;
3245 }3249 }
32463250
3247 this.isFinished = true;3251 this.isFinished = true;
@@ -4641,7 +4645,6 @@ export function stopGeneration() {
4641 let stopped = false;4645 let stopped = false;
4642 if (streamingProcessor) {4646 if (streamingProcessor) {
4643 streamingProcessor.onStopStreaming();4647 streamingProcessor.onStopStreaming();
4644 streamingProcessor = null;
4645 stopped = true;4648 stopped = true;
4646 }4649 }
4647 if (abortController) {4650 if (abortController) {