Fix A/N and CFG menus on first in the list

This commit is contained in:
Cohee
2025-02-28 10:26:03 +02:00
parent 76cb34fd06
commit 14aec43064
2 changed files with 99 additions and 100 deletions

View File

@@ -389,7 +389,11 @@ export function setFloatingPrompt() {
}
function onANMenuItemClick() {
if (selected_group || this_chid) {
if (!selected_group && this_chid === undefined) {
toastr.warning(t`Select a character before trying to use Author's Note`, '', { timeOut: 2000 });
return;
}
//show AN if it's hidden
if ($('#floatingPrompt').css('display') !== 'flex') {
$('#floatingPrompt').addClass('resizing');
@@ -416,22 +420,18 @@ function onANMenuItemClick() {
$('#floatingPrompt').transition({
opacity: 0.0,
duration: animation_duration,
},
async function () {
}, async function () {
await delay(50);
$('#floatingPrompt').removeClass('resizing');
});
setTimeout(function () {
$('#floatingPrompt').hide();
}, animation_duration);
}
//duplicate options menu close handler from script.js
//because this listener takes priority
$('#options').stop().fadeOut(animation_duration);
} else {
toastr.warning(t`Select a character before trying to use Author's Note`, '', { timeOut: 2000 });
}
}
async function onChatChanged() {

View File

@@ -69,8 +69,7 @@ function setCharCfg(tempValue, setting) {
if (!existingCharaCfg.useChara &&
(tempAssign.guidance_scale ?? 1.00) === 1.00 &&
(tempAssign.negative_prompt?.length ?? 0) === 0 &&
(tempAssign.positive_prompt?.length ?? 0) === 0)
{
(tempAssign.positive_prompt?.length ?? 0) === 0) {
extension_settings.cfg.chara.splice(existingCharaCfgIndex, 1);
}
} else if (avatarName && tempValue.length > 0) {
@@ -113,7 +112,11 @@ function setChatCfg(tempValue, setting) {
// TODO: Only change CFG when character is selected
function onCfgMenuItemClick() {
if (selected_group || this_chid) {
if (!selected_group && this_chid === undefined) {
toastr.warning('Select a character before trying to configure CFG', '', { timeOut: 2000 });
return;
}
//show CFG config if it's hidden
if ($('#cfgConfig').css('display') !== 'flex') {
$('#cfgConfig').addClass('resizing');
@@ -140,8 +143,7 @@ function onCfgMenuItemClick() {
$('#cfgConfig').transition({
opacity: 0.0,
duration: animation_duration,
},
async function () {
}, async function () {
await delay(50);
$('#cfgConfig').removeClass('resizing');
});
@@ -153,9 +155,6 @@ function onCfgMenuItemClick() {
//duplicate options menu close handler from script.js
//because this listener takes priority
$('#options').stop().fadeOut(animation_duration);
} else {
toastr.warning('Select a character before trying to configure CFG', '', { timeOut: 2000 });
}
}
async function onChatChanged() {