diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index 2aef6e61b..b2e682286 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -8,6 +8,7 @@ import { Generate, getGeneratingApi, is_send_press, + isStreamingEnabled, } from '../script.js'; import { debounce, delay, getStringHash } from './utils.js'; import { decodeTextTokens, getTokenizerBestMatch } from './tokenizers.js'; @@ -64,11 +65,15 @@ function renderAlternativeTokensView() { renderTopLogprobs(); const { messageLogprobs, continueFrom } = getActiveMessageLogprobData() || {}; - if (!messageLogprobs?.length) { + const usingSmoothStreaming = isStreamingEnabled() && power_user.smooth_streaming; + if (!messageLogprobs?.length || usingSmoothStreaming) { const emptyState = $('
'); + const noTokensMsg = usingSmoothStreaming + ? 'Token probabilities are not available when using Smooth Streaming.' + : 'No token probabilities available for the current message.'; const msg = power_user.request_token_probabilities - ? 'No token probabilities available for the current message.' - : `Enable Request token probabilities in the User Settings menu to use this feature.`; + ? noTokensMsg + : 'Enable Request token probabilities in the User Settings menu to use this feature.'; emptyState.html(msg); emptyState.addClass('logprobs_empty_state'); view.append(emptyState); diff --git a/public/scripts/sse-stream.js b/public/scripts/sse-stream.js index 7cc8e15e9..0cce6b1e2 100644 --- a/public/scripts/sse-stream.js +++ b/public/scripts/sse-stream.js @@ -90,11 +90,11 @@ function getDelay(s) { return 0; } - if (s == ',') { + if ([',', '\n'].includes(s)) { return punctuationDelayMs / 2; } - if (['.', '!', '?', '\n'].includes(s)) { + if (['.', '!', '?'].includes(s)) { return punctuationDelayMs; }