Merge branch 'staging' into wi-regex-keys

This commit is contained in:
Wolfsblvt
2024-05-09 22:54:27 +02:00
2 changed files with 14 additions and 14 deletions

View File

@ -2581,7 +2581,6 @@ async function checkWorldInfo(chat, maxContext) {
}
if (entry.constant || buffer.isExternallyActivated(entry)) {
entry.content = substituteParams(entry.content);
activatedNow.add(entry);
continue;
}
@ -2674,7 +2673,9 @@ async function checkWorldInfo(chat, maxContext) {
continue;
} else { console.debug(`uid:${entry.uid} passed probability check, inserting to prompt`); }
newContent += `${substituteParams(entry.content)}\n`;
// Substitute macros inline, for both this checking and also future processing
entry.content = substituteParams(entry.content);
newContent += `${entry.content}\n`;
if ((textToScanTokens + (await getTokenCountAsync(newContent))) >= budget) {
console.debug('WI budget reached, stopping');
@ -2707,7 +2708,7 @@ async function checkWorldInfo(chat, maxContext) {
const text = newEntries
.filter(x => !failedProbabilityChecks.has(x))
.filter(x => !x.preventRecursion)
.map(x => substituteParams(x.content)).join('\n');
.map(x => x.content).join('\n');
buffer.addRecurse(text);
allActivatedText = (text + '\n' + allActivatedText);
}
@ -2742,6 +2743,11 @@ async function checkWorldInfo(chat, maxContext) {
const regexDepth = entry.position === world_info_position.atDepth ? (entry.depth ?? DEFAULT_DEPTH) : null;
const content = getRegexedString(entry.content, regex_placement.WORLD_INFO, { depth: regexDepth, isMarkdown: false, isPrompt: true });
if (!content) {
console.debug('Skipping adding WI entry to prompt due to empty content:', entry);
return;
}
switch (entry.position) {
case world_info_position.before:
WIBeforeEntries.unshift(substituteParams(content));