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