diff --git a/public/context/Default.json b/public/context/Default.json index de41e50de..948de4c91 100644 --- a/public/context/Default.json +++ b/public/context/Default.json @@ -1,6 +1,6 @@ { "name": "Default", - "story_string": "{{#if description}}{{description}}{{/if}}\n{{#if personality}}{{personality}}{{/if}}\n{{#if scenario}}Scenario: {{scenario}}{{/if}}", + "story_string": "{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}{{/if}}", "chat_start": "***", "example_separator": "***" } diff --git a/public/context/Roleplay.json b/public/context/Roleplay.json new file mode 100644 index 000000000..b298ce681 --- /dev/null +++ b/public/context/Roleplay.json @@ -0,0 +1,6 @@ +{ + "name": "Roleplay", + "story_string": "### Input:\n{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}{{/if}}", + "chat_start": "### New Roleplay:", + "example_separator": "### New Roleplay:" +} diff --git a/public/context/simple-proxy-for-tavern.json b/public/context/simple-proxy-for-tavern.json new file mode 100644 index 000000000..7fb3a8e3a --- /dev/null +++ b/public/context/simple-proxy-for-tavern.json @@ -0,0 +1,6 @@ +{ + "name": "simple-proxy-for-tavern", + "story_string": "### Input:\n{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}### Response:\n(OOC) Understood. I will take this info into account for the roleplay. (end OOC)", + "chat_start": "### New Roleplay:", + "example_separator": "### New Roleplay:" +} diff --git a/public/instruct/Roleplay.json b/public/instruct/Roleplay.json index 46c4d4aee..1f985e288 100644 --- a/public/instruct/Roleplay.json +++ b/public/instruct/Roleplay.json @@ -1,13 +1,13 @@ { "input_sequence": "### Instruction:", + "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):", "macro": true, "name": "Roleplay", "names": true, - "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):", "output_sequence": "### Response:", "separator_sequence": "", "stop_sequence": "", - "system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n\nAvoid repetition, don't loop. Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions.\n\n### Input:", + "system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n\nAvoid repetition, don't loop. Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions.", "system_sequence": "", "wrap": true } diff --git a/public/instruct/simple-proxy-for-tavern.json b/public/instruct/simple-proxy-for-tavern.json new file mode 100644 index 000000000..33222fb0a --- /dev/null +++ b/public/instruct/simple-proxy-for-tavern.json @@ -0,0 +1,13 @@ +{ + "input_sequence": "### Instruction:\n#### {{user}}:", + "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):\n#### {{char}}:", + "macro": true, + "name": "simple-proxy-for-tavern", + "names": false, + "output_sequence": "### Response:\n#### {{char}}:", + "separator_sequence": "", + "stop_sequence": "", + "system_prompt": "## {{char}}\n- You're \"{{char}}\" in this never-ending roleplay with \"{{user}}\".", + "system_sequence": "", + "wrap": true +} diff --git a/public/script.js b/public/script.js index 536bfd2e8..a9b46c561 100644 --- a/public/script.js +++ b/public/script.js @@ -1897,8 +1897,13 @@ function getStoppingStrings(isImpersonate, addSpace) { } if (power_user.instruct.enabled) { - addInstructSequence(power_user.instruct.input_sequence); - addInstructSequence(power_user.instruct.output_sequence); + const input_sequence = power_user.instruct.input_sequence; + const output_sequence = power_user.instruct.output_sequence; + const last_output_sequence = power_user.instruct.last_output_sequence; + + const combined_sequence = `${input_sequence}\n${output_sequence}\n${last_output_sequence}`; + + combined_sequence.split('\n').filter((line, index, self) => self.indexOf(line) === index).forEach(addInstructSequence); } if (power_user.custom_stopping_strings) { @@ -3989,10 +3994,28 @@ function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete } } if (isInstruct && power_user.instruct.input_sequence && isImpersonate) { - getMessage = getMessage.replaceAll(power_user.instruct.input_sequence, ''); + //getMessage = getMessage.replaceAll(power_user.instruct.input_sequence, ''); + power_user.instruct.input_sequence.split('\n') + .filter(line => line.trim() !== '') + .forEach(line => { + getMessage = getMessage.replaceAll(line, ''); + }); } if (isInstruct && power_user.instruct.output_sequence && !isImpersonate) { - getMessage = getMessage.replaceAll(power_user.instruct.output_sequence, ''); + //getMessage = getMessage.replaceAll(power_user.instruct.output_sequence, ''); + power_user.instruct.output_sequence.split('\n') + .filter(line => line.trim() !== '') + .forEach(line => { + getMessage = getMessage.replaceAll(line, ''); + }); + } + if (isInstruct && power_user.instruct.last_output_sequence && !isImpersonate) { + //getMessage = getMessage.replaceAll(power_user.instruct.last_output_sequence, ''); + power_user.instruct.last_output_sequence.split('\n') + .filter(line => line.trim() !== '') + .forEach(line => { + getMessage = getMessage.replaceAll(line, ''); + }); } // clean-up group message from excessive generations if (selected_group) { diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 9a696850f..6dd1887cb 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -1066,8 +1066,8 @@ export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvata const separator = power_user.instruct.wrap ? '\n' : ''; const separatorSequence = power_user.instruct.separator_sequence && !isUser ? power_user.instruct.separator_sequence - : (power_user.instruct.wrap ? '\n' : ''); - const textArray = includeNames ? [sequence, `${name}: ${mes}`, separatorSequence] : [sequence, mes, separatorSequence]; + : separator; + const textArray = includeNames ? [sequence, `${name}: ${mes}` + separatorSequence] : [sequence, mes + separatorSequence]; const text = textArray.filter(x => x).join(separator); return text; }