From b9d72bfdf4cb9627f4a87718f5e61ee59be31b75 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Thu, 9 May 2024 06:37:14 +0200 Subject: [PATCH] Do not double-parse WI content on "always on" --- public/scripts/world-info.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 77ccbf8bd..51a8a8bf6 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -2373,7 +2373,6 @@ async function checkWorldInfo(chat, maxContext) { } if (entry.constant || buffer.isExternallyActivated(entry)) { - entry.content = substituteParams(entry.content); activatedNow.add(entry); continue; } @@ -2466,7 +2465,9 @@ async function checkWorldInfo(chat, maxContext) { continue; } else { console.debug(`uid:${entry.uid} passed probability check, inserting to prompt`); } - newContent += `${substituteParams(entry.content)}\n`; + // Substitute macros inline, for both this checking and also future processing + entry.content = substituteParams(entry.content); + newContent += `${entry.content}\n`; if ((textToScanTokens + (await getTokenCountAsync(newContent))) >= budget) { console.debug('WI budget reached, stopping'); @@ -2499,7 +2500,7 @@ async function checkWorldInfo(chat, maxContext) { const text = newEntries .filter(x => !failedProbabilityChecks.has(x)) .filter(x => !x.preventRecursion) - .map(x => substituteParams(x.content)).join('\n'); + .map(x => x.content).join('\n'); buffer.addRecurse(text); allActivatedText = (text + '\n' + allActivatedText); }