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 <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-07-14 15:45:10 -04:00
parent 8f96a74d1e
commit 1a8d8db102

View File

@@ -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}`)