Rename WI logic ONE => ANY

This commit is contained in:
Cohee 2023-12-05 12:04:27 +02:00
parent ebe0f46f31
commit c9fbe75566
2 changed files with 20 additions and 20 deletions

View File

@ -4071,9 +4071,9 @@
<div class="world_entry_form_control">
<small class="textAlignCenter">Logic</small>
<select name="entryLogicType" class="widthFitContent margin0">
<option value="0">AND ONE</option>
<option value="0">AND ANY</option>
<option value="1">NOT ALL</option>
<option value="2">NOT ONE</option>
<option value="2">NOT ANY</option>
</select>
</div>
<div class="world_entry_form_control keysecondary flex1">
@ -4943,4 +4943,4 @@
</script>
</body>
</html>
</html>

View File

@ -36,9 +36,9 @@ const world_info_insertion_strategy = {
};
const world_info_logic = {
AND_ONE: 0,
AND_ANY: 0,
NOT_ALL: 1,
NOT_ONE: 2,
NOT_ANY: 2,
};
let world_info = {};
@ -849,7 +849,7 @@ function getWorldEntry(name, data, entry) {
const uid = $(this).data('uid');
const value = Number($(this).val());
console.debug(`logic for ${entry.uid} set to ${value}`);
data.entries[uid].selectiveLogic = !isNaN(value) ? value : world_info_logic.AND_ONE;
data.entries[uid].selectiveLogic = !isNaN(value) ? value : world_info_logic.AND_ANY;
setOriginalDataValue(data, uid, 'selectiveLogic', data.entries[uid].selectiveLogic);
saveWorldInfo(name, data);
});
@ -1371,7 +1371,7 @@ const newEntryTemplate = {
content: '',
constant: false,
selective: true,
selectiveLogic: world_info_logic.AND_ONE,
selectiveLogic: world_info_logic.AND_ANY,
addMemo: false,
order: 100,
position: 0,
@ -1791,12 +1791,12 @@ async function checkWorldInfo(chat, maxContext) {
hasAnyMatch = true;
}
// Simplified AND ONE / NOT ALL if statement. (Proper fix for PR#1356 by Bronya)
// If AND ONE logic and the main checks pass OR if NOT ALL logic and the main checks do not pass
if ((selectiveLogic === world_info_logic.AND_ONE && hasSecondaryMatch) || (selectiveLogic === world_info_logic.NOT_ALL && !hasSecondaryMatch)) {
// 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)) {
// Differ both logic statements in the debugger
if (selectiveLogic === world_info_logic.AND_ONE) {
console.debug(`(AND ONE Check) Activating WI Entry ${entry.uid}. Found match for word: ${substituted} ${secondarySubstituted}`);
if (selectiveLogic === world_info_logic.AND_ANY) {
console.debug(`(AND ANY Check) Activating WI Entry ${entry.uid}. Found match for word: ${substituted} ${secondarySubstituted}`);
} else {
console.debug(`(NOT ALL Check) Activating WI Entry ${entry.uid}. Found match for word "${substituted}" without secondary keyword: ${secondarySubstituted}`);
}
@ -1805,9 +1805,9 @@ async function checkWorldInfo(chat, maxContext) {
}
}
// Handle NOT ONE logic
if (selectiveLogic === world_info_logic.NOT_ONE && !hasAnyMatch) {
console.debug(`(NOT ONE Check) Activating WI Entry ${entry.uid}, no secondary keywords found.`);
// Handle NOT ANY logic
if (selectiveLogic === world_info_logic.NOT_ANY && !hasAnyMatch) {
console.debug(`(NOT ANY Check) Activating WI Entry ${entry.uid}, no secondary keywords found.`);
activatedNow.add(entry);
}
// Handle cases where secondary is empty
@ -1974,7 +1974,7 @@ function convertAgnaiMemoryBook(inputObj) {
content: entry.entry,
constant: false,
selective: false,
selectiveLogic: world_info_logic.AND_ONE,
selectiveLogic: world_info_logic.AND_ANY,
order: entry.weight,
position: 0,
disable: !entry.enabled,
@ -2002,7 +2002,7 @@ function convertRisuLorebook(inputObj) {
content: entry.content,
constant: entry.alwaysActive,
selective: entry.selective,
selectiveLogic: world_info_logic.AND_ONE,
selectiveLogic: world_info_logic.AND_ANY,
order: entry.insertorder,
position: world_info_position.before,
disable: false,
@ -2035,7 +2035,7 @@ function convertNovelLorebook(inputObj) {
content: entry.text,
constant: false,
selective: false,
selectiveLogic: world_info_logic.AND_ONE,
selectiveLogic: world_info_logic.AND_ANY,
order: entry.contextConfig?.budgetPriority ?? 0,
position: 0,
disable: !entry.enabled,
@ -2077,7 +2077,7 @@ function convertCharacterBook(characterBook) {
probability: entry.extensions?.probability ?? null,
useProbability: entry.extensions?.useProbability ?? false,
depth: entry.extensions?.depth ?? DEFAULT_DEPTH,
selectiveLogic: entry.extensions?.selectiveLogic ?? world_info_logic.AND_ONE,
selectiveLogic: entry.extensions?.selectiveLogic ?? world_info_logic.AND_ANY,
group: entry.extensions?.group ?? '',
};
});
@ -2486,4 +2486,4 @@ jQuery(() => {
closeOnSelect: false,
});
}
});
});