Move reroll button
| @@ -80,12 +80,6 @@ | ||
| 80 | 80 | background-color: rgba(255, 0, 50, 0.4); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -#logprobsReroll { | |
| 84 | - float: right; /* Position the button to the right */ | |
| 85 | - margin: 5px 0 5px 10px; /* Add spacing (top, right, bottom, left) */ | |
| 86 | - clear: right; /* Ensure it starts on a new line */ | |
| 87 | -} | |
| 88 | - | |
| 89 | 83 | .logprobs_candidate_list { |
| 90 | 84 | grid-row-start: 3; |
| 91 | 85 | grid-row-end: 4; |
| @@ -6631,8 +6631,11 @@ | ||
| 6631 | 6631 | </div> |
| 6632 | 6632 | </div> |
| 6633 | 6633 | <div class="logprobs_panel_content inline-drawer-content flex-container flexFlowColumn"> |
| 6634 | - <small> | |
| 6634 | + <small class="flex-container alignItemsCenter justifySpaceBetween"> | |
| 6635 | 6635 | <b data-i18n="Select a token to see alternatives considered by the AI.">Select a token to see alternatives considered by the AI.</b> |
| 6636 | + <button id="logprobsReroll" class="menu_button" title="Reroll with the entire prefix" data-i18n="[title]Reroll with the entire prefix"> | |
| 6637 | + <span class="fa-solid fa-redo logprobs_reroll"></span> | |
| 6638 | + </button> | |
| 6636 | 6639 | </small> |
| 6637 | 6640 | <hr> |
| 6638 | 6641 | <div id="logprobs_generation_output"></div> |
| @@ -17,6 +17,7 @@ import { t } from './i18n.js'; | ||
| 17 | 17 | |
| 18 | 18 | const TINTS = 4; |
| 19 | 19 | const MAX_MESSAGE_LOGPROBS = 100; |
| 20 | +const REROLL_BUTTON = $('#logprobsReroll'); | |
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Tuple of a candidate token and its logarithm of probability of being chosen |
| @@ -93,14 +94,10 @@ function renderAlternativeTokensView() { | ||
| 93 | 94 | |
| 94 | 95 | const prefix = continueFrom || ''; |
| 95 | 96 | const tokenSpans = []; |
| 97 | + REROLL_BUTTON.toggle(!!prefix); | |
| 96 | 98 | |
| 97 | 99 | if (prefix) { |
| 98 | - const rerollButton = $('<button id="logprobsReroll" class="menu_button">' + | |
| 100 | + REROLL_BUTTON.off('click').on('click', () => onPrefixClicked(prefix.length)); | |
| 99 | - ' <span class="fa-solid fa-redo logprobs_reroll"></span>' + | |
| 100 | - '</button>'); | |
| 101 | - rerollButton.attr('title', t`Reroll with the entire prefix`); | |
| 102 | - rerollButton.on('click', () => onPrefixClicked(prefix.length)); | |
| 103 | - tokenSpans.push(rerollButton); | |
| 104 | 101 | |
| 105 | 102 | let cumulativeOffset = 0; |
| 106 | 103 | const words = prefix.split(/\s+/); |
| @@ -127,7 +124,6 @@ function renderAlternativeTokensView() { | ||
| 127 | 124 | }); |
| 128 | 125 | } |
| 129 | 126 | |
| 130 | - | |
| 131 | 127 | messageLogprobs.forEach((tokenData, i) => { |
| 132 | 128 | const { token } = tokenData; |
| 133 | 129 | const span = $('<span></span>'); |
| @@ -539,6 +535,7 @@ function convertTokenIdLogprobsToText(input) { | ||
| 539 | 535 | } |
| 540 | 536 | |
| 541 | 537 | export function initLogprobs() { |
| 538 | + REROLL_BUTTON.hide(); | |
| 542 | 539 | const debouncedRender = debounce(renderAlternativeTokensView); |
| 543 | 540 | $('#logprobsViewerClose').on('click', onToggleLogprobsPanel); |
| 544 | 541 | $('#option_toggle_logprobs').on('click', onToggleLogprobsPanel); |