From 3fe3430006b71b10e35b5d815a3025b2bca4a165 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 1 Feb 2025 15:36:04 +0200 Subject: [PATCH] Fix undefined array access for CFG prompt --- public/script.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/script.js b/public/script.js index e6aada176..820f0a58c 100644 --- a/public/script.js +++ b/public/script.js @@ -4467,6 +4467,9 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro // TODO: Make all extension prompts use an array/splice method const lengthDiff = mesSend.length - cfgPrompt.depth; const cfgDepth = lengthDiff >= 0 ? lengthDiff : 0; + if (!Array.isArray(finalMesSend[cfgDepth].extensionPrompts)) { + finalMesSend[cfgDepth].extensionPrompts = []; + } finalMesSend[cfgDepth].extensionPrompts.push(`${cfgPrompt.value}\n`); } }