mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-06 20:58:04 +01:00
world_info_min_activations
This commit is contained in:
parent
d541558f15
commit
8203ebb835
@ -35,6 +35,9 @@ let world_info = {};
|
|||||||
let selected_world_info = [];
|
let selected_world_info = [];
|
||||||
let world_names;
|
let world_names;
|
||||||
let world_info_depth = 2;
|
let world_info_depth = 2;
|
||||||
|
let world_info_min_activations = 0; // if > 0, will continue seeking chat until minimum world infos are activated
|
||||||
|
let world_info_min_activations_depth_max = 20; // used when (world_info_min_activations > 0)
|
||||||
|
|
||||||
let world_info_budget = 25;
|
let world_info_budget = 25;
|
||||||
let world_info_recursive = false;
|
let world_info_recursive = false;
|
||||||
let world_info_overflow_alert = false;
|
let world_info_overflow_alert = false;
|
||||||
@ -1379,6 +1382,7 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
|
|
||||||
// Combine the chat
|
// Combine the chat
|
||||||
let textToScan = chat.slice(0, messagesToLookBack).join("");
|
let textToScan = chat.slice(0, messagesToLookBack).join("");
|
||||||
|
let minActivationMsgIndex = messagesToLookBack; // tracks chat index to satisfy `world_info_min_activations`
|
||||||
|
|
||||||
// Add the depth or AN if enabled
|
// Add the depth or AN if enabled
|
||||||
// Put this code here since otherwise, the chat reference is modified
|
// Put this code here since otherwise, the chat reference is modified
|
||||||
@ -1553,6 +1557,17 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
textToScan = (currentlyActivatedText + '\n' + textToScan);
|
textToScan = (currentlyActivatedText + '\n' + textToScan);
|
||||||
allActivatedText = (currentlyActivatedText + '\n' + allActivatedText);
|
allActivatedText = (currentlyActivatedText + '\n' + allActivatedText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// world_info_min_activations
|
||||||
|
if (!needsToScan) {
|
||||||
|
if (world_info_min_activations > 0 && (allActivatedEntries.size < world_info_min_activations)) {
|
||||||
|
if (minActivationMsgIndex <= world_info_min_activations_depth_max) {
|
||||||
|
needsToScan = true
|
||||||
|
textToScan = transformString(chat.slice(minActivationMsgIndex, minActivationMsgIndex + 1).join(""));
|
||||||
|
minActivationMsgIndex += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forward-sorted list of entries for joining
|
// Forward-sorted list of entries for joining
|
||||||
|
Loading…
x
Reference in New Issue
Block a user