From 6a89967144ba0e055b7cd16954dd38b8a04de0fe Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Fri, 18 Aug 2023 21:15:44 +0200 Subject: [PATCH 1/8] Added Roleplay context template and updated instruct preset --- public/context/Roleplay.json | 6 ++++++ public/instruct/Roleplay.json | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 public/context/Roleplay.json 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/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 } From a40df0c1176a7aa28b3071f825c107cc4d0034b1 Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Fri, 18 Aug 2023 21:16:04 +0200 Subject: [PATCH 2/8] Added simple-proxy-for-tavern context template and instruct preset --- public/context/simple-proxy-for-tavern.json | 6 ++++++ public/instruct/simple-proxy-for-tavern.json | 13 +++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 public/context/simple-proxy-for-tavern.json create mode 100644 public/instruct/simple-proxy-for-tavern.json 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/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 +} From 7e5d08874fcaa2302138a6b0e217d57eee1cf517 Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Fri, 18 Aug 2023 21:18:27 +0200 Subject: [PATCH 3/8] Handle last_output_sequence like output_sequence --- public/script.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/script.js b/public/script.js index cbf680924..3238d54b9 100644 --- a/public/script.js +++ b/public/script.js @@ -1834,6 +1834,7 @@ function getStoppingStrings(isImpersonate, addSpace) { if (power_user.instruct.enabled) { addInstructSequence(power_user.instruct.input_sequence); addInstructSequence(power_user.instruct.output_sequence); + addInstructSequence(power_user.instruct.last_output_sequence); } if (power_user.custom_stopping_strings) { @@ -3926,6 +3927,9 @@ function cleanUpMessage(getMessage, isImpersonate, isContinue, displayIncomplete if (isInstruct && power_user.instruct.output_sequence && !isImpersonate) { getMessage = getMessage.replaceAll(power_user.instruct.output_sequence, ''); } + if (isInstruct && power_user.instruct.last_output_sequence && !isImpersonate) { + getMessage = getMessage.replaceAll(power_user.instruct.last_output_sequence, ''); + } // clean-up group message from excessive generations if (selected_group) { getMessage = cleanGroupMessage(getMessage); From 26e2b0c8fab608417e2736d152f782d38cc40962 Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Fri, 18 Aug 2023 21:18:54 +0200 Subject: [PATCH 4/8] Fix whitespace issues --- public/scripts/power-user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 0fab36b0d..1c64d573e 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -1070,8 +1070,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; } @@ -1097,7 +1097,7 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, } const separator = power_user.instruct.wrap ? '\n' : ''; - let text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence); + let text = includeNames ? (separator + sequence + separator + `${name}: `) : (separator + sequence); if (!isImpersonate && promptBias) { text += (includeNames ? promptBias : (separator + promptBias)); From 599a912a5a49b906bd90e63a474eaf878e44e6d5 Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Fri, 18 Aug 2023 23:02:59 +0200 Subject: [PATCH 5/8] deduplicated multi-line stopping strings --- public/script.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/script.js b/public/script.js index 3238d54b9..aef0f9a61 100644 --- a/public/script.js +++ b/public/script.js @@ -1832,9 +1832,13 @@ function getStoppingStrings(isImpersonate, addSpace) { } if (power_user.instruct.enabled) { - addInstructSequence(power_user.instruct.input_sequence); - addInstructSequence(power_user.instruct.output_sequence); - addInstructSequence(power_user.instruct.last_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) { From bcc66de1df14da97123043b2c4d551bdfb7687b1 Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Fri, 18 Aug 2023 23:28:11 +0200 Subject: [PATCH 6/8] multi-line clean-up message --- public/script.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/public/script.js b/public/script.js index aef0f9a61..2a2073a33 100644 --- a/public/script.js +++ b/public/script.js @@ -3926,13 +3926,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, ''); + //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) { From 0a0724255dc6be3c3ee33d5e759b0be811fa47d6 Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Fri, 18 Aug 2023 23:58:03 +0200 Subject: [PATCH 7/8] fix default context --- public/context/Default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": "***" } From 5e9980ea087a906cd2214ed708521ccc8890489e Mon Sep 17 00:00:00 2001 From: Stefan Daniel Schwarz Date: Sat, 19 Aug 2023 12:35:52 +0200 Subject: [PATCH 8/8] no space after name --- public/scripts/power-user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 1c64d573e..d151fe453 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -1097,7 +1097,7 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, } const separator = power_user.instruct.wrap ? '\n' : ''; - let text = includeNames ? (separator + sequence + separator + `${name}: `) : (separator + sequence); + let text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence); if (!isImpersonate && promptBias) { text += (includeNames ? promptBias : (separator + promptBias));