From 1a8d8db1028a4a9fdeeb0acaa74da3cc6b9432ad Mon Sep 17 00:00:00 2001 From: kingbri Date: Fri, 14 Jul 2023 15:45:10 -0400 Subject: [PATCH] World Info: Fix selective with legacy entries Legacy entries do not have the selectiveOrder property within the JSON object. Fix this by adding a check in secondary key mapping to default to AND. Signed-off-by: kingbri --- public/scripts/world-info.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index b1831b88c..ae47a395b 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -961,9 +961,13 @@ async function checkWorldInfo(chat, maxContext) { console.debug(`uid:${entry.uid}: checking logic: ${entry.selectiveLogic}`) secondary: for (let keysecondary of entry.keysecondary) { const secondarySubstituted = substituteParams(keysecondary); - console.debug(`uid:${entry.uid}: filtering ${secondarySubstituted}`) + console.debug(`uid:${entry.uid}: filtering ${secondarySubstituted}`); + + // If selectiveLogic isn't found, assume it's AND + const selectiveLogic = entry.selectiveLogic ?? 0; + //AND operator - if (entry.selectiveLogic === 0) { + if (selectiveLogic === 0) { console.debug('saw AND logic, checking..') if (secondarySubstituted && matchKeys(textToScan, secondarySubstituted.trim())) { console.log(`activating entry ${entry.uid} with AND found`) @@ -972,7 +976,7 @@ async function checkWorldInfo(chat, maxContext) { } } //NOT operator - if (entry.selectiveLogic === 1) { + if (selectiveLogic === 1) { console.debug(`uid ${entry.uid}: checking NOT logic for ${secondarySubstituted}`) if (secondarySubstituted && matchKeys(textToScan, secondarySubstituted.trim())) { console.debug(`uid ${entry.uid}: canceled; filtered out by ${secondarySubstituted}`)