Fix undefined array access for CFG prompt

3fe3430006b71b10e35b5d815a3025b2bca4a165

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -0Showing whitespace changes
public/script.js+3 -0
@@ -4467,6 +4467,9 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
44674467 // TODO: Make all extension prompts use an array/splice method
44684468 const lengthDiff = mesSend.length - cfgPrompt.depth;
44694469 const cfgDepth = lengthDiff >= 0 ? lengthDiff : 0;
4470+ if (!Array.isArray(finalMesSend[cfgDepth].extensionPrompts)) {
4471+ finalMesSend[cfgDepth].extensionPrompts = [];
4472+ }
44704473 finalMesSend[cfgDepth].extensionPrompts.push(`${cfgPrompt.value}\n`);
44714474 }
44724475 }