initial commit: AF panel textareas >> contentEditable divs

b48d905c45f9b83f7f5d1cf4d7b8388f0456c7d3

RossAscends <124905043+RossAscends@users.noreply.github.com>

3 files changed, +41 -36Showing whitespace changes
public/index.html+22 -22
@@ -3061,14 +3061,14 @@
30613061 <label for="context_story_string">
30623062 <small data-i18n="Story String">Story String</small>
30633063 </label>
30643064 <textareadiv contenteditable="true" id="context_story_string" class="text_pole textarea_compact autoSetHeight" rows="1"></textareadiv>
30653065 <div class="flex-container">
30663066 <div class="flex1">
30673067 <label for="context_example_separator">
30683068 <small data-i18n="Example Separator">Example Separator</small>
30693069 </label>
30703070 <div>
30713071 <textareadiv contenteditable="true" id="context_example_separator" class="text_pole textarea_compact autoSetHeight" maxlength="500" rows="1"></textareadiv>
30723072 </div>
30733073 </div>
30743074 <div class="flex1">
@@ -3076,7 +3076,7 @@
30763076 <small data-i18n="Chat Start">Chat Start</small>
30773077 </label>
30783078 <div>
30793079 <textareadiv contenteditable="true" id="context_chat_start" class="text_pole textarea_compact autoSetHeight" maxlength="500" rows="1"></textareadiv>
30803080 </div>
30813081 </div>
30823082 </div>
@@ -3172,7 +3172,7 @@
31723172 </small>
31733173 </label>
31743174 <div data-newbie-hidden>
31753175 <textareadiv contenteditable="true" id="instruct_activation_regex" class="text_pole textarea_compact autoSetHeight" maxlength="5000" rows="1"></textareadiv>
31763176 </div>
31773177 <div data-newbie-hidden>
31783178 <label for="instruct_wrap" class="checkbox_label">
@@ -3200,7 +3200,7 @@
32003200 <label>
32013201 <small data-i18n="System Prompt">System Prompt</small>
32023202 </label>
32033203 <textareadiv contenteditable="true" id="instruct_system_prompt" class="text_pole textarea_compact autoSetHeight" rows="1"></textareadiv>
32043204 </div>
32053205 <div data-newbie-hidden class="inline-drawer wide100p flexFlowColumn">
32063206 <div class="inline-drawer-toggle inline-drawer-header">
@@ -3217,7 +3217,7 @@
32173217 <small data-i18n="System Prompt Prefix">System Prompt Prefix</small>
32183218 </label>
32193219 <div>
32203220 <textareadiv contenteditable="true" id="instruct_system_sequence_prefix" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32213221 </div>
32223222 </div>
32233223 <div class="flex1" title="Inserted after a System prompt." data-i18n="[title]Inserted after a System prompt.">
@@ -3225,7 +3225,7 @@
32253225 <small data-i18n="System Prompt Suffix">System Prompt Suffix</small>
32263226 </label>
32273227 <div>
32283228 <textareadiv contenteditable="true" id="instruct_system_sequence_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32293229 </div>
32303230 </div>
32313231 </div>
@@ -3238,7 +3238,7 @@
32383238 <small data-i18n="User Message Prefix">User Message Prefix</small>
32393239 </label>
32403240 <div>
32413241 <textareadiv contenteditable="true" id="instruct_input_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32423242 </div>
32433243 </div>
32443244 <div class="flex1" title="Inserted after a User message." data-i18n="[title]Inserted after a User message.">
@@ -3246,7 +3246,7 @@
32463246 <small data-i18n="User Message Suffix">User Message Suffix</small>
32473247 </label>
32483248 <div>
32493249 <textareadiv contenteditable="true" id="instruct_input_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32503250 </div>
32513251 </div>
32523252 </div>
@@ -3256,7 +3256,7 @@
32563256 <small data-i18n="Assistant Message Prefix">Assistant Message Prefix</small>
32573257 </label>
32583258 <div>
32593259 <textareadiv contenteditable="true" id="instruct_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32603260 </div>
32613261 </div>
32623262 <div class="flex1" title="Inserted after an Assistant message." data-i18n="[title]Inserted after an Assistant message.">
@@ -3264,7 +3264,7 @@
32643264 <small data-i18n="Assistant Message Suffix">Assistant Message Suffix</small>
32653265 </label>
32663266 <div>
32673267 <textareadiv contenteditable="true" id="instruct_output_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32683268 </div>
32693269 </div>
32703270 </div>
@@ -3274,7 +3274,7 @@
32743274 <small data-i18n="System Message Prefix">System Message Prefix</small>
32753275 </label>
32763276 <div>
32773277 <textareadiv contenteditable="true" id="instruct_system_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32783278 </div>
32793279 </div>
32803280 <div class="flex1" title="Inserted after a System message." data-i18n="[title]Inserted after a System message.">
@@ -3282,7 +3282,7 @@
32823282 <small data-i18n="System Message Suffix">System Message Suffix</small>
32833283 </label>
32843284 <div>
32853285 <textareadiv contenteditable="true" id="instruct_system_suffix" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
32863286 </div>
32873287 </div>
32883288 <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 @@
33013301 <small data-i18n="First Assistant Prefix">First Assistant Prefix</small>
33023302 </label>
33033303 <div>
33043304 <textareadiv contenteditable="true" id="instruct_first_output_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
33053305 </div>
33063306 </div>
33073307 <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 @@
33093309 <small data-i18n="Last Assistant Prefix">Last Assistant Prefix</small>
33103310 </label>
33113311 <div>
33123312 <textareadiv contenteditable="true" id="instruct_last_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
33133313 </div>
33143314 </div>
33153315 </div>
@@ -3319,7 +3319,7 @@
33193319 <small data-i18n="First User Prefix">First User Prefix</small>
33203320 </label>
33213321 <div>
33223322 <textareadiv contenteditable="true" id="instruct_first_input_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
33233323 </div>
33243324 </div>
33253325 <div class="flex1" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence">
@@ -3327,7 +3327,7 @@
33273327 <small data-i18n="Last User Prefix">Last User Prefix</small>
33283328 </label>
33293329 <div>
33303330 <textareadiv contenteditable="true" id="instruct_last_input_sequence" class="text_pole wide100p textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
33313331 </div>
33323332 </div>
33333333 </div>
@@ -3337,7 +3337,7 @@
33373337 <small data-i18n="System Instruction Prefix">System Instruction Prefix</small>
33383338 </label>
33393339 <div>
33403340 <textareadiv contenteditable="true" id="instruct_last_system_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
33413341 </div>
33423342 </div>
33433343 <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 @@
33453345 <small data-i18n="Stop Sequence">Stop Sequence</small>
33463346 </label>
33473347 <div>
33483348 <textareadiv contenteditable="true" id="instruct_stop_sequence" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
33493349 </div>
33503350 </div>
33513351 </div>
@@ -3355,7 +3355,7 @@
33553355 <small data-i18n="User Filler Message">User Filler Message</small>
33563356 </label>
33573357 <div>
33583358 <textareadiv contenteditable="true" id="instruct_user_alignment_message" class="text_pole textarea_compact autoSetHeight" maxlength="2000" placeholder="&mdash;" rows="1"></textareadiv>
33593359 </div>
33603360 </div>
33613361 </div>
@@ -3448,7 +3448,7 @@
34483448 </span>
34493449 </h4>
34503450 <div>
34513451 <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>
34523452 </div>
34533453 <label class="checkbox_label" for="chat-show-reply-prefix-checkbox">
34543454 <input id="chat-show-reply-prefix-checkbox" type="checkbox" />
@@ -3482,7 +3482,7 @@
34823482 </small>
34833483 </div>
34843484 <div>
34853485 <textareadiv contenteditable="true" id="custom_stopping_strings" rows="2" class="text_pole textarea_compact monospace" placeholder="[&quot;Ford&quot;, &quot;BMW&quot;, &quot;Fiat&quot;]"></textareadiv>
34863486 </div>
34873487 <label class="checkbox_label" for="custom_stopping_strings_macro">
34883488 <input id="custom_stopping_strings_macro" type="checkbox" checked>
public/scripts/instruct-mode.js+6 -3
@@ -91,15 +91,17 @@ export function loadInstructMode(data) {
9191 if (control.isCheckbox) {
9292 $element.prop('checked', power_user.instruct[control.property]);
9393 } else {
9494 $element[0].valinnerText = (power_user.instruct[control.property]);
9595 }
9696
9797 $element.on('input', async function () {
9898 power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].val()innerText;
9999 saveSettingsDebounced();
100+ /*
100101 if (!control.isCheckbox) {
101102 await resetScrollHeight($element);
102103 }
104+ */
103105 });
104106
105107 if (control.trigger) {
@@ -641,7 +643,8 @@ jQuery(() => {
641643 if (control.isCheckbox) {
642644 $element.prop('checked', power_user.instruct[control.property]).trigger('input');
643645 } else {
644646 $element[0].valinnerText = (power_user.instruct[control.property]).trigger('input');
647+ $element.trigger('input');
645648 }
646649 }
647650 });
public/scripts/power-user.js+13 -11
@@ -1607,7 +1607,7 @@ async function loadPowerUserSettings(settings, data) {
16071607 $('#auto_swipe_minimum_length').val(power_user.auto_swipe_minimum_length);
16081608 $('#auto_swipe_blacklist').val(power_user.auto_swipe_blacklist.join(', '));
16091609 $('#auto_swipe_blacklist_threshold').val(power_user.auto_swipe_blacklist_threshold);
16101610 $('#custom_stopping_strings').valtext(power_user.custom_stopping_strings);
16111611 $('#custom_stopping_strings_macro').prop('checked', power_user.custom_stopping_strings_macro);
16121612 $('#fuzzy_search_checkbox').prop('checked', power_user.fuzzy_search);
16131613 $('#persona_show_notifications').prop('checked', power_user.persona_show_notifications);
@@ -1637,7 +1637,7 @@ async function loadPowerUserSettings(settings, data) {
16371637 $('#waifuMode').prop('checked', power_user.waifuMode);
16381638 $('#movingUImode').prop('checked', power_user.movingUI);
16391639 $('#noShadowsmode').prop('checked', power_user.noShadows);
16401640 $('#start_reply_with').valtext(power_user.user_prompt_bias);
16411641 $('#chat-show-reply-prefix-checkbox').prop('checked', power_user.show_user_prompt_bias);
16421642 $('#auto_continue_enabled').prop('checked', power_user.auto_continue.enabled);
16431643 $('#auto_continue_allow_chat_completions').prop('checked', power_user.auto_continue.allow_chat_completions);
@@ -1887,13 +1887,14 @@ async function loadContextSettings() {
18871887 if (control.isCheckbox) {
18881888 $element.prop('checked', power_user.context[control.property]);
18891889 } else {
18901890 $element.valtext(power_user.context[control.property]);
18911891 }
1892+ console.log(`Setting ${$element.prop('id')} to ${power_user.context[control.property]}`);
18921893
18931894 // If the setting already exists, no need to duplicate it
18941895 // TODO: Maybe check the power_user object for the setting instead of a flag?
18951896 $element.on('input keyUp', async function () {
18961897 const value = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].val()innerText;
18971898 if (control.isGlobalSetting) {
18981899 power_user[control.property] = value;
18991900 } else {
@@ -1901,9 +1902,11 @@ async function loadContextSettings() {
19011902 }
19021903
19031904 saveSettingsDebounced();
1905+ /*
19041906 if (!control.isCheckbox) {
19051907 await resetScrollHeight($element);
19061908 }
1909+ */
19071910 });
19081911 });
19091912
@@ -1917,7 +1920,7 @@ async function loadContextSettings() {
19171920 });
19181921
19191922 $('#context_presets').on('change', function () {
19201923 const name = String($(this).find(':selected').valtext());
19211924 const preset = context_presets.find(x => x.name === name);
19221925
19231926 if (!preset) {
@@ -1942,9 +1945,8 @@ async function loadContextSettings() {
19421945 .prop('checked', control.isGlobalSetting ? power_user[control.property] : power_user.context[control.property])
19431946 .trigger('input');
19441947 } 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');
19481950 }
19491951 }
19501952 });
@@ -3246,7 +3248,7 @@ $(document).ready(() => {
32463248 });
32473249
32483250 $('#start_reply_with').on('input', function () {
32493251 power_user.user_prompt_bias = String($(this)[0].val()innerText);
32503252 saveSettingsDebounced();
32513253 });
32523254
@@ -3785,7 +3787,7 @@ $(document).ready(() => {
37853787 });
37863788
37873789 $('#custom_stopping_strings').on('input', function () {
37883790 power_user.custom_stopping_strings = String($(this)[0].val(innerText).trim();
37893791 saveSettingsDebounced();
37903792 });
37913793