From 20aaf7b19f65dba33594a2ef58effab99590e48a Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:30:42 +0200 Subject: [PATCH] Save chat for WI scan before running extension interceptors --- public/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 9123ad32b..430955381 100644 --- a/public/script.js +++ b/public/script.js @@ -3882,6 +3882,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro // Determine token limit let this_max_context = getMaxContextSize(); + // Save chat for WI scan before running extension interceptors + const chatForWI = coreChat.map(x => world_info_include_names ? `${x.name}: ${x.mes}` : x.mes).reverse(); if (!dryRun) { console.debug('Running extension interceptors'); @@ -3973,7 +3975,6 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro // Add WI to prompt (and also inject WI to AN value via hijack) // Make quiet prompt available for WIAN setExtensionPrompt('QUIET_PROMPT', quiet_prompt || '', extension_prompt_types.IN_PROMPT, 0, true); - const chatForWI = coreChat.map(x => world_info_include_names ? `${x.name}: ${x.mes}` : x.mes).reverse(); const { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoExamples, worldInfoDepth } = await getWorldInfoPrompt(chatForWI, this_max_context, dryRun); setExtensionPrompt('QUIET_PROMPT', '', extension_prompt_types.IN_PROMPT, 0, true);