initial reversion commit
| @@ -3089,14 +3089,14 @@ | ||
| 3089 | 3089 | <small data-i18n="Story String">Story String</small> |
| 3090 | 3090 | <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="context_story_string" title="Expand the editor" data-i18n="[title]Expand the editor"></i> |
| 3091 | 3091 | </label> |
| 3092 | 3092 | <div contenteditable="true"textarea id="context_story_string" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3093 | 3093 | <div class="flex-container"> |
| 3094 | 3094 | <div class="flex1"> |
| 3095 | 3095 | <label for="context_example_separator"> |
| 3096 | 3096 | <small data-i18n="Example Separator">Example Separator</small> |
| 3097 | 3097 | </label> |
| 3098 | 3098 | <div> |
| 3099 | 3099 | <div contenteditable="true"textarea id="context_example_separator" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3100 | 3100 | </div> |
| 3101 | 3101 | </div> |
| 3102 | 3102 | <div class="flex1"> |
| @@ -3104,7 +3104,7 @@ | ||
| 3104 | 3104 | <small data-i18n="Chat Start">Chat Start</small> |
| 3105 | 3105 | </label> |
| 3106 | 3106 | <div> |
| 3107 | 3107 | <div contenteditable="true"textarea id="context_chat_start" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3108 | 3108 | </div> |
| 3109 | 3109 | </div> |
| 3110 | 3110 | </div> |
| @@ -3182,7 +3182,7 @@ | ||
| 3182 | 3182 | </small> |
| 3183 | 3183 | </div> |
| 3184 | 3184 | <div> |
| 3185 | 3185 | <div contenteditable="true"textarea id="custom_stopping_strings" class="text_pole textarea_compact monospace autoSetHeight"></divtextarea> |
| 3186 | 3186 | </div> |
| 3187 | 3187 | <label class="checkbox_label" for="custom_stopping_strings_macro"> |
| 3188 | 3188 | <input id="custom_stopping_strings_macro" type="checkbox" checked> |
| @@ -3241,7 +3241,7 @@ | ||
| 3241 | 3241 | <small data-i18n="System Prompt">System Prompt</small> |
| 3242 | 3242 | <i class="editor_maximize fa-solid fa-maximize right_menu_button" data-for="instruct_system_prompt" title="Expand the editor" data-i18n="[title]Expand the editor"></i> |
| 3243 | 3243 | </label> |
| 3244 | 3244 | <div contenteditable="true"textarea id="instruct_system_prompt" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3245 | 3245 | </div> |
| 3246 | 3246 | |
| 3247 | 3247 | <div> |
| @@ -3323,7 +3323,7 @@ | ||
| 3323 | 3323 | </span> |
| 3324 | 3324 | </small> |
| 3325 | 3325 | <div> |
| 3326 | 3326 | <div contenteditable="true"textarea id="start_reply_with" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3327 | 3327 | </div> |
| 3328 | 3328 | <label class="checkbox_label" for="chat-show-reply-prefix-checkbox"> |
| 3329 | 3329 | <input id="chat-show-reply-prefix-checkbox" type="checkbox" /> |
| @@ -3353,7 +3353,7 @@ | ||
| 3353 | 3353 | <small data-i18n="System Prompt Prefix">System Prompt Prefix</small> |
| 3354 | 3354 | </label> |
| 3355 | 3355 | <div> |
| 3356 | 3356 | <div contenteditable="true"textarea id="instruct_system_sequence_prefix" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3357 | 3357 | </div> |
| 3358 | 3358 | </div> |
| 3359 | 3359 | <div class="flexAuto" title="Inserted after a System prompt." data-i18n="[title]Inserted after a System prompt."> |
| @@ -3361,38 +3361,38 @@ | ||
| 3361 | 3361 | <small data-i18n="System Prompt Suffix">System Prompt Suffix</small> |
| 3362 | 3362 | </label> |
| 3363 | 3363 | <div> |
| 3364 | 3364 | <div contenteditable="true"textarea id="instruct_system_sequence_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></divtextarea> |
| 3365 | 3365 | </div> |
| 3366 | 3366 | </div> |
| 3367 | 3367 | </div> |
| 3368 | 3368 | <div class="flex-container"> |
| 3369 | 3369 | <div class="flexAuto" title="Inserted before a User message and as a last prompt line when impersonating." data-i18n="[title]Inserted before a User message and as a last prompt line when impersonating."> |
| 3370 | 3370 | <small data-i18n="User Prefix">User Message Prefix</small> |
| 3371 | 3371 | <div contenteditable="true"textarea id="instruct_input_sequence" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3372 | 3372 | </div> |
| 3373 | 3373 | <div class="flexAuto" title="Inserted after a User message." data-i18n="[title]Inserted after a User message."> |
| 3374 | 3374 | <small data-i18n="User Suffix">User Message Suffix</small> |
| 3375 | 3375 | <div contenteditable="true"textarea id="instruct_input_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></divtextarea> |
| 3376 | 3376 | </div> |
| 3377 | 3377 | </div> |
| 3378 | 3378 | <div class="flex-container"> |
| 3379 | 3379 | <div class="flexAuto" title="Inserted before an Assistant message and as a last prompt line when generating an AI reply." data-i18n="[title]Inserted before an Assistant message and as a last prompt line when generating an AI reply."> |
| 3380 | 3380 | <small data-i18n="Assistant Prefix">Assistant Message Prefix</small> |
| 3381 | 3381 | <div contenteditable="true"textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></divtextarea> |
| 3382 | 3382 | </div> |
| 3383 | 3383 | <div class="flexAuto" title="Inserted after an Assistant message." data-i18n="[title]Inserted after an Assistant message."> |
| 3384 | 3384 | <small data-i18n="Assistant Suffix">Assistant Message Suffix</small> |
| 3385 | 3385 | <div contenteditable="true"textarea id="instruct_output_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></divtextarea> |
| 3386 | 3386 | </div> |
| 3387 | 3387 | </div> |
| 3388 | 3388 | <div class="flex-container"> |
| 3389 | 3389 | <div class="flexAuto" id="instruct_system_sequence_block" title="Inserted before a System (added by slash commands or extensions) message." data-i18n="[title]Inserted before a System (added by slash commands or extensions) message."> |
| 3390 | 3390 | <small data-i18n="System Prefix">System Message Prefix</small> |
| 3391 | 3391 | <div contenteditable="true"textarea id="instruct_system_sequence" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3392 | 3392 | </div> |
| 3393 | 3393 | <div class="flexAuto" id="instruct_system_suffix_block" title="Inserted after a System message." data-i18n="[title]Inserted after a System message."> |
| 3394 | 3394 | <small data-i18n="System Suffix">System Message Suffix</small> |
| 3395 | 3395 | <div contenteditable="true"textarea id="instruct_system_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></divtextarea> |
| 3396 | 3396 | </div> |
| 3397 | 3397 | </div> |
| 3398 | 3398 | <div class="flexBasis100p" title="If enabled, System Sequences will be the same as User Sequences." data-i18n="[title]If enabled, System Sequences will be the same as User Sequences."> |
| @@ -3408,37 +3408,37 @@ | ||
| 3408 | 3408 | <div class="flex-container"> |
| 3409 | 3409 | <div class="flexAuto" title="Inserted before the first Assistant's message." data-i18n="[title]Inserted before the first Assistant's message."> |
| 3410 | 3410 | <small data-i18n="First Assistant Prefix">First Assistant Prefix</small> |
| 3411 | 3411 | <div contenteditable="true"textarea id="instruct_first_output_sequence" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3412 | 3412 | </div> |
| 3413 | 3413 | <div class="flexAuto" title="Inserted before the last Assistant's message or as a last prompt line when generating an AI reply (except a neutral/system role)." data-i18n="[title]instruct_last_output_sequence"> |
| 3414 | 3414 | <small data-i18n="Last Assistant Prefix">Last Assistant Prefix</small> |
| 3415 | 3415 | <div contenteditable="true"textarea id="instruct_last_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></divtextarea> |
| 3416 | 3416 | </div> |
| 3417 | 3417 | </div> |
| 3418 | 3418 | <div class="flex-container"> |
| 3419 | 3419 | <div class="flexAuto" title="Inserted before the first User's message." data-i18n="[title]Inserted before the first User's message."> |
| 3420 | 3420 | <small data-i18n="First User Prefix">First User Prefix</small> |
| 3421 | 3421 | <div contenteditable="true"textarea id="instruct_first_input_sequence" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3422 | 3422 | </div> |
| 3423 | 3423 | <div class="flexAuto" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence"> |
| 3424 | 3424 | <small data-i18n="Last User Prefix">Last User Prefix</small> |
| 3425 | 3425 | <div contenteditable="true"textarea id="instruct_last_input_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></divtextarea> |
| 3426 | 3426 | </div> |
| 3427 | 3427 | </div> |
| 3428 | 3428 | <div class="flex-container"> |
| 3429 | 3429 | <div class="flexAuto" title="Will be inserted as a last prompt line when using system/neutral generation." data-i18n="[title]Will be inserted as a last prompt line when using system/neutral generation."> |
| 3430 | 3430 | <small data-i18n="System Instruction Prefix">System Instruction Prefix</small> |
| 3431 | 3431 | <div contenteditable="true"textarea id="instruct_last_system_sequence" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3432 | 3432 | </div> |
| 3433 | 3433 | <div class="flexAuto" title="If a stop sequence is generated, everything past it will be removed from the output (inclusive)." data-i18n="[title]If a stop sequence is generated, everything past it will be removed from the output (inclusive)."> |
| 3434 | 3434 | <small data-i18n="Stop Sequence">Stop Sequence</small> |
| 3435 | 3435 | <div contenteditable="true"textarea id="instruct_stop_sequence" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3436 | 3436 | </div> |
| 3437 | 3437 | </div> |
| 3438 | 3438 | <div class="flex-container"> |
| 3439 | 3439 | <div class="flexAuto" title="Will be inserted at the start of the chat history if it doesn't start with a User message." data-i18n="[title]Will be inserted at the start of the chat history if it doesn't start with a User message."> |
| 3440 | 3440 | <small data-i18n="User Filler Message">User Filler Message</small> |
| 3441 | 3441 | <div contenteditable="true"textarea id="instruct_user_alignment_message" class="text_pole textarea_compact autoSetHeight"></divtextarea> |
| 3442 | 3442 | </div> |
| 3443 | 3443 | </div> |
| 3444 | 3444 | </div> |
| @@ -10577,6 +10577,9 @@ jQuery(async function () { | ||
| 10577 | 10577 | stopScriptExecution(); |
| 10578 | 10578 | }); |
| 10579 | 10579 | |
| 10580 | + const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 10581 | + const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 10582 | + | |
| 10580 | 10583 | $('.drawer-toggle').on('click', function () { |
| 10581 | 10584 | var icon = $(this).find('.drawer-icon'); |
| 10582 | 10585 | var drawer = $(this).parent().find('.drawer-content'); |
| @@ -10616,10 +10619,13 @@ jQuery(async function () { | ||
| 10616 | 10619 | } |
| 10617 | 10620 | |
| 10618 | 10621 | // Set the height of "autoSetHeight" textareas within the drawer to their scroll height |
| 10622 | + | |
| 10623 | + if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 10619 | 10624 | $(this).closest('.drawer').find('.drawer-content textarea.autoSetHeight').each(async function () { |
| 10620 | 10625 | await resetScrollHeight($(this)); |
| 10621 | 10626 | return; |
| 10622 | 10627 | }); |
| 10628 | + } | |
| 10623 | 10629 | |
| 10624 | 10630 | } else if (drawerWasOpenAlready) { //to close manually |
| 10625 | 10631 | icon.toggleClass('closedIcon openIcon'); |
| @@ -10691,10 +10697,12 @@ jQuery(async function () { | ||
| 10691 | 10697 | $(this).closest('.inline-drawer').find('.inline-drawer-content').stop().slideToggle(); |
| 10692 | 10698 | |
| 10693 | 10699 | // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height |
| 10700 | + if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 10694 | 10701 | $(this).closest('.inline-drawer').find('.inline-drawer-content textarea.autoSetHeight').each(async function () { |
| 10695 | 10702 | await resetScrollHeight($(this)); |
| 10696 | 10703 | return; |
| 10697 | 10704 | }); |
| 10705 | + } | |
| 10698 | 10706 | }); |
| 10699 | 10707 | |
| 10700 | 10708 | $(document).on('click', '.inline-drawer-maximize', function () { |
| @@ -7,7 +7,7 @@ import { | ||
| 7 | 7 | power_user, |
| 8 | 8 | context_presets, |
| 9 | 9 | } from './power-user.js'; |
| 10 | 10 | import { regexFromString, resetScrollHeight } from './utils.js'; |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @type {any[]} Instruct mode presets. |
| @@ -42,6 +42,9 @@ const controls = [ | ||
| 42 | 42 | { id: 'instruct_system_same_as_user', property: 'system_same_as_user', isCheckbox: true, trigger: true }, |
| 43 | 43 | ]; |
| 44 | 44 | |
| 45 | +const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 46 | +const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 47 | + | |
| 45 | 48 | /** |
| 46 | 49 | * Migrates instruct mode settings into the evergreen format. |
| 47 | 50 | * @param {object} settings Instruct mode settings. |
| @@ -95,11 +98,14 @@ export async function loadInstructMode(data) { | ||
| 95 | 98 | if (control.isCheckbox) { |
| 96 | 99 | $element.prop('checked', power_user.instruct[control.property]); |
| 97 | 100 | } else { |
| 98 | 101 | $element[0].innerText = val(power_user.instruct[control.property]); |
| 99 | 102 | } |
| 100 | 103 | |
| 101 | 104 | $element.on('input', async function () { |
| 102 | 105 | power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].innerTextval; |
| 106 | + if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 107 | + await resetScrollHeight($(this)); | |
| 108 | + } | |
| 103 | 109 | saveSettingsDebounced(); |
| 104 | 110 | }); |
| 105 | 111 | |
| @@ -663,7 +669,7 @@ jQuery(() => { | ||
| 663 | 669 | if (control.isCheckbox) { |
| 664 | 670 | $element.prop('checked', power_user.instruct[control.property]).trigger('input'); |
| 665 | 671 | } else { |
| 666 | 672 | $element[0].innerText = val(power_user.instruct[control.property]); |
| 667 | 673 | $element.trigger('input'); |
| 668 | 674 | } |
| 669 | 675 | } |
| @@ -105,6 +105,9 @@ export const persona_description_positions = { | ||
| 105 | 105 | NONE: 9, |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | +const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 109 | +const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 110 | + | |
| 108 | 111 | let power_user = { |
| 109 | 112 | tokenizer: tokenizers.BEST_MATCH, |
| 110 | 113 | token_padding: 64, |
| @@ -1740,20 +1743,23 @@ async function loadContextSettings() { | ||
| 1740 | 1743 | if (control.isCheckbox) { |
| 1741 | 1744 | $element.prop('checked', power_user.context[control.property]); |
| 1742 | 1745 | } else { |
| 1743 | 1746 | $element[0].innerText = val(power_user.context[control.property]); |
| 1744 | 1747 | } |
| 1745 | 1748 | console.log(`Setting ${$element.prop('id')} to ${power_user.context[control.property]}`); |
| 1746 | 1749 | |
| 1747 | 1750 | // If the setting already exists, no need to duplicate it |
| 1748 | 1751 | // TODO: Maybe check the power_user object for the setting instead of a flag? |
| 1749 | 1752 | $element.on('input keyup', async function () { |
| 1750 | 1753 | const value = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].innerTextval(); |
| 1751 | 1754 | if (control.isGlobalSetting) { |
| 1752 | 1755 | power_user[control.property] = value; |
| 1753 | 1756 | } else { |
| 1754 | 1757 | power_user.context[control.property] = value; |
| 1755 | 1758 | } |
| 1756 | - | |
| 1759 | + console.log(`Setting ${$element.prop('id')} to ${value}`); | |
| 1760 | + if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 1761 | + await resetScrollHeight($(this)); | |
| 1762 | + } | |
| 1757 | 1763 | saveSettingsDebounced(); |
| 1758 | 1764 | }); |
| 1759 | 1765 | }); |
| @@ -1793,7 +1799,7 @@ async function loadContextSettings() { | ||
| 1793 | 1799 | .prop('checked', control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property]) |
| 1794 | 1800 | .trigger('input'); |
| 1795 | 1801 | } else { |
| 1796 | 1802 | $element[0].innerText = val(control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property]); |
| 1797 | 1803 | $element.trigger('input'); |
| 1798 | 1804 | } |
| 1799 | 1805 | } |
| @@ -3096,7 +3102,7 @@ $(document).ready(() => { | ||
| 3096 | 3102 | }); |
| 3097 | 3103 | |
| 3098 | 3104 | $('#start_reply_with').on('input', function () { |
| 3099 | 3105 | power_user.user_prompt_bias = String($(this)[0].innerTextval); |
| 3100 | 3106 | saveSettingsDebounced(); |
| 3101 | 3107 | }); |
| 3102 | 3108 | |
| @@ -3628,7 +3634,7 @@ $(document).ready(() => { | ||
| 3628 | 3634 | }); |
| 3629 | 3635 | |
| 3630 | 3636 | $('#custom_stopping_strings').on('input', function () { |
| 3631 | 3637 | power_user.custom_stopping_strings = String($(this)[0].innerTextval).trim(); |
| 3632 | 3638 | saveSettingsDebounced(); |
| 3633 | 3639 | }); |
| 3634 | 3640 | |
| @@ -2027,9 +2027,14 @@ export function toggleDrawer(drawer, expand = true) { | ||
| 2027 | 2027 | content.style.display = 'none'; |
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | + const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/'); | |
| 2031 | + const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx)); | |
| 2032 | + | |
| 2030 | 2033 | // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height |
| 2034 | + if (chromeUaIdx == -1 || Number(chromeVersion) < 123) { | |
| 2031 | 2035 | content.querySelectorAll('textarea.autoSetHeight').forEach(resetScrollHeight); |
| 2032 | 2036 | } |
| 2037 | +} | |
| 2033 | 2038 | |
| 2034 | 2039 | export async function fetchFaFile(name) { |
| 2035 | 2040 | const style = document.createElement('style'); |
| @@ -1176,6 +1176,7 @@ textarea { | ||
| 1176 | 1176 | textarea.autoSetHeight { |
| 1177 | 1177 | max-height: 50vh; |
| 1178 | 1178 | max-height: 50dvh; |
| 1179 | + field-sizing: content; | |
| 1179 | 1180 | } |
| 1180 | 1181 | |
| 1181 | 1182 | input, |