Unbreak CFG sliders

This commit is contained in:
Cohee 2023-10-29 23:56:11 +02:00
parent ea36d34942
commit 68e60ff9ef
1 changed files with 6 additions and 6 deletions

View File

@ -178,7 +178,7 @@ async function modifyCharaHtml() {
function loadSettings() { function loadSettings() {
// Set chat CFG if it exists // Set chat CFG if it exists
$('#chat_cfg_guidance_scale').val(chat_metadata[metadataKeys.guidance_scale] ?? 1.0.toFixed(2)); $('#chat_cfg_guidance_scale').val(chat_metadata[metadataKeys.guidance_scale] ?? 1.0.toFixed(2));
$('#chat_cfg_guidance_scale_counter').text(chat_metadata[metadataKeys.guidance_scale]?.toFixed(2) ?? 1.0.toFixed(2)); $('#chat_cfg_guidance_scale_counter').val(chat_metadata[metadataKeys.guidance_scale]?.toFixed(2) ?? 1.0.toFixed(2));
$('#chat_cfg_negative_prompt').val(chat_metadata[metadataKeys.negative_prompt] ?? ''); $('#chat_cfg_negative_prompt').val(chat_metadata[metadataKeys.negative_prompt] ?? '');
$('#chat_cfg_positive_prompt').val(chat_metadata[metadataKeys.positive_prompt] ?? ''); $('#chat_cfg_positive_prompt').val(chat_metadata[metadataKeys.positive_prompt] ?? '');
$('#groupchat_cfg_use_chara').prop('checked', chat_metadata[metadataKeys.groupchat_individual_chars] ?? false); $('#groupchat_cfg_use_chara').prop('checked', chat_metadata[metadataKeys.groupchat_individual_chars] ?? false);
@ -211,7 +211,7 @@ function loadSettings() {
if (!selected_group) { if (!selected_group) {
const charaCfg = extension_settings.cfg.chara.find((e) => e.name === getCharaFilename()); const charaCfg = extension_settings.cfg.chara.find((e) => e.name === getCharaFilename());
$('#chara_cfg_guidance_scale').val(charaCfg?.guidance_scale ?? 1.00); $('#chara_cfg_guidance_scale').val(charaCfg?.guidance_scale ?? 1.00);
$('#chara_cfg_guidance_scale_counter').text(charaCfg?.guidance_scale?.toFixed(2) ?? 1.0.toFixed(2)); $('#chara_cfg_guidance_scale_counter').val(charaCfg?.guidance_scale?.toFixed(2) ?? 1.0.toFixed(2));
$('#chara_cfg_negative_prompt').val(charaCfg?.negative_prompt ?? ''); $('#chara_cfg_negative_prompt').val(charaCfg?.negative_prompt ?? '');
$('#chara_cfg_positive_prompt').val(charaCfg?.positive_prompt ?? ''); $('#chara_cfg_positive_prompt').val(charaCfg?.positive_prompt ?? '');
} }
@ -228,7 +228,7 @@ async function initialLoadSettings() {
// Set global CFG values on load // Set global CFG values on load
$('#global_cfg_guidance_scale').val(extension_settings.cfg.global.guidance_scale); $('#global_cfg_guidance_scale').val(extension_settings.cfg.global.guidance_scale);
$('#global_cfg_guidance_scale_counter').text(extension_settings.cfg.global.guidance_scale.toFixed(2)); $('#global_cfg_guidance_scale_counter').val(extension_settings.cfg.global.guidance_scale.toFixed(2));
$('#global_cfg_negative_prompt').val(extension_settings.cfg.global.negative_prompt); $('#global_cfg_negative_prompt').val(extension_settings.cfg.global.negative_prompt);
$('#global_cfg_positive_prompt').val(extension_settings.cfg.global.positive_prompt); $('#global_cfg_positive_prompt').val(extension_settings.cfg.global.positive_prompt);
} }
@ -291,7 +291,7 @@ export function initCfg() {
const numberValue = Number($(this).val()); const numberValue = Number($(this).val());
const success = setChatCfg(numberValue, settingType.guidance_scale); const success = setChatCfg(numberValue, settingType.guidance_scale);
if (success) { if (success) {
$('#chat_cfg_guidance_scale_counter').text(numberValue.toFixed(2)); $('#chat_cfg_guidance_scale_counter').val(numberValue.toFixed(2));
} }
}); });
@ -307,7 +307,7 @@ export function initCfg() {
const value = $(this).val(); const value = $(this).val();
const success = setCharCfg(value, settingType.guidance_scale); const success = setCharCfg(value, settingType.guidance_scale);
if (success) { if (success) {
$('#chara_cfg_guidance_scale_counter').text(Number(value).toFixed(2)); $('#chara_cfg_guidance_scale_counter').val(Number(value).toFixed(2));
} }
}); });
@ -321,7 +321,7 @@ export function initCfg() {
$('#global_cfg_guidance_scale').on('input', function() { $('#global_cfg_guidance_scale').on('input', function() {
extension_settings.cfg.global.guidance_scale = Number($(this).val()); extension_settings.cfg.global.guidance_scale = Number($(this).val());
$('#global_cfg_guidance_scale_counter').text(extension_settings.cfg.global.guidance_scale.toFixed(2)); $('#global_cfg_guidance_scale_counter').val(extension_settings.cfg.global.guidance_scale.toFixed(2));
saveSettingsDebounced(); saveSettingsDebounced();
}); });