Fix "Response Length" slider showing wrong value (#3659) - "Mad Lab Mode" was falsely "resetting" the slider control, for no obvious reason besides weird implementation.
Signed| @@ -492,7 +492,7 @@ function switchSwipeNumAllMessages() { | |||
| 492 | 492 | ||
| 493 | var originalSliderValues = []; | 493 | var originalSliderValues = []; |
| 494 | 494 | ||
| 495 | async function switchLabMode() { | 495 | async function switchLabMode({ noReset = false } = {}) { |
| 496 | 496 | ||
| 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() |
| 524 | 524 | ||
| 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'); |
| 528 | 531 | ||
| 529 | 532 | ||
| 530 | } else { | 533 | } else if (!noReset) { |
| 531 | //re apply the original sliders values to each input | 534 | //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'); |
| 541 | 544 | ||
| 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 | } |
| 547 | 549 | ||
| @@ -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 | }); |
| 3579 | 3581 | ||
| 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 active | 3585 | //disallow Lab Mode if ZenSliders are active |
| @@ -3587,7 +3589,7 @@ $(document).ready(() => { | |||
| 3587 | } | 3589 | } |
| 3588 | 3590 | ||
| 3589 | power_user.enableLabMode = value; | 3591 | power_user.enableLabMode = value; |
| 3590 | switchLabMode(); | 3592 | switchLabMode({ noReset: fromInit }); |
| 3591 | saveSettingsDebounced(); | 3593 | saveSettingsDebounced(); |
| 3592 | }); | 3594 | }); |
| 3593 | 3595 | ||