Don't show logprobs when using smooth streaming

This commit is contained in:
Cohee 2024-04-02 15:51:00 +03:00
parent 8176e09d4a
commit 7389286862
2 changed files with 10 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import {
Generate, Generate,
getGeneratingApi, getGeneratingApi,
is_send_press, is_send_press,
isStreamingEnabled,
} from '../script.js'; } from '../script.js';
import { debounce, delay, getStringHash } from './utils.js'; import { debounce, delay, getStringHash } from './utils.js';
import { decodeTextTokens, getTokenizerBestMatch } from './tokenizers.js'; import { decodeTextTokens, getTokenizerBestMatch } from './tokenizers.js';
@ -64,11 +65,15 @@ function renderAlternativeTokensView() {
renderTopLogprobs(); renderTopLogprobs();
const { messageLogprobs, continueFrom } = getActiveMessageLogprobData() || {}; const { messageLogprobs, continueFrom } = getActiveMessageLogprobData() || {};
if (!messageLogprobs?.length) { const usingSmoothStreaming = isStreamingEnabled() && power_user.smooth_streaming;
if (!messageLogprobs?.length || usingSmoothStreaming) {
const emptyState = $('<div></div>'); const emptyState = $('<div></div>');
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 const msg = power_user.request_token_probabilities
? 'No token probabilities available for the current message.' ? noTokensMsg
: `<span>Enable <b>Request token probabilities</b> in the User Settings menu to use this feature.</span>`; : '<span>Enable <b>Request token probabilities</b> in the User Settings menu to use this feature.</span>';
emptyState.html(msg); emptyState.html(msg);
emptyState.addClass('logprobs_empty_state'); emptyState.addClass('logprobs_empty_state');
view.append(emptyState); view.append(emptyState);

View File

@ -90,11 +90,11 @@ function getDelay(s) {
return 0; return 0;
} }
if (s == ',') { if ([',', '\n'].includes(s)) {
return punctuationDelayMs / 2; return punctuationDelayMs / 2;
} }
if (['.', '!', '?', '\n'].includes(s)) { if (['.', '!', '?'].includes(s)) {
return punctuationDelayMs; return punctuationDelayMs;
} }