mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
World Info: Add insertion order at depth (#1174)
Depth previously injected entries randomly. This is not ideal for world info architectures that rely on insertion order to function properly. Redo depth injection to have its own parameter and redo how it's handled in generate. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@ -2002,6 +2002,7 @@ function addPersonaDescriptionExtensionPrompt() {
|
||||
const ANWithDesc = power_user.persona_description_position === persona_description_positions.TOP_AN
|
||||
? `${power_user.persona_description}\n${originalAN}`
|
||||
: `${originalAN}\n${power_user.persona_description}`;
|
||||
|
||||
setExtensionPrompt(NOTE_MODULE_NAME, ANWithDesc, chat_metadata[metadata_keys.position], chat_metadata[metadata_keys.depth]);
|
||||
}
|
||||
}
|
||||
@ -2564,7 +2565,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
// Set non-WI AN
|
||||
setFloatingPrompt();
|
||||
// Add WI to prompt (and also inject WI to AN value via hijack)
|
||||
let { worldInfoString, worldInfoBefore, worldInfoAfter } = await getWorldInfoPrompt(chat2, this_max_context);
|
||||
let { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoDepth } = await getWorldInfoPrompt(chat2, this_max_context);
|
||||
// Add persona description to prompt
|
||||
addPersonaDescriptionExtensionPrompt();
|
||||
// Call combined AN into Generate
|
||||
@ -2589,6 +2590,12 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
|
||||
const storyString = renderStoryString(storyStringParams);
|
||||
|
||||
// Add all depth WI entries to prompt
|
||||
worldInfoDepth.forEach((e) => {
|
||||
const joinedEntries = e.entries.join("\n");
|
||||
setExtensionPrompt(`customDepthWI-${e.depth}`, joinedEntries, 1, e.depth)
|
||||
});
|
||||
|
||||
if (main_api === 'openai') {
|
||||
message_already_generated = '';
|
||||
setOpenAIMessages(coreChat);
|
||||
|
Reference in New Issue
Block a user