Merge pull request #1988 from HiroseKoichi/instruct-rework
Fix formats in the Instruct-rework branch
This commit is contained in:
commit
21b6dfac38
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"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}}",
|
||||
"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}}\n\n",
|
||||
"example_separator": "### New Roleplay:",
|
||||
"chat_start": "### New Roleplay:",
|
||||
"use_stop_strings": false,
|
||||
|
@ -9,4 +9,4 @@
|
|||
"include_newline": false,
|
||||
"single_line": false,
|
||||
"name": "Alpaca-Roleplay"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"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}}\n\n",
|
||||
"example_separator": "",
|
||||
"chat_start": "",
|
||||
"use_stop_strings": false,
|
||||
"allow_jailbreak": false,
|
||||
"always_force_name2": true,
|
||||
"trim_sentences": false,
|
||||
"include_newline": false,
|
||||
"single_line": false,
|
||||
"name": "Alpaca"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"story_string": "<|im_start|>system\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}}<|im_end|>",
|
||||
"story_string": "<|im_start|>system\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}}{{trim}}<|im_end|>",
|
||||
"example_separator": "",
|
||||
"chat_start": "",
|
||||
"use_stop_strings": false,
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"story_string": "[INST] <<SYS>>\n{{#if system}}{{system}}\n<</SYS>>\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}}{{trim}} [/INST]",
|
||||
"example_separator": "",
|
||||
"chat_start": "",
|
||||
"use_stop_strings": false,
|
||||
"allow_jailbreak": false,
|
||||
"always_force_name2": true,
|
||||
"trim_sentences": false,
|
||||
"include_newline": false,
|
||||
"single_line": false,
|
||||
"name": "Llama 2 Chat"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"story_string": "[INST] {{#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}}[/INST]",
|
||||
"story_string": "[INST] {{#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}}{{trim}} [/INST]",
|
||||
"example_separator": "Examples:",
|
||||
"chat_start": "",
|
||||
"use_stop_strings": false,
|
||||
|
@ -9,4 +9,4 @@
|
|||
"include_newline": false,
|
||||
"single_line": false,
|
||||
"name": "Mistral"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"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}}",
|
||||
"example_separator": "",
|
||||
"chat_start": "",
|
||||
"use_stop_strings": false,
|
||||
"allow_jailbreak": false,
|
||||
"always_force_name2": true,
|
||||
"trim_sentences": false,
|
||||
"include_newline": false,
|
||||
"single_line": false,
|
||||
"name": "Synthia"
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"system_prompt": "Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions.",
|
||||
"input_sequence": "\n### Instruction:",
|
||||
"output_sequence": "\n### Response:",
|
||||
"last_output_sequence": "\n### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):",
|
||||
"system_sequence": "",
|
||||
"input_sequence": "### Instruction:",
|
||||
"output_sequence": "### Response:",
|
||||
"last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):",
|
||||
"system_sequence": "### Input:",
|
||||
"stop_sequence": "",
|
||||
"wrap": true,
|
||||
"macro": true,
|
||||
|
@ -14,10 +14,10 @@
|
|||
"system_sequence_suffix": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "",
|
||||
"input_suffix": "",
|
||||
"system_suffix": "",
|
||||
"output_suffix": "\n\n",
|
||||
"input_suffix": "\n\n",
|
||||
"system_suffix": "\n\n",
|
||||
"user_alignment_message": "",
|
||||
"system_same_as_user": true,
|
||||
"system_same_as_user": false,
|
||||
"name": "Alpaca-Roleplay"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"input_sequence": "### Instruction:",
|
||||
"output_sequence": "### Response:",
|
||||
"last_output_sequence": "",
|
||||
"system_sequence": "",
|
||||
"system_sequence": "### Input:",
|
||||
"stop_sequence": "",
|
||||
"wrap": true,
|
||||
"macro": true,
|
||||
|
@ -14,10 +14,10 @@
|
|||
"system_sequence_suffix": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "",
|
||||
"input_suffix": "",
|
||||
"system_suffix": "",
|
||||
"output_suffix": "\n\n",
|
||||
"input_suffix": "\n\n",
|
||||
"system_suffix": "\n\n",
|
||||
"user_alignment_message": "",
|
||||
"system_same_as_user": true,
|
||||
"system_same_as_user": false,
|
||||
"name": "Alpaca"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.",
|
||||
"input_sequence": "\n<|im_start|>user\n",
|
||||
"output_sequence": "\n<|im_start|>assistant\n",
|
||||
"input_sequence": "<|im_start|>user",
|
||||
"output_sequence": "<|im_start|>assistant",
|
||||
"last_output_sequence": "",
|
||||
"system_sequence": "\n<|im_start|>system\n",
|
||||
"system_sequence": "<|im_start|>system",
|
||||
"stop_sequence": "<|im_end|>",
|
||||
"wrap": false,
|
||||
"wrap": true,
|
||||
"macro": true,
|
||||
"names": true,
|
||||
"names_force_groups": true,
|
||||
|
@ -14,9 +14,9 @@
|
|||
"system_sequence_suffix": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "<|im_end|>",
|
||||
"input_suffix": "<|im_end|>",
|
||||
"system_suffix": "<|im_end|>",
|
||||
"output_suffix": "<|im_end|>\n",
|
||||
"input_suffix": "<|im_end|>\n",
|
||||
"system_suffix": "<|im_end|>\n",
|
||||
"user_alignment_message": "",
|
||||
"system_same_as_user": false,
|
||||
"name": "ChatML"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||
"input_sequence": "[INST] ",
|
||||
"output_sequence": " ",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "",
|
||||
"system_sequence": "",
|
||||
"stop_sequence": "",
|
||||
|
@ -10,14 +10,14 @@
|
|||
"names": false,
|
||||
"names_force_groups": true,
|
||||
"activation_regex": "",
|
||||
"system_sequence_prefix": "[INST] <<SYS>>\n",
|
||||
"system_sequence_suffix": "\n<</SYS>>\n",
|
||||
"system_sequence_prefix": "",
|
||||
"system_sequence_suffix": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": " ",
|
||||
"input_suffix": " [/INST]",
|
||||
"output_suffix": "\n",
|
||||
"input_suffix": " [/INST]\n",
|
||||
"system_suffix": "",
|
||||
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
|
||||
"system_same_as_user": true,
|
||||
"name": "Llama 2 Chat"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
|
||||
"input_sequence": "[INST] ",
|
||||
"output_sequence": "\n",
|
||||
"output_sequence": "",
|
||||
"last_output_sequence": "",
|
||||
"system_sequence": "",
|
||||
"stop_sequence": "",
|
||||
|
@ -15,9 +15,9 @@
|
|||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "\n",
|
||||
"input_suffix": " [/INST]",
|
||||
"input_suffix": " [/INST]\n",
|
||||
"system_suffix": "",
|
||||
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
|
||||
"system_same_as_user": true,
|
||||
"name": "Mistral"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"system_prompt": "Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation.",
|
||||
"input_sequence": "\nUSER: ",
|
||||
"output_sequence": "\nASSISTANT: ",
|
||||
"input_sequence": "USER: ",
|
||||
"output_sequence": "ASSISTANT: ",
|
||||
"last_output_sequence": "",
|
||||
"system_sequence": "",
|
||||
"system_sequence": "SYSTEM: ",
|
||||
"stop_sequence": "",
|
||||
"wrap": false,
|
||||
"macro": true,
|
||||
|
@ -14,10 +14,10 @@
|
|||
"system_sequence_suffix": "",
|
||||
"first_output_sequence": "",
|
||||
"skip_examples": false,
|
||||
"output_suffix": "",
|
||||
"input_suffix": "",
|
||||
"system_suffix": "",
|
||||
"output_suffix": "\n",
|
||||
"input_suffix": "\n",
|
||||
"system_suffix": "\n",
|
||||
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
|
||||
"system_same_as_user": true,
|
||||
"system_same_as_user": false,
|
||||
"name": "Synthia"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3505,15 +3505,18 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
|||
console.debug('generating prompt');
|
||||
chatString = '';
|
||||
arrMes = arrMes.reverse();
|
||||
arrMes.forEach(function (item, i, arr) {// For added anchors and others
|
||||
arrMes.forEach(function (item, i, arr) {
|
||||
// OAI doesn't need all of this
|
||||
if (main_api === 'openai') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cohee: I'm not even sure what this is for anymore
|
||||
// Cohee: This removes a newline from the end of the last message in the context
|
||||
// Last prompt line will add a newline if it's not a continuation
|
||||
if (i === arrMes.length - 1 && type !== 'continue') {
|
||||
item = item.replace(/\n?$/, '');
|
||||
if (!isInstruct || power_user.instruct.wrap) {
|
||||
item = item.replace(/\n?$/, '');
|
||||
}
|
||||
}
|
||||
|
||||
mesSend[mesSend.length] = { message: item, extensionPrompts: [] };
|
||||
|
|
|
@ -373,7 +373,7 @@ export function formatInstructModeExamples(mesExamplesArray, name1, name2) {
|
|||
|
||||
let inputPrefix = power_user.instruct.input_sequence || '';
|
||||
let outputPrefix = power_user.instruct.output_sequence || '';
|
||||
let inputSuffix = power_user.instruct.output_suffix || '';
|
||||
let inputSuffix = power_user.instruct.input_suffix || '';
|
||||
let outputSuffix = power_user.instruct.output_suffix || '';
|
||||
|
||||
if (power_user.instruct.macro) {
|
||||
|
|
|
@ -4,6 +4,9 @@ import { textgenerationwebui_banned_in_macros } from './textgen-settings.js';
|
|||
import { replaceInstructMacros } from './instruct-mode.js';
|
||||
import { replaceVariableMacros } from './variables.js';
|
||||
|
||||
// Register any macro that you want to leave in the compiled story string
|
||||
Handlebars.registerHelper('trim', () => '{{trim}}');
|
||||
|
||||
/**
|
||||
* Returns the ID of the last message in the chat.
|
||||
* @returns {string} The ID of the last message in the chat.
|
||||
|
@ -257,6 +260,7 @@ export function evaluateMacros(content, env) {
|
|||
content = replaceInstructMacros(content);
|
||||
content = replaceVariableMacros(content);
|
||||
content = content.replace(/{{newline}}/gi, '\n');
|
||||
content = content.replace(/\n*{{trim}}\n*/gi, '');
|
||||
content = content.replace(/{{input}}/gi, () => String($('#send_textarea').val()));
|
||||
|
||||
// Substitute passed-in variables
|
||||
|
|
Loading…
Reference in New Issue