|
6214 | 6214 | if (promptPreviewChunks.length)
|
6215 | 6215 | setPromptPreviewChunks([]);
|
6216 | 6216 |
|
6217 |
| - if (fimPromptInfo !== undefined || cancel || !showPromptPreview || endpointAPI == API_AI_HORDE) |
| 6217 | + if (fimPromptInfo !== undefined || cancel || endpointAPI == API_AI_HORDE || tokenHighlightMode === -1 || !showPromptPreview) |
6218 | 6218 | return;
|
6219 | 6219 |
|
6220 | 6220 | const ac = new AbortController();
|
|
6859 | 6859 | case 'false:false:false:Escape':
|
6860 | 6860 | if (cancel) {
|
6861 | 6861 | cancel();
|
6862 |
| - } else if (promptPreviewText.length !== 0) { |
| 6862 | + } else if (showPromptPreview && promptPreviewChunks.length !== 0) { |
6863 | 6863 | setPromptPreviewReroll((r) => r + 1);
|
6864 | 6864 | }
|
6865 | 6865 | break;
|
6866 | 6866 | case 'false:false:false:Tab':
|
6867 |
| - if (promptPreviewText.length === 0) |
| 6867 | + if (!showPromptPreview || promptPreviewChunks.length === 0) |
6868 | 6868 | break;
|
6869 | 6869 |
|
6870 | 6870 | setPromptChunks(p => [
|
|
7351 | 7351 | data-promptchunk=${i}
|
7352 | 7352 | style=${bgColor ? { '--bg-color': bgColor } : {}}
|
7353 | 7353 | className=${`${(tokenHighlightMode === 1 && !isCurrent) || chunk.type === 'user' ? 'user' : 'machine'} ${isCurrent ? 'current' : ''} ${isNextUndo ? 'erase' : ''}`}>
|
7354 |
| - ${(chunk.content === '\n' ? ' \n' : chunk.content) + (i === promptChunks.length - 1 && chunk.content.endsWith('\n') && promptPreviewText?.length === 0 ? '\u00a0' : '')} |
| 7354 | + ${(chunk.content === '\n' ? ' \n' : chunk.content) + (i === promptChunks.length - 1 && chunk.content.endsWith('\n') && promptPreviewChunks.length === 0 ? '\u00a0' : '')} |
7355 | 7355 | </span>`;
|
7356 |
| - })}` : null} |
7357 |
| - ${(showPromptPreview && promptPreviewText?.length) ? html` |
| 7356 | + })} |
| 7357 | + ${(showPromptPreview && promptPreviewChunks.length) ? html` |
7358 | 7358 | <span ref=${promptPreviewElement} className="preview"></span>
|
7359 |
| - <span class="preview nudge">Tab</span>` : null} |
| 7359 | + <span class="preview nudge">Tab</span>` : null}` : null} |
7360 | 7360 | </div>
|
7361 | 7361 | <${SearchAndReplaceWidget}
|
7362 | 7362 | isOpen=${modalState.searchAndReplace}
|
|
7448 | 7448 | <${Checkbox} label="Token Streaming"
|
7449 | 7449 | disabled=${!!cancel} value=${useTokenStreaming} onValueChange=${setUseTokenStreaming}/>
|
7450 | 7450 | <${Checkbox} label="Prediction Preview"
|
7451 |
| - disabled=${!!cancel} value=${showPromptPreview} onValueChange=${setShowPromptPreview}/> |
| 7451 | + disabled=${!!cancel || tokenHighlightMode === -1} value=${showPromptPreview && tokenHighlightMode !== -1} onValueChange=${setShowPromptPreview}/> |
7452 | 7452 | ${showPromptPreview && html`
|
7453 | 7453 | <${InputBox} label="Max Preview Tokens" type="text" inputmode="numeric"
|
7454 | 7454 | readOnly=${!!cancel} value=${promptPreviewTokens} onValueChange=${setPromptPreviewTokens}/>`}`}
|
|
0 commit comments