mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-05 20:29:22 +01:00
Fix return type on empty WI
This commit is contained in:
parent
852bc15a94
commit
49d0d9f557
@ -3336,7 +3336,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
continue;
|
||||
}
|
||||
|
||||
let formattedExample = baseChatReplace(exampleMessage, name1, name2)
|
||||
let formattedExample = baseChatReplace(exampleMessage, name1, name2);
|
||||
const cleanedExample = parseMesExamples(formattedExample);
|
||||
|
||||
// Insert depending on before or after position
|
||||
@ -3348,7 +3348,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
}
|
||||
|
||||
// At this point, the raw message examples can be created
|
||||
const mesExamplesRawArray = [...mesExamplesArray]
|
||||
const mesExamplesRawArray = [...mesExamplesArray];
|
||||
|
||||
if (mesExamplesArray && isInstruct) {
|
||||
mesExamplesArray = formatInstructModeExamples(mesExamplesArray, name1, name2);
|
||||
|
@ -340,7 +340,7 @@ const world_info_position = {
|
||||
export const wi_anchor_position = {
|
||||
before: 0,
|
||||
after: 1,
|
||||
}
|
||||
};
|
||||
|
||||
const worldInfoCache = {};
|
||||
|
||||
@ -369,8 +369,8 @@ async function getWorldInfoPrompt(chat, maxContext, isDryRun) {
|
||||
worldInfoString,
|
||||
worldInfoBefore,
|
||||
worldInfoAfter,
|
||||
worldInfoExamples: activatedWorldInfo.EMEntries,
|
||||
worldInfoDepth: activatedWorldInfo.WIDepthEntries,
|
||||
worldInfoExamples: activatedWorldInfo.EMEntries ?? [],
|
||||
worldInfoDepth: activatedWorldInfo.WIDepthEntries ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
@ -2323,7 +2323,7 @@ async function checkWorldInfo(chat, maxContext) {
|
||||
const sortedEntries = await getSortedEntries();
|
||||
|
||||
if (sortedEntries.length === 0) {
|
||||
return { worldInfoBefore: '', worldInfoAfter: '', WIDepthEntries: [], allActivatedEntries: new Set() };
|
||||
return { worldInfoBefore: '', worldInfoAfter: '', WIDepthEntries: [], EMEntries: [], allActivatedEntries: new Set() };
|
||||
}
|
||||
|
||||
while (needsToScan) {
|
||||
@ -2539,12 +2539,12 @@ async function checkWorldInfo(chat, maxContext) {
|
||||
break;
|
||||
case world_info_position.EMTop:
|
||||
EMEntries.unshift(
|
||||
{position: wi_anchor_position.before, content: entry.content}
|
||||
{ position: wi_anchor_position.before, content: entry.content },
|
||||
);
|
||||
break;
|
||||
case world_info_position.EMBottom:
|
||||
EMEntries.unshift(
|
||||
{position: wi_anchor_position.after, content: entry.content}
|
||||
{ position: wi_anchor_position.after, content: entry.content },
|
||||
);
|
||||
break;
|
||||
case world_info_position.ANTop:
|
||||
@ -3155,6 +3155,10 @@ jQuery(() => {
|
||||
});
|
||||
|
||||
$('#world_import_file').on('change', async function (e) {
|
||||
if (!(e.target instanceof HTMLInputElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const file = e.target.files[0];
|
||||
|
||||
await importWorldInfo(file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user