Merge pull request #1001 from bdashore3/staging

More CFG fixes
This commit is contained in:
Cohee 2023-08-23 18:49:36 +03:00 committed by GitHub
commit 2c58f9d903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -2741,6 +2741,12 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
// Fetches the combined prompt for both negative and positive prompts
const cfgGuidanceScale = getGuidanceScale();
function getCombinedPrompt(isNegative) {
// Only return if the guidance scale doesn't exist or the value is 1
// Also don't return if constructing the neutral prompt
if (isNegative && (!cfgGuidanceScale || cfgGuidanceScale?.value === 1)) {
return;
}
let finalMesSend = [...mesSend];
let cfgPrompt = {};
if (cfgGuidanceScale && cfgGuidanceScale?.value !== 1) {
@ -2754,7 +2760,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
? cfgPrompt.value
: ` ${cfgPrompt.value}`;
} else {
// TODO: Switch from splice method to insertion depth method
// TODO: Make all extension prompts use an array/splice method
finalMesSend.splice(mesSend.length - cfgPrompt.depth, 0, `${cfgPrompt.value}\n`);
}
}

View File

@ -348,7 +348,7 @@ jQuery(async () => {
.filter(":checked")
.map(function() { return parseInt($(this).val()) })
.get()
.filter((e) => e !== NaN) || [];
.filter((e) => !Number.isNaN(e)) || [];
chat_metadata[metadataKeys.prompt_combine] = values;
saveMetadataDebounced();

View File

@ -39,10 +39,12 @@ export function getGuidanceScale() {
};
}
if (extension_settings.cfg.global && extension_settings.cfg.global?.guidance_scale !== 1) {
return {
type: cfgType.global,
value: extension_settings.cfg.global.guidance_scale
};
}
}
// Gets the CFG prompt