Change insertion strategy to an extension block

This commit is contained in:
Cohee
2023-09-08 01:26:26 +03:00
parent 9d45c0a018
commit 96df705409
6 changed files with 51 additions and 54 deletions

View File

@@ -382,10 +382,7 @@ const system_message_types = {
};
const extension_prompt_types = {
/**
* @deprecated Outdated term. In reality it's "after main prompt or story string"
*/
AFTER_SCENARIO: 0,
IN_PROMPT: 0,
IN_CHAT: 1
};
@@ -2533,7 +2530,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
addPersonaDescriptionExtensionPrompt();
// Call combined AN into Generate
let allAnchors = getAllExtensionPrompts();
const afterScenarioAnchor = getExtensionPrompt(extension_prompt_types.AFTER_SCENARIO);
const afterScenarioAnchor = getExtensionPrompt(extension_prompt_types.IN_PROMPT);
let zeroDepthAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, 0, ' ');
const storyStringParams = {
@@ -5591,7 +5588,7 @@ function select_rm_characters() {
* @param {number} position Insertion position. 0 is after story string, 1 is in-chat with custom depth.
* @param {number} depth Insertion depth. 0 represets the last message in context. Expected values up to 100.
*/
function setExtensionPrompt(key, value, position, depth) {
export function setExtensionPrompt(key, value, position, depth) {
extension_prompts[key] = { value: String(value), position: Number(position), depth: Number(depth) };
}