mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Move reroll button
This commit is contained in:
@ -17,6 +17,7 @@ import { t } from './i18n.js';
|
||||
|
||||
const TINTS = 4;
|
||||
const MAX_MESSAGE_LOGPROBS = 100;
|
||||
const REROLL_BUTTON = $('#logprobsReroll');
|
||||
|
||||
/**
|
||||
* Tuple of a candidate token and its logarithm of probability of being chosen
|
||||
@ -93,14 +94,10 @@ function renderAlternativeTokensView() {
|
||||
|
||||
const prefix = continueFrom || '';
|
||||
const tokenSpans = [];
|
||||
REROLL_BUTTON.toggle(!!prefix);
|
||||
|
||||
if (prefix) {
|
||||
const rerollButton = $('<button id="logprobsReroll" class="menu_button">' +
|
||||
' <span class="fa-solid fa-redo logprobs_reroll"></span>' +
|
||||
'</button>');
|
||||
rerollButton.attr('title', t`Reroll with the entire prefix`);
|
||||
rerollButton.on('click', () => onPrefixClicked(prefix.length));
|
||||
tokenSpans.push(rerollButton);
|
||||
REROLL_BUTTON.off('click').on('click', () => onPrefixClicked(prefix.length));
|
||||
|
||||
let cumulativeOffset = 0;
|
||||
const words = prefix.split(/\s+/);
|
||||
@ -127,7 +124,6 @@ function renderAlternativeTokensView() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
messageLogprobs.forEach((tokenData, i) => {
|
||||
const { token } = tokenData;
|
||||
const span = $('<span></span>');
|
||||
@ -539,6 +535,7 @@ function convertTokenIdLogprobsToText(input) {
|
||||
}
|
||||
|
||||
export function initLogprobs() {
|
||||
REROLL_BUTTON.hide();
|
||||
const debouncedRender = debounce(renderAlternativeTokensView);
|
||||
$('#logprobsViewerClose').on('click', onToggleLogprobsPanel);
|
||||
$('#option_toggle_logprobs').on('click', onToggleLogprobsPanel);
|
||||
|
Reference in New Issue
Block a user