Add Last output sequence setting for instruct mode

This commit is contained in:
Cohee 2023-08-17 23:33:27 +03:00
parent e147ad1e18
commit c24f636a10
12 changed files with 35 additions and 15 deletions

View File

@ -2081,18 +2081,26 @@
<div class="flex-container">
<div class="flex1">
<label for="instruct_input_sequence">
<span data-i18n="Input Sequence">Input Sequence</span>
<small data-i18n="Input Sequence">Input Sequence</small>
</label>
<div>
<textarea id="instruct_input_sequence" class="text_pole textarea_compact" type="text" maxlength="500" rows="1"></textarea>
<textarea id="instruct_input_sequence" class="text_pole textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
<div class="flex1">
<label for="instruct_output_sequence">
<span data-i18n="Output Sequence">Output Sequence</span>
<small data-i18n="Output Sequence">Output Sequence</small>
</label>
<div>
<textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact" type="text" maxlength="500" rows="1"></textarea>
<textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
<div class="flex1">
<label for="instruct_last_output_sequence">
<small data-i18n="Last Sequence">Last Sequence</small>
</label>
<div>
<textarea id="instruct_last_output_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
</div>
@ -2102,7 +2110,7 @@
<small data-i18n="System Sequence">System Sequence</small>
</label>
<div>
<textarea id="instruct_system_sequence" class="text_pole textarea_compact" type="text" maxlength="500" rows="1"></textarea>
<textarea id="instruct_system_sequence" class="text_pole textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
<div class="flex1">
@ -2110,7 +2118,7 @@
<small data-i18n="Stop Sequence">Stop Sequence</small>
</label>
<div>
<textarea id="instruct_stop_sequence" class="text_pole wide100p textarea_compact" type="text" maxlength="500" rows="1"></textarea>
<textarea id="instruct_stop_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
<div class="flex1">
@ -2118,7 +2126,7 @@
<small data-i18n="Separator">Separator</small>
</label>
<div>
<textarea id="instruct_separator_sequence" class="text_pole wide100p textarea_compact" type="text" maxlength="500" rows="1"></textarea>
<textarea id="instruct_separator_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
</div>
@ -2134,7 +2142,6 @@
</div>
</div>
<div name="ContextFormatting" class="flex1">
<h4><span data-i18n="Context Formatting">Context Formatting</span></h4>
<div>
<h4><span data-i18n="Tokenizer">Tokenizer</span>
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#tokenizer" class="notes-link" target="_blank">

View File

@ -5,6 +5,7 @@
"stop_sequence": "",
"input_sequence": "### Instruction:",
"output_sequence": "### Response:",
"last_output_sequence": "",
"separator_sequence": "",
"wrap": true
}
}

View File

@ -5,6 +5,7 @@
"stop_sequence": "",
"input_sequence": "USER: ",
"output_sequence": "GPT: ",
"last_output_sequence": "",
"separator_sequence": "</s>",
"wrap": false
}
}

View File

@ -5,6 +5,7 @@
"stop_sequence": "",
"input_sequence": "[INST]",
"output_sequence": "[/INST]",
"last_output_sequence": "",
"separator_sequence": "\n",
"wrap": false
}

View File

@ -5,6 +5,7 @@
"stop_sequence": "</s>",
"input_sequence": "<|user|>",
"output_sequence": "<|model|>",
"last_output_sequence": "",
"separator_sequence": "",
"wrap": false
}

View File

@ -4,6 +4,7 @@
"name": "OpenOrca/OpenChat",
"names": true,
"output_sequence": "<|end_of_turn|>\nAssistant: ",
"last_output_sequence": "",
"separator_sequence": "<|end_of_turn|>\n",
"stop_sequence": "",
"system_prompt": "You are a helpful assistant. Please answer truthfully and write out your thinking step by step to be sure you get the right answer. If you make a mistake or encounter an error in your thinking, say so out loud and attempt to correct it. If you don't know or aren't sure about something, say so clearly. You will act as a professional logician, mathematician, and physicist. You will also act as the most appropriate type of expert to answer any particular question or solve the relevant problem; state which expert type your are, if so. Also think of any particular named expert that would be ideal to answer the relevant question or solve the relevant problem; name and act as them, if appropriate.\n",

View File

@ -3,7 +3,8 @@
"macro": true,
"name": "Roleplay",
"names": true,
"output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):",
"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:",

View File

@ -5,6 +5,7 @@
"stop_sequence": "",
"input_sequence": "### Human:",
"output_sequence": "### Assistant:",
"last_output_sequence": "",
"separator_sequence": "",
"wrap": true
}
}

View File

@ -5,6 +5,7 @@
"stop_sequence": "",
"input_sequence": "USER: ",
"output_sequence": "ASSISTANT: ",
"last_output_sequence": "",
"separator_sequence": "</s>",
"wrap": false
}
}

View File

@ -5,6 +5,7 @@
"stop_sequence": "",
"input_sequence": "USER: ",
"output_sequence": "ASSISTANT: ",
"last_output_sequence": "",
"separator_sequence": "",
"wrap": true
}

View File

@ -5,6 +5,7 @@
"stop_sequence": "",
"input_sequence": "",
"output_sequence": "### Response:",
"last_output_sequence": "",
"separator_sequence": "</s>",
"wrap": true
}
}

View File

@ -176,6 +176,7 @@ let power_user = {
stop_sequence: '',
input_sequence: '### Instruction:',
output_sequence: '### Response:',
last_output_sequence: '',
preset: 'Alpaca',
separator_sequence: '',
macro: false,
@ -942,6 +943,7 @@ function loadInstructMode() {
{ id: "instruct_names", property: "names", isCheckbox: true },
{ id: "instruct_macro", property: "macro", isCheckbox: true },
{ id: "instruct_names_force_groups", property: "names_force_groups", isCheckbox: true },
{ id: "instruct_last_output_sequence", property: "last_output_sequence", isCheckbox: false },
];
if (power_user.instruct.names_force_groups === undefined) {
@ -1087,7 +1089,8 @@ export function formatInstructStoryString(story, systemPrompt) {
export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2) {
const includeNames = power_user.instruct.names || (!!selected_group && power_user.instruct.names_force_groups);
let sequence = isImpersonate ? power_user.instruct.input_sequence : power_user.instruct.output_sequence;
const getOutputSequence = () => power_user.instruct.last_output_sequence || power_user.instruct.output_sequence;
let sequence = isImpersonate ? power_user.instruct.input_sequence : getOutputSequence();
if (power_user.instruct.macro) {
sequence = substituteParams(sequence, name1, name2);