remove empty lines from WIs

This commit is contained in:
steve green 2024-05-09 08:28:33 +08:00 committed by steve02081504
parent 0587931cae
commit ff1399d1ba

View File

@ -2575,12 +2575,15 @@ async function checkWorldInfo(chat, maxContext) {
}
});
const worldInfoBefore = WIBeforeEntries.length ? WIBeforeEntries.join('\n') : '';
const worldInfoAfter = WIAfterEntries.length ? WIAfterEntries.join('\n') : '';
//remove entries that are empty
let notempty = (entry) => entry !== ''
const worldInfoBefore = WIBeforeEntries.filter(notempty).join('\n');
const worldInfoAfter = WIAfterEntries.filter(notempty).join('\n');
if (shouldWIAddPrompt) {
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
const ANWithWI = `${ANTopEntries.join('\n')}\n${originalAN}\n${ANBottomEntries.join('\n')}`;
const ANWithWI = `${ANTopEntries.filter(notempty).join('\n')}\n${originalAN}\n${ANBottomEntries.filter(notempty).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]);
}