Save chat for WI scan before running extension interceptors

This commit is contained in:
Cohee 2025-02-16 16:30:42 +02:00
parent a434d217cc
commit 20aaf7b19f

View File

@ -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);