mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add vector storage to WI scanning
This commit is contained in:
@@ -1684,20 +1684,13 @@ async function checkWorldInfo(chat, maxContext) {
|
||||
|
||||
// Add the depth or AN if enabled
|
||||
// Put this code here since otherwise, the chat reference is modified
|
||||
if (extension_settings.note.allowWIScan) {
|
||||
for (const key of Object.keys(context.extensionPrompts)) {
|
||||
if (key.startsWith('DEPTH_PROMPT')) {
|
||||
const depthPrompt = getExtensionPromptByName(key);
|
||||
if (depthPrompt) {
|
||||
textToScan = `${depthPrompt}\n${textToScan}`;
|
||||
}
|
||||
for (const key of Object.keys(context.extensionPrompts)) {
|
||||
if (context.extensionPrompts[key]?.scan) {
|
||||
const prompt = getExtensionPromptByName(key);
|
||||
if (prompt) {
|
||||
textToScan = `${prompt}\n${textToScan}`;
|
||||
}
|
||||
}
|
||||
|
||||
const anPrompt = getExtensionPromptByName(NOTE_MODULE_NAME);
|
||||
if (anPrompt) {
|
||||
textToScan = `${anPrompt}\n${textToScan}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Transform the resulting string
|
||||
@@ -1948,7 +1941,7 @@ async function checkWorldInfo(chat, maxContext) {
|
||||
if (shouldWIAddPrompt) {
|
||||
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
|
||||
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]);
|
||||
context.setExtensionPrompt(NOTE_MODULE_NAME, ANWithWI, chat_metadata[metadata_keys.position], chat_metadata[metadata_keys.depth], extension_settings.note.allowWIScan);
|
||||
}
|
||||
|
||||
return { worldInfoBefore, worldInfoAfter, WIDepthEntries };
|
||||
|
Reference in New Issue
Block a user