mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-12 10:00:36 +01:00
Simplify condition. Add debug log
This commit is contained in:
parent
ff1399d1ba
commit
88aae5978f
@ -2534,6 +2534,11 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
const regexDepth = entry.position === world_info_position.atDepth ? (entry.depth ?? DEFAULT_DEPTH) : null;
|
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 });
|
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) {
|
switch (entry.position) {
|
||||||
case world_info_position.before:
|
case world_info_position.before:
|
||||||
WIBeforeEntries.unshift(substituteParams(content));
|
WIBeforeEntries.unshift(substituteParams(content));
|
||||||
@ -2575,15 +2580,12 @@ async function checkWorldInfo(chat, maxContext) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//remove entries that are empty
|
const worldInfoBefore = WIBeforeEntries.join('\n');
|
||||||
let notempty = (entry) => entry !== ''
|
const worldInfoAfter = WIAfterEntries.join('\n');
|
||||||
|
|
||||||
const worldInfoBefore = WIBeforeEntries.filter(notempty).join('\n');
|
|
||||||
const worldInfoAfter = WIAfterEntries.filter(notempty).join('\n');
|
|
||||||
|
|
||||||
if (shouldWIAddPrompt) {
|
if (shouldWIAddPrompt) {
|
||||||
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
|
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
|
||||||
const ANWithWI = `${ANTopEntries.filter(notempty).join('\n')}\n${originalAN}\n${ANBottomEntries.filter(notempty).join('\n')}`;
|
const ANWithWI = `${ANTopEntries.join('\n')}\n${originalAN}\n${ANBottomEntries.join('\n')}`;
|
||||||
context.setExtensionPrompt(NOTE_MODULE_NAME, ANWithWI, chat_metadata[metadata_keys.position], chat_metadata[metadata_keys.depth], extension_settings.note.allowWIScan, chat_metadata[metadata_keys.role]);
|
context.setExtensionPrompt(NOTE_MODULE_NAME, ANWithWI, chat_metadata[metadata_keys.position], chat_metadata[metadata_keys.depth], extension_settings.note.allowWIScan, chat_metadata[metadata_keys.role]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user