CFG: NAI fixes

NAI does CFG differently, so add special cases for them. Also gate
CFG access to only work on textgenwebui since that's where it's
implemented.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-08-20 19:51:01 -04:00
parent 4ea9e481a8
commit 60faaf1831
2 changed files with 6 additions and 1 deletions

View File

@@ -2971,7 +2971,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
} }
// Get the negative prompt first since it has the unmodified mesSend array // Get the negative prompt first since it has the unmodified mesSend array
let negativePrompt = getCombinedPrompt(true); let negativePrompt = main_api == 'textgenerationwebui' ? getCombinedPrompt(true) : undefined;
let finalPromt = getCombinedPrompt(false); let finalPromt = getCombinedPrompt(false);
const cfgValues = { const cfgValues = {
guidanceScale: cfgGuidanceScale?.value, guidanceScale: cfgGuidanceScale?.value,

View File

@@ -7,6 +7,7 @@ import {
saveSettingsDebounced, saveSettingsDebounced,
setGenerationParamsFromPreset setGenerationParamsFromPreset
} from "../script.js"; } from "../script.js";
import { getCfgPrompt } from "./extensions/cfg/util.js";
import { MAX_CONTEXT_DEFAULT, tokenizers } from "./power-user.js"; import { MAX_CONTEXT_DEFAULT, tokenizers } from "./power-user.js";
import { import {
getSortableDelay, getSortableDelay,
@@ -395,6 +396,10 @@ function getBadWordPermutations(text) {
} }
export function getNovelGenerationData(finalPrompt, this_settings, this_amount_gen, isImpersonate, cfgValues) { export function getNovelGenerationData(finalPrompt, this_settings, this_amount_gen, isImpersonate, cfgValues) {
if (cfgValues.guidanceScale && cfgValues.guidanceScale !== 1) {
cfgValues.negativePrompt = (getCfgPrompt(cfgValues.guidanceScale, true))?.value;
}
const clio = nai_settings.model_novel.includes('clio'); const clio = nai_settings.model_novel.includes('clio');
const kayra = nai_settings.model_novel.includes('kayra'); const kayra = nai_settings.model_novel.includes('kayra');