Fix "Response Length" slider showing wrong value (#3659) - "Mad Lab Mode" was falsely "resetting" the slider control, for no obvious reason besides weird implementation.

bdbe04325983e7741f643339af5733926ec0ad99

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +10 -8Ignore whitespace
public/scripts/power-user.js+10 -8
@@ -492,7 +492,7 @@ function switchSwipeNumAllMessages() {
492492
493var originalSliderValues = [];493var originalSliderValues = [];
494494
495async function switchLabMode() {495async function switchLabMode({ noReset = false } = {}) {
496496
497 /* if (power_user.enableZenSliders && power_user.enableLabMode) {497 /* if (power_user.enableZenSliders && power_user.enableLabMode) {
498 toastr.warning("Can't start Lab Mode while Zen Sliders are active")498 toastr.warning("Can't start Lab Mode while Zen Sliders are active")
@@ -522,12 +522,15 @@ async function switchLabMode() {
522 $('#labModeWarning').removeClass('displayNone');522 $('#labModeWarning').removeClass('displayNone');
523 //$("#advanced-ai-config-block input[type='range']").hide()523 //$("#advanced-ai-config-block input[type='range']").hide()
524524
525 $('#amount_gen_counter').attr('min', '1')
526 .attr('max', '99999')
527 .attr('step', '1');
525 $('#amount_gen').attr('min', '1')528 $('#amount_gen').attr('min', '1')
526 .attr('max', '99999')529 .attr('max', '99999')
527 .attr('step', '1');530 .attr('step', '1');
528531
529532
530 } else {533 } else if (!noReset) {
531 //re apply the original sliders values to each input534 //re apply the original sliders values to each input
532 originalSliderValues.forEach(function (slider) {535 originalSliderValues.forEach(function (slider) {
533 $('#' + slider.id)536 $('#' + slider.id)
@@ -539,9 +542,8 @@ async function switchLabMode() {
539 $('#advanced-ai-config-block input[type=\'range\']').show();542 $('#advanced-ai-config-block input[type=\'range\']').show();
540 $('#labModeWarning').addClass('displayNone');543 $('#labModeWarning').addClass('displayNone');
541544
542 $('#amount_gen').attr('min', '16')545 // To set the correct amount_gen back, we just call the function calculating it correctly
543 .attr('max', '2048')546 switchMaxContextSize();
544 .attr('step', '1');
545 }547 }
546}548}
547549
@@ -1538,7 +1540,7 @@ async function loadPowerUserSettings(settings, data) {
1538 $('#prefer_character_prompt').prop('checked', power_user.prefer_character_prompt);1540 $('#prefer_character_prompt').prop('checked', power_user.prefer_character_prompt);
1539 $('#prefer_character_jailbreak').prop('checked', power_user.prefer_character_jailbreak);1541 $('#prefer_character_jailbreak').prop('checked', power_user.prefer_character_jailbreak);
1540 $('#enableZenSliders').prop('checked', power_user.enableZenSliders).trigger('input');1542 $('#enableZenSliders').prop('checked', power_user.enableZenSliders).trigger('input');
1541 $('#enableLabMode').prop('checked', power_user.enableLabMode).trigger('input');1543 $('#enableLabMode').prop('checked', power_user.enableLabMode).trigger('input', { fromInit: true });
1542 $(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop('checked', true);1544 $(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop('checked', true);
1543 $(`#chat_display option[value=${power_user.chat_display}]`).attr('selected', true).trigger('change');1545 $(`#chat_display option[value=${power_user.chat_display}]`).attr('selected', true).trigger('change');
1544 $('#chat_width_slider').val(power_user.chat_width);1546 $('#chat_width_slider').val(power_user.chat_width);
@@ -3577,7 +3579,7 @@ $(document).ready(() => {
3577 saveSettingsDebounced();3579 saveSettingsDebounced();
3578 });3580 });
35793581
3580 $('#enableLabMode').on('input', function () {3582 $('#enableLabMode').on('input', function (event, { fromInit = false } = {}) {
3581 const value = !!$(this).prop('checked');3583 const value = !!$(this).prop('checked');
3582 if (power_user.enableZenSliders === true && value === true) {3584 if (power_user.enableZenSliders === true && value === true) {
3583 //disallow Lab Mode if ZenSliders are active3585 //disallow Lab Mode if ZenSliders are active
@@ -3587,7 +3589,7 @@ $(document).ready(() => {
3587 }3589 }
35883590
3589 power_user.enableLabMode = value;3591 power_user.enableLabMode = value;
3590 switchLabMode();3592 switchLabMode({ noReset: fromInit });
3591 saveSettingsDebounced();3593 saveSettingsDebounced();
3592 });3594 });
35933595