mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
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:
@@ -961,9 +961,13 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
console.debug(`uid:${entry.uid}: checking logic: ${entry.selectiveLogic}`)
|
console.debug(`uid:${entry.uid}: checking logic: ${entry.selectiveLogic}`)
|
||||||
secondary: for (let keysecondary of entry.keysecondary) {
|
secondary: for (let keysecondary of entry.keysecondary) {
|
||||||
const secondarySubstituted = substituteParams(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
|
//AND operator
|
||||||
if (entry.selectiveLogic === 0) {
|
if (selectiveLogic === 0) {
|
||||||
console.debug('saw AND logic, checking..')
|
console.debug('saw AND logic, checking..')
|
||||||
if (secondarySubstituted && matchKeys(textToScan, secondarySubstituted.trim())) {
|
if (secondarySubstituted && matchKeys(textToScan, secondarySubstituted.trim())) {
|
||||||
console.log(`activating entry ${entry.uid} with AND found`)
|
console.log(`activating entry ${entry.uid} with AND found`)
|
||||||
@@ -972,7 +976,7 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//NOT operator
|
//NOT operator
|
||||||
if (entry.selectiveLogic === 1) {
|
if (selectiveLogic === 1) {
|
||||||
console.debug(`uid ${entry.uid}: checking NOT logic for ${secondarySubstituted}`)
|
console.debug(`uid ${entry.uid}: checking NOT logic for ${secondarySubstituted}`)
|
||||||
if (secondarySubstituted && matchKeys(textToScan, secondarySubstituted.trim())) {
|
if (secondarySubstituted && matchKeys(textToScan, secondarySubstituted.trim())) {
|
||||||
console.debug(`uid ${entry.uid}: canceled; filtered out by ${secondarySubstituted}`)
|
console.debug(`uid ${entry.uid}: canceled; filtered out by ${secondarySubstituted}`)
|
||||||
|
Reference in New Issue
Block a user