World Info: Add scanning with AN

Add support for adding extension prompts into WI scanning. Doing this
required adding a method to get extension prompts by name. Now, AN
and depth prompts can be added to world info scanning.

However, since scanning just looks for keys in the chatlog, append
the extension prompts on the top of scanned text.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-10-11 23:44:52 -04:00
parent 84098ae933
commit 2c1a6ca67c
4 changed files with 46 additions and 4 deletions

View File

@ -212,6 +212,7 @@ export {
saveChat,
messageFormatting,
getExtensionPrompt,
getExtensionPromptByName,
showSwipeButtons,
hideSwipeButtons,
changeMainAPI,
@ -2069,6 +2070,15 @@ function getAllExtensionPrompts() {
return value.length ? substituteParams(value) : '';
}
// Wrapper to fetch extension prompts by module name
function getExtensionPromptByName(moduleName) {
if (moduleName) {
return substituteParams(extension_prompts[moduleName]?.value);
} else {
return;
}
}
function getExtensionPrompt(position = 0, depth = undefined, separator = "\n") {
let extension_prompt = Object.keys(extension_prompts)
.sort()