initial commit: AF panel textareas >> contentEditable divs
| @@ -3061,14 +3061,14 @@ | ||
| 3061 | 3061 | <label for="context_story_string"> |
| 3062 | 3062 | <small data-i18n="Story String">Story String</small> |
| 3063 | 3063 | </label> |
| 3064 | 3064 | <textareadiv contenteditable="true" id="context_story_string" class="text_pole textarea_compact autoSetHeight" rows="1"></textareadiv> |
| 3065 | 3065 | <div class="flex-container"> |
| 3066 | 3066 | <div class="flex1"> |
| 3067 | 3067 | <label for="context_example_separator"> |
| 3068 | 3068 | <small data-i18n="Example Separator">Example Separator</small> |
| 3069 | 3069 | </label> |
| 3070 | 3070 | <div> |
| 3071 | 3071 | <textareadiv contenteditable="true" id="context_example_separator" class="text_pole textarea_compact autoSetHeight" maxlength="500" rows="1"></textareadiv> |
| 3072 | 3072 | </div> |
| 3073 | 3073 | </div> |
| 3074 | 3074 | <div class="flex1"> |
| @@ -3076,7 +3076,7 @@ | ||
| 3076 | 3076 | <small data-i18n="Chat Start">Chat Start</small> |
| 3077 | 3077 | </label> |
| 3078 | 3078 | <div> |
| 3079 | 3079 | <textareadiv contenteditable="true" id="context_chat_start" class="text_pole textarea_compact autoSetHeight" maxlength="500" rows="1"></textareadiv> |
| 3080 | 3080 | </div> |
| 3081 | 3081 | </div> |
| 3082 | 3082 | </div> |
| @@ -3172,7 +3172,7 @@ | ||
| 3172 | 3172 | </small> |
| 3173 | 3173 | </label> |
| 3174 | 3174 | <div data-newbie-hidden> |
| 3175 | 3175 | <textareadiv contenteditable="true" id="instruct_activation_regex" class="text_pole textarea_compact autoSetHeight" maxlength="5000" rows="1"></textareadiv> |
| 3176 | 3176 | </div> |
| 3177 | 3177 | <div data-newbie-hidden> |
| 3178 | 3178 | <label for="instruct_wrap" class="checkbox_label"> |
| @@ -3200,7 +3200,7 @@ | ||
| 3200 | 3200 | <label> |
| 3201 | 3201 | <small data-i18n="System Prompt">System Prompt</small> |
| 3202 | 3202 | </label> |
| 3203 | 3203 | <textareadiv contenteditable="true" id="instruct_system_prompt" class="text_pole textarea_compact autoSetHeight" rows="1"></textareadiv> |
| 3204 | 3204 | </div> |
| 3205 | 3205 | <div data-newbie-hidden class="inline-drawer wide100p flexFlowColumn"> |
| 3206 | 3206 | <div class="inline-drawer-toggle inline-drawer-header"> |
| @@ -3217,7 +3217,7 @@ | ||
| 3217 | 3217 | <small data-i18n="System Prompt Prefix">System Prompt Prefix</small> |
| 3218 | 3218 | </label> |
| 3219 | 3219 | <div> |
| 3220 | 3220 | <textareadiv contenteditable="true" id="instruct_system_sequence_prefix" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3221 | 3221 | </div> |
| 3222 | 3222 | </div> |
| 3223 | 3223 | <div class="flex1" title="Inserted after a System prompt." data-i18n="[title]Inserted after a System prompt."> |
| @@ -3225,7 +3225,7 @@ | ||
| 3225 | 3225 | <small data-i18n="System Prompt Suffix">System Prompt Suffix</small> |
| 3226 | 3226 | </label> |
| 3227 | 3227 | <div> |
| 3228 | 3228 | <textareadiv contenteditable="true" id="instruct_system_sequence_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3229 | 3229 | </div> |
| 3230 | 3230 | </div> |
| 3231 | 3231 | </div> |
| @@ -3238,7 +3238,7 @@ | ||
| 3238 | 3238 | <small data-i18n="User Message Prefix">User Message Prefix</small> |
| 3239 | 3239 | </label> |
| 3240 | 3240 | <div> |
| 3241 | 3241 | <textareadiv contenteditable="true" id="instruct_input_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3242 | 3242 | </div> |
| 3243 | 3243 | </div> |
| 3244 | 3244 | <div class="flex1" title="Inserted after a User message." data-i18n="[title]Inserted after a User message."> |
| @@ -3246,7 +3246,7 @@ | ||
| 3246 | 3246 | <small data-i18n="User Message Suffix">User Message Suffix</small> |
| 3247 | 3247 | </label> |
| 3248 | 3248 | <div> |
| 3249 | 3249 | <textareadiv contenteditable="true" id="instruct_input_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3250 | 3250 | </div> |
| 3251 | 3251 | </div> |
| 3252 | 3252 | </div> |
| @@ -3256,7 +3256,7 @@ | ||
| 3256 | 3256 | <small data-i18n="Assistant Message Prefix">Assistant Message Prefix</small> |
| 3257 | 3257 | </label> |
| 3258 | 3258 | <div> |
| 3259 | 3259 | <textareadiv contenteditable="true" id="instruct_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3260 | 3260 | </div> |
| 3261 | 3261 | </div> |
| 3262 | 3262 | <div class="flex1" title="Inserted after an Assistant message." data-i18n="[title]Inserted after an Assistant message."> |
| @@ -3264,7 +3264,7 @@ | ||
| 3264 | 3264 | <small data-i18n="Assistant Message Suffix">Assistant Message Suffix</small> |
| 3265 | 3265 | </label> |
| 3266 | 3266 | <div> |
| 3267 | 3267 | <textareadiv contenteditable="true" id="instruct_output_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3268 | 3268 | </div> |
| 3269 | 3269 | </div> |
| 3270 | 3270 | </div> |
| @@ -3274,7 +3274,7 @@ | ||
| 3274 | 3274 | <small data-i18n="System Message Prefix">System Message Prefix</small> |
| 3275 | 3275 | </label> |
| 3276 | 3276 | <div> |
| 3277 | 3277 | <textareadiv contenteditable="true" id="instruct_system_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3278 | 3278 | </div> |
| 3279 | 3279 | </div> |
| 3280 | 3280 | <div class="flex1" title="Inserted after a System message." data-i18n="[title]Inserted after a System message."> |
| @@ -3282,7 +3282,7 @@ | ||
| 3282 | 3282 | <small data-i18n="System Message Suffix">System Message Suffix</small> |
| 3283 | 3283 | </label> |
| 3284 | 3284 | <div> |
| 3285 | 3285 | <textareadiv contenteditable="true" id="instruct_system_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3286 | 3286 | </div> |
| 3287 | 3287 | </div> |
| 3288 | 3288 | <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."> |
| @@ -3301,7 +3301,7 @@ | ||
| 3301 | 3301 | <small data-i18n="First Assistant Prefix">First Assistant Prefix</small> |
| 3302 | 3302 | </label> |
| 3303 | 3303 | <div> |
| 3304 | 3304 | <textareadiv contenteditable="true" id="instruct_first_output_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3305 | 3305 | </div> |
| 3306 | 3306 | </div> |
| 3307 | 3307 | <div class="flex1" 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"> |
| @@ -3309,7 +3309,7 @@ | ||
| 3309 | 3309 | <small data-i18n="Last Assistant Prefix">Last Assistant Prefix</small> |
| 3310 | 3310 | </label> |
| 3311 | 3311 | <div> |
| 3312 | 3312 | <textareadiv contenteditable="true" id="instruct_last_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3313 | 3313 | </div> |
| 3314 | 3314 | </div> |
| 3315 | 3315 | </div> |
| @@ -3319,7 +3319,7 @@ | ||
| 3319 | 3319 | <small data-i18n="First User Prefix">First User Prefix</small> |
| 3320 | 3320 | </label> |
| 3321 | 3321 | <div> |
| 3322 | 3322 | <textareadiv contenteditable="true" id="instruct_first_input_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3323 | 3323 | </div> |
| 3324 | 3324 | </div> |
| 3325 | 3325 | <div class="flex1" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence"> |
| @@ -3327,7 +3327,7 @@ | ||
| 3327 | 3327 | <small data-i18n="Last User Prefix">Last User Prefix</small> |
| 3328 | 3328 | </label> |
| 3329 | 3329 | <div> |
| 3330 | 3330 | <textareadiv contenteditable="true" id="instruct_last_input_sequence" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3331 | 3331 | </div> |
| 3332 | 3332 | </div> |
| 3333 | 3333 | </div> |
| @@ -3337,7 +3337,7 @@ | ||
| 3337 | 3337 | <small data-i18n="System Instruction Prefix">System Instruction Prefix</small> |
| 3338 | 3338 | </label> |
| 3339 | 3339 | <div> |
| 3340 | 3340 | <textareadiv contenteditable="true" id="instruct_last_system_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3341 | 3341 | </div> |
| 3342 | 3342 | </div> |
| 3343 | 3343 | <div class="flex1" 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)."> |
| @@ -3345,7 +3345,7 @@ | ||
| 3345 | 3345 | <small data-i18n="Stop Sequence">Stop Sequence</small> |
| 3346 | 3346 | </label> |
| 3347 | 3347 | <div> |
| 3348 | 3348 | <textareadiv contenteditable="true" id="instruct_stop_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3349 | 3349 | </div> |
| 3350 | 3350 | </div> |
| 3351 | 3351 | </div> |
| @@ -3355,7 +3355,7 @@ | ||
| 3355 | 3355 | <small data-i18n="User Filler Message">User Filler Message</small> |
| 3356 | 3356 | </label> |
| 3357 | 3357 | <div> |
| 3358 | 3358 | <textareadiv contenteditable="true" id="instruct_user_alignment_message" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="—" rows="1"></textareadiv> |
| 3359 | 3359 | </div> |
| 3360 | 3360 | </div> |
| 3361 | 3361 | </div> |
| @@ -3448,7 +3448,7 @@ | ||
| 3448 | 3448 | </span> |
| 3449 | 3449 | </h4> |
| 3450 | 3450 | <div> |
| 3451 | 3451 | <textareadiv contenteditable="true" id="start_reply_with" rows="2" class="text_pole textarea_compact" data-i18n="[placeholder]AI reply prefix" placeholder="AI reply prefix"></textareadiv> |
| 3452 | 3452 | </div> |
| 3453 | 3453 | <label class="checkbox_label" for="chat-show-reply-prefix-checkbox"> |
| 3454 | 3454 | <input id="chat-show-reply-prefix-checkbox" type="checkbox" /> |
| @@ -3482,7 +3482,7 @@ | ||
| 3482 | 3482 | </small> |
| 3483 | 3483 | </div> |
| 3484 | 3484 | <div> |
| 3485 | 3485 | <textareadiv contenteditable="true" id="custom_stopping_strings" rows="2" class="text_pole textarea_compact monospace" placeholder="["Ford", "BMW", "Fiat"]"></textareadiv> |
| 3486 | 3486 | </div> |
| 3487 | 3487 | <label class="checkbox_label" for="custom_stopping_strings_macro"> |
| 3488 | 3488 | <input id="custom_stopping_strings_macro" type="checkbox" checked> |
| @@ -91,15 +91,17 @@ export function loadInstructMode(data) { | ||
| 91 | 91 | if (control.isCheckbox) { |
| 92 | 92 | $element.prop('checked', power_user.instruct[control.property]); |
| 93 | 93 | } else { |
| 94 | 94 | $element[0].valinnerText = (power_user.instruct[control.property]); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $element.on('input', async function () { |
| 98 | 98 | power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].val()innerText; |
| 99 | 99 | saveSettingsDebounced(); |
| 100 | + /* | |
| 100 | 101 | if (!control.isCheckbox) { |
| 101 | 102 | await resetScrollHeight($element); |
| 102 | 103 | } |
| 104 | + */ | |
| 103 | 105 | }); |
| 104 | 106 | |
| 105 | 107 | if (control.trigger) { |
| @@ -641,7 +643,8 @@ jQuery(() => { | ||
| 641 | 643 | if (control.isCheckbox) { |
| 642 | 644 | $element.prop('checked', power_user.instruct[control.property]).trigger('input'); |
| 643 | 645 | } else { |
| 644 | 646 | $element[0].valinnerText = (power_user.instruct[control.property]).trigger('input'); |
| 647 | + $element.trigger('input'); | |
| 645 | 648 | } |
| 646 | 649 | } |
| 647 | 650 | }); |
| @@ -1607,7 +1607,7 @@ async function loadPowerUserSettings(settings, data) { | ||
| 1607 | 1607 | $('#auto_swipe_minimum_length').val(power_user.auto_swipe_minimum_length); |
| 1608 | 1608 | $('#auto_swipe_blacklist').val(power_user.auto_swipe_blacklist.join(', ')); |
| 1609 | 1609 | $('#auto_swipe_blacklist_threshold').val(power_user.auto_swipe_blacklist_threshold); |
| 1610 | 1610 | $('#custom_stopping_strings').valtext(power_user.custom_stopping_strings); |
| 1611 | 1611 | $('#custom_stopping_strings_macro').prop('checked', power_user.custom_stopping_strings_macro); |
| 1612 | 1612 | $('#fuzzy_search_checkbox').prop('checked', power_user.fuzzy_search); |
| 1613 | 1613 | $('#persona_show_notifications').prop('checked', power_user.persona_show_notifications); |
| @@ -1637,7 +1637,7 @@ async function loadPowerUserSettings(settings, data) { | ||
| 1637 | 1637 | $('#waifuMode').prop('checked', power_user.waifuMode); |
| 1638 | 1638 | $('#movingUImode').prop('checked', power_user.movingUI); |
| 1639 | 1639 | $('#noShadowsmode').prop('checked', power_user.noShadows); |
| 1640 | 1640 | $('#start_reply_with').valtext(power_user.user_prompt_bias); |
| 1641 | 1641 | $('#chat-show-reply-prefix-checkbox').prop('checked', power_user.show_user_prompt_bias); |
| 1642 | 1642 | $('#auto_continue_enabled').prop('checked', power_user.auto_continue.enabled); |
| 1643 | 1643 | $('#auto_continue_allow_chat_completions').prop('checked', power_user.auto_continue.allow_chat_completions); |
| @@ -1887,13 +1887,14 @@ async function loadContextSettings() { | ||
| 1887 | 1887 | if (control.isCheckbox) { |
| 1888 | 1888 | $element.prop('checked', power_user.context[control.property]); |
| 1889 | 1889 | } else { |
| 1890 | 1890 | $element.valtext(power_user.context[control.property]); |
| 1891 | 1891 | } |
| 1892 | + console.log(`Setting ${$element.prop('id')} to ${power_user.context[control.property]}`); | |
| 1892 | 1893 | |
| 1893 | 1894 | // If the setting already exists, no need to duplicate it |
| 1894 | 1895 | // TODO: Maybe check the power_user object for the setting instead of a flag? |
| 1895 | 1896 | $element.on('input keyUp', async function () { |
| 1896 | 1897 | const value = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].val()innerText; |
| 1897 | 1898 | if (control.isGlobalSetting) { |
| 1898 | 1899 | power_user[control.property] = value; |
| 1899 | 1900 | } else { |
| @@ -1901,9 +1902,11 @@ async function loadContextSettings() { | ||
| 1901 | 1902 | } |
| 1902 | 1903 | |
| 1903 | 1904 | saveSettingsDebounced(); |
| 1905 | + /* | |
| 1904 | 1906 | if (!control.isCheckbox) { |
| 1905 | 1907 | await resetScrollHeight($element); |
| 1906 | 1908 | } |
| 1909 | + */ | |
| 1907 | 1910 | }); |
| 1908 | 1911 | }); |
| 1909 | 1912 | |
| @@ -1917,7 +1920,7 @@ async function loadContextSettings() { | ||
| 1917 | 1920 | }); |
| 1918 | 1921 | |
| 1919 | 1922 | $('#context_presets').on('change', function () { |
| 1920 | 1923 | const name = String($(this).find(':selected').valtext()); |
| 1921 | 1924 | const preset = context_presets.find(x => x.name === name); |
| 1922 | 1925 | |
| 1923 | 1926 | if (!preset) { |
| @@ -1942,9 +1945,8 @@ async function loadContextSettings() { | ||
| 1942 | 1945 | .prop('checked', control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property]) |
| 1943 | 1946 | .trigger('input'); |
| 1944 | 1947 | } else { |
| 1945 | - $element | |
| 1948 | + $element[0].innerText = (control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property]) | |
| 1946 | - .val(control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property]) | |
| 1949 | + $element.trigger('input'); | |
| 1947 | - .trigger('input'); | |
| 1948 | 1950 | } |
| 1949 | 1951 | } |
| 1950 | 1952 | }); |
| @@ -3246,7 +3248,7 @@ $(document).ready(() => { | ||
| 3246 | 3248 | }); |
| 3247 | 3249 | |
| 3248 | 3250 | $('#start_reply_with').on('input', function () { |
| 3249 | 3251 | power_user.user_prompt_bias = String($(this)[0].val()innerText); |
| 3250 | 3252 | saveSettingsDebounced(); |
| 3251 | 3253 | }); |
| 3252 | 3254 | |
| @@ -3785,7 +3787,7 @@ $(document).ready(() => { | ||
| 3785 | 3787 | }); |
| 3786 | 3788 | |
| 3787 | 3789 | $('#custom_stopping_strings').on('input', function () { |
| 3788 | 3790 | power_user.custom_stopping_strings = String($(this)[0].val(innerText).trim(); |
| 3789 | 3791 | saveSettingsDebounced(); |
| 3790 | 3792 | }); |
| 3791 | 3793 | |