Merge pull request #966 from StefanDanielSchwarz/simple-proxy-for-tavern-replacement

Simple proxy for tavern replacement
This commit is contained in:
Cohee 2023-08-19 14:35:43 +03:00 committed by GitHub
commit 3acd0a590e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 9 deletions

View File

@ -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": "***"
}

View File

@ -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:"
}

View File

@ -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:"
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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) {

View File

@ -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;
}