From ead0aa65ffc9d6259cdb85f60fba3fe9770135d3 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Jan 2024 02:34:43 +0200 Subject: [PATCH] #1649 Fix inclusion groups with recursion --- public/scripts/world-info.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 913dbd491..42ca983fb 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -1898,6 +1898,11 @@ async function checkWorldInfo(chat, maxContext) { needsToScan = false; } + if (newEntries.length === 0) { + console.debug('No new entries activated, stopping'); + needsToScan = false; + } + if (needsToScan) { const text = newEntries .filter(x => !failedProbabilityChecks.has(x)) @@ -2006,6 +2011,10 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) { if (Array.from(allActivatedEntries).some(x => x.group === key)) { console.debug(`Skipping inclusion group check, group already activated '${key}'`); + // We need to forcefully deactivate all other entries in the group + for (const entry of group) { + newEntries.splice(newEntries.indexOf(entry), 1); + } continue; }