mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Refactor CFG prompt gen in getCombinedPrompt
We don't need to create the cfgPrompt variable unless useCfgPrompt is true, so move it inside the if-block.
This commit is contained in:
@@ -3800,12 +3800,9 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
|||||||
// Deep clone
|
// Deep clone
|
||||||
let finalMesSend = structuredClone(mesSend);
|
let finalMesSend = structuredClone(mesSend);
|
||||||
|
|
||||||
let cfgPrompt = {};
|
|
||||||
if (useCfgPrompt) {
|
if (useCfgPrompt) {
|
||||||
cfgPrompt = getCfgPrompt(cfgGuidanceScale, isNegative);
|
const cfgPrompt = getCfgPrompt(cfgGuidanceScale, isNegative);
|
||||||
}
|
if (cfgPrompt.value) {
|
||||||
|
|
||||||
if (cfgPrompt && cfgPrompt.value) {
|
|
||||||
if (cfgPrompt.depth === 0) {
|
if (cfgPrompt.depth === 0) {
|
||||||
finalMesSend[finalMesSend.length - 1].message +=
|
finalMesSend[finalMesSend.length - 1].message +=
|
||||||
/\s/.test(finalMesSend[finalMesSend.length - 1].message.slice(-1))
|
/\s/.test(finalMesSend[finalMesSend.length - 1].message.slice(-1))
|
||||||
@@ -3818,6 +3815,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
|||||||
finalMesSend[cfgDepth].extensionPrompts.push(`${cfgPrompt.value}\n`);
|
finalMesSend[cfgDepth].extensionPrompts.push(`${cfgPrompt.value}\n`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add prompt bias after everything else
|
// Add prompt bias after everything else
|
||||||
// Always run with continue
|
// Always run with continue
|
||||||
|
Reference in New Issue
Block a user