fix zenslider and labmode compatibility check

This commit is contained in:
RossAscends
2023-11-12 17:23:29 +09:00
parent 5331b5dc8a
commit 986eef9830
3 changed files with 25 additions and 20 deletions

View File

@ -121,7 +121,7 @@
<div id="clickSlidersTips" data-i18n="clickslidertips" class="toggle-description wide100p editable-slider-notification">
Click slider numbers to input manually.
</div>
<div id="labModeWarning" class="redWarningBG textAlignCenter">MAD LAB MODE ON</div>
<div id="labModeWarning" class="redWarningBG textAlignCenter hidden">MAD LAB MODE ON</div>
<a href="https://docs.sillytavern.app/usage/common-settings/" target="_blank" title="Documentation on sampling parameters.">
<span name="samplerHelpButton" class="note-link-span topRightInset fa-solid fa-circle-question"></span>
</a>

View File

@ -9057,7 +9057,7 @@ jQuery(async function () {
//yolo anything for Lab Mode
if (power_user.enableLabMode) {
console.log($(masterElement).attr('id'), myValue)
//console.log($(masterElement).attr('id'), myValue)
$(masterElement).val(myValue).trigger('input')
return
}

View File

@ -432,10 +432,12 @@ var originalSliderValues = []
async function switchLabMode() {
if (power_user.enableZenSliders) {
//force disable ZenSliders for Lab Mode
$("#enableZenSliders").trigger('click')
/* if (power_user.enableZenSliders && power_user.enableLabMode) {
toastr.warning("Can't start Lab Mode while Zen Sliders are active")
return
//$("#enableZenSliders").trigger('click')
}
*/
await delay(100)
const value = localStorage.getItem(storage_keys.enableLabMode);
power_user.enableLabMode = value === null ? false : value == "true";
@ -457,7 +459,7 @@ async function switchLabMode() {
.attr('min', '-99999')
.attr('max', '99999')
.attr('step', '0.001')
$("#labModeWarning").show()
$("#labModeWarning").removeClass('hidden')
//$("#advanced-ai-config-block input[type='range']").hide()
} else {
@ -470,7 +472,7 @@ async function switchLabMode() {
.trigger('input')
});
$("#advanced-ai-config-block input[type='range']").show()
$("#labModeWarning").hide()
$("#labModeWarning").addClass('hidden')
}
}
@ -2680,28 +2682,31 @@ $(document).ready(() => {
});
$("#enableZenSliders").on("input", function () {
if (power_user.enableLabMode) {
const value = !!$(this).prop('checked');
if (power_user.enableLabMode === true && value === true) {
//disallow zenSliders while Lab Mode is active
toastr.warning('ZenSliders not allowed in Mad Lab Mode')
$(this).prop('checked', false);
toastr.warning('Disable Mad Lab Mode before enabling Zen Sliders')
$(this).prop('checked', false).trigger('input');
return
}
const value = !!$(this).prop('checked');
power_user.enableZenSliders = value;
localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders));
saveSettingsDebounced();
switchZenSliders();
});
$("#enableLabMode").on("input", function () {
if (power_user.enableZenSliders) {
const value = !!$(this).prop('checked');
if (power_user.enableZenSliders === true && value === true) {
//disallow Lab Mode if ZenSliders are active
toastr.warning('Mad Lab Mode not allowed while ZenSliders are active')
$(this).prop('checked', false);
toastr.warning('Disable Zen Sliders before enabling Mad Lab Mode')
$(this).prop('checked', false).trigger('input');;
return
}
const value = !!$(this).prop('checked');
power_user.enableLabMode = value;
localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode));
saveSettingsDebounced();
switchLabMode();
});