Move before / after char WI to story strings
This commit is contained in:
parent
dd7b21c63d
commit
1ce848c1c3
|
@ -150,7 +150,7 @@
|
||||||
},
|
},
|
||||||
"context": {
|
"context": {
|
||||||
"preset": "Default",
|
"preset": "Default",
|
||||||
"story_string": "{{#if system}}{{system}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
"story_string": "{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
||||||
"chat_start": "***",
|
"chat_start": "***",
|
||||||
"example_separator": "***"
|
"example_separator": "***"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"story_string": "{{#if system}}{{system}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
"story_string": "{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
||||||
"chat_start": "***",
|
"chat_start": "***",
|
||||||
"example_separator": "***"
|
"example_separator": "***"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Pygmalion",
|
"name": "Pygmalion",
|
||||||
"story_string": "{{#if system}}{{system}}\n{{/if}}{{#if description}}{{{char}}}'s Persona: {{description}}\n{{/if}}{{#if personality}}Personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
"story_string": "{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{{char}}}'s Persona: {{description}}\n{{/if}}{{#if personality}}Personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
||||||
"chat_start": "<START>",
|
"chat_start": "<START>",
|
||||||
"example_separator": "<START>"
|
"example_separator": "<START>"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Roleplay",
|
"name": "Roleplay",
|
||||||
"story_string": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n\n{{#if system}}{{system}}\n\n{{/if}}### Input:\n{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
"story_string": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n\n{{#if system}}{{system}}\n\n{{/if}}### Input:\n{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
|
||||||
"chat_start": "### New Roleplay:",
|
"chat_start": "### New Roleplay:",
|
||||||
"example_separator": "### New Roleplay:"
|
"example_separator": "### New Roleplay:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "simple-proxy-for-tavern",
|
"name": "simple-proxy-for-tavern",
|
||||||
"story_string": "## {{char}}\n- You're \"{{char}}\" in this never-ending roleplay with \"{{user}}\".\n### Input:\n{{#if system}}{{system}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}### Response:\n(OOC) Understood. I will take this info into account for the roleplay. (end OOC)",
|
"story_string": "## {{char}}\n- You're \"{{char}}\" in this never-ending roleplay with \"{{user}}\".\n### Input:\n{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}### Response:\n(OOC) Understood. I will take this info into account for the roleplay. (end OOC)",
|
||||||
"chat_start": "### New Roleplay:",
|
"chat_start": "### New Roleplay:",
|
||||||
"example_separator": "### New Roleplay:"
|
"example_separator": "### New Roleplay:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2001,24 +2001,19 @@ function cleanGroupMessage(getMessage) {
|
||||||
return getMessage;
|
return getMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPersonaDescription(storyString) {
|
function addPersonaDescriptionExtensionPrompt() {
|
||||||
if (!power_user.persona_description) {
|
if (!power_user.persona_description) {
|
||||||
return storyString;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (power_user.persona_description_position) {
|
const promptPositions = [persona_description_positions.BOTTOM_AN, persona_description_positions.TOP_AN];
|
||||||
case persona_description_positions.BEFORE_CHAR:
|
|
||||||
case persona_description_positions.AFTER_CHAR:
|
if (promptPositions.includes(power_user.persona_description_position) && shouldWIAddPrompt) {
|
||||||
return storyString;
|
const originalAN = extension_prompts[NOTE_MODULE_NAME].value
|
||||||
default:
|
const ANWithDesc = power_user.persona_description_position === persona_description_positions.TOP_AN
|
||||||
if (shouldWIAddPrompt) {
|
? `${power_user.persona_description}\n${originalAN}`
|
||||||
const originalAN = extension_prompts[NOTE_MODULE_NAME].value
|
: `${originalAN}\n${power_user.persona_description}`;
|
||||||
const ANWithDesc = power_user.persona_description_position === persona_description_positions.TOP_AN
|
setExtensionPrompt(NOTE_MODULE_NAME, ANWithDesc, chat_metadata[metadata_keys.position], chat_metadata[metadata_keys.depth]);
|
||||||
? `${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]);
|
|
||||||
}
|
|
||||||
return storyString;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2521,18 +2516,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||||
|
|
||||||
console.log(`Core/all messages: ${coreChat.length}/${chat.length}`);
|
console.log(`Core/all messages: ${coreChat.length}/${chat.length}`);
|
||||||
|
|
||||||
const storyStringParams = {
|
|
||||||
description: charDescription,
|
|
||||||
personality: charPersonality,
|
|
||||||
persona: personaDescription,
|
|
||||||
scenario: Scenario,
|
|
||||||
system: isInstruct ? systemPrompt : '',
|
|
||||||
char: name2,
|
|
||||||
user: name1,
|
|
||||||
};
|
|
||||||
|
|
||||||
let storyString = renderStoryString(storyStringParams);
|
|
||||||
|
|
||||||
// kingbri MARK: - Make sure the prompt bias isn't the same as the user bias
|
// kingbri MARK: - Make sure the prompt bias isn't the same as the user bias
|
||||||
if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || is_pygmalion) {
|
if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || is_pygmalion) {
|
||||||
force_name2 = true;
|
force_name2 = true;
|
||||||
|
@ -2578,22 +2561,32 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extension added strings
|
// Extension added strings
|
||||||
|
|
||||||
// Set non-WI AN
|
// Set non-WI AN
|
||||||
setFloatingPrompt();
|
setFloatingPrompt();
|
||||||
// Add WI to prompt (and also inject WI to AN value via hijack)
|
// 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 } = await getWorldInfoPrompt(chat2, this_max_context);
|
||||||
// Add persona description to prompt
|
// Add persona description to prompt
|
||||||
storyString = getPersonaDescription(storyString);
|
addPersonaDescriptionExtensionPrompt();
|
||||||
// Call combined AN into Generate
|
// Call combined AN into Generate
|
||||||
let allAnchors = getAllExtensionPrompts();
|
let allAnchors = getAllExtensionPrompts();
|
||||||
const afterScenarioAnchor = getExtensionPrompt(extension_prompt_types.AFTER_SCENARIO);
|
const afterScenarioAnchor = getExtensionPrompt(extension_prompt_types.AFTER_SCENARIO);
|
||||||
let zeroDepthAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, 0, ' ');
|
let zeroDepthAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, 0, ' ');
|
||||||
|
|
||||||
// Pre-format the World Info into the story string
|
const storyStringParams = {
|
||||||
if (main_api !== 'openai') {
|
description: charDescription,
|
||||||
storyString = worldInfoBefore + storyString + worldInfoAfter;
|
personality: charPersonality,
|
||||||
}
|
persona: personaDescription,
|
||||||
|
scenario: Scenario,
|
||||||
|
system: isInstruct ? systemPrompt : '',
|
||||||
|
char: name2,
|
||||||
|
user: name1,
|
||||||
|
wiBefore: worldInfoBefore,
|
||||||
|
wiAfter: worldInfoAfter,
|
||||||
|
loreBefore: worldInfoBefore,
|
||||||
|
loreAfter: worldInfoAfter,
|
||||||
|
};
|
||||||
|
|
||||||
|
const storyString = renderStoryString(storyStringParams);
|
||||||
|
|
||||||
if (main_api === 'openai') {
|
if (main_api === 'openai') {
|
||||||
message_already_generated = ''; // OpenAI doesn't have multigen
|
message_already_generated = ''; // OpenAI doesn't have multigen
|
||||||
|
|
|
@ -1155,8 +1155,8 @@ async function checkWorldInfo(chat, maxContext) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const worldInfoBefore = WIBeforeEntries.length ? `${WIBeforeEntries.join("\n")}\n` : '';
|
const worldInfoBefore = WIBeforeEntries.length ? WIBeforeEntries.join("\n") : '';
|
||||||
const worldInfoAfter = WIAfterEntries.length ? `${WIAfterEntries.join("\n")}\n` : '';
|
const worldInfoAfter = WIAfterEntries.length ? WIAfterEntries.join("\n") : '';
|
||||||
|
|
||||||
if (shouldWIAddPrompt) {
|
if (shouldWIAddPrompt) {
|
||||||
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
|
const originalAN = context.extensionPrompts[NOTE_MODULE_NAME].value;
|
||||||
|
|
Loading…
Reference in New Issue