From 33347f1c7c74da7d45c903fc00636b63d67b144c Mon Sep 17 00:00:00 2001 From: kwaroran Date: Fri, 12 Jul 2024 06:42:06 +0900 Subject: [PATCH] make decorator only parse once --- public/scripts/world-info.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index e87d3c035..d6c376d18 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -3647,7 +3647,10 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { for (let entry of sortedEntries) { //oarse decorators - const [decorators] = parseDecorators(entry.content); + const [decorators, content] = parseDecorators(entry.content); + entry.decorators = decorators; + entry.content = content; + if(decorators.includes('@@activate')){ //activate in any case activatedNow.add(entry); @@ -3820,7 +3823,7 @@ async function checkWorldInfo(chat, maxContext, isDryRun) { } else { console.debug(`uid:${entry.uid} passed probability check, inserting to prompt`); } // Substitute macros inline, for both this checking and also future processing - entry.content = substituteParams(parseDecorators(entry.content)[1]); + entry.content = substituteParams(entry.content); newContent += `${entry.content}\n`; if ((textToScanTokens + (await getTokenCountAsync(newContent))) >= budget) {