Add failsafe condition preventing gens when cfg settings are not found

This commit is contained in:
Cohee 2023-10-15 22:21:19 +03:00
parent 92ddb2b791
commit c8dace09b7
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,11 @@ export const metadataKeys = {
// Gets the CFG guidance scale // Gets the CFG guidance scale
// If the guidance scale is 1, ignore the CFG prompt(s) since it won't be used anyways // If the guidance scale is 1, ignore the CFG prompt(s) since it won't be used anyways
export function getGuidanceScale() { export function getGuidanceScale() {
if (!extension_settings.cfg) {
console.warn("CFG extension is not enabled. Skipping CFG guidance.");
return;
}
const charaCfg = extension_settings.cfg.chara?.find((e) => e.name === getCharaFilename(this_chid)); const charaCfg = extension_settings.cfg.chara?.find((e) => e.name === getCharaFilename(this_chid));
const chatGuidanceScale = chat_metadata[metadataKeys.guidance_scale]; const chatGuidanceScale = chat_metadata[metadataKeys.guidance_scale];
const groupchatCharOverride = chat_metadata[metadataKeys.groupchat_individual_chars] ?? false; const groupchatCharOverride = chat_metadata[metadataKeys.groupchat_individual_chars] ?? false;