diff --git a/public/index.html b/public/index.html
index 28d41d52d..895ba3c8a 100644
--- a/public/index.html
+++ b/public/index.html
@@ -4274,6 +4274,7 @@
Logic
diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js
index a33283b8e..67ed6a9ee 100644
--- a/public/scripts/world-info.js
+++ b/public/scripts/world-info.js
@@ -39,6 +39,7 @@ const world_info_logic = {
AND_ANY: 0,
NOT_ALL: 1,
NOT_ANY: 2,
+ AND_ALL: 3,
};
let world_info = {};
@@ -1789,6 +1790,7 @@ async function checkWorldInfo(chat, maxContext) {
) {
console.debug(`WI UID:${entry.uid} found. Checking logic: ${entry.selectiveLogic}`);
let hasAnyMatch = false;
+ let hasAllMatch = true;
secondary: for (let keysecondary of entry.keysecondary) {
const secondarySubstituted = substituteParams(keysecondary);
const hasSecondaryMatch = secondarySubstituted && matchKeys(textToScan, secondarySubstituted.trim());
@@ -1798,6 +1800,10 @@ async function checkWorldInfo(chat, maxContext) {
hasAnyMatch = true;
}
+ if (!hasSecondaryMatch) {
+ hasAllMatch = false;
+ }
+
// Simplified AND ANY / NOT ALL if statement. (Proper fix for PR#1356 by Bronya)
// If AND ANY logic and the main checks pass OR if NOT ALL logic and the main checks do not pass
if ((selectiveLogic === world_info_logic.AND_ANY && hasSecondaryMatch) || (selectiveLogic === world_info_logic.NOT_ALL && !hasSecondaryMatch)) {
@@ -1817,6 +1823,12 @@ async function checkWorldInfo(chat, maxContext) {
console.debug(`(NOT ANY Check) Activating WI Entry ${entry.uid}, no secondary keywords found.`);
activatedNow.add(entry);
}
+
+ // Handle AND ALL logic
+ if (selectiveLogic === world_info_logic.AND_ALL && hasAllMatch) {
+ console.debug(`(AND ALL Check) Activating WI Entry ${entry.uid}, all secondary keywords found.`);
+ activatedNow.add(entry);
+ }
} else {
// Handle cases where secondary is empty
console.debug(`WI UID ${entry.uid}: Activated without filter logic.`);