diff --git a/public/css/logprobs.css b/public/css/logprobs.css index f9b5e6b42..71b319539 100644 --- a/public/css/logprobs.css +++ b/public/css/logprobs.css @@ -80,12 +80,6 @@ background-color: rgba(255, 0, 50, 0.4); } -#logprobsReroll { - float: right; /* Position the button to the right */ - margin: 5px 0 5px 10px; /* Add spacing (top, right, bottom, left) */ - clear: right; /* Ensure it starts on a new line */ -} - .logprobs_candidate_list { grid-row-start: 3; grid-row-end: 4; diff --git a/public/index.html b/public/index.html index 7c130227b..d7483b3e0 100644 --- a/public/index.html +++ b/public/index.html @@ -6631,8 +6631,11 @@
- + Select a token to see alternatives considered by the AI. +
diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index 49007a9bf..e8bafa56c 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -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 = $(''); - 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 = $(''); @@ -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);