[FEATURE_REQUEST] Option to toggle disable instruct formatting for example dialogue insertion #1881

This commit is contained in:
Cohee 2024-03-03 19:12:20 +02:00
parent 6ea2cf2abe
commit b9392893dc
2 changed files with 13 additions and 0 deletions

View File

@ -2756,6 +2756,10 @@
<input id="instruct_macro" type="checkbox" />
<span data-i18n="Replace Macro in Sequences">Replace Macro in Sequences</span>
</label>
<label for="instruct_skip_examples" class="checkbox_label">
<input id="instruct_skip_examples" type="checkbox" />
<span data-i18n="Skip Example Dialogues Formatting">Skip Example Dialogues Formatting</span>
</label>
<label for="instruct_names" class="checkbox_label">
<input id="instruct_names" type="checkbox" />
<span data-i18n="Include Names">Include Names</span>

View File

@ -30,6 +30,7 @@ const controls = [
{ id: 'instruct_last_output_sequence', property: 'last_output_sequence', isCheckbox: false },
{ id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
{ id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },
{ id: 'instruct_skip_examples', property: 'skip_examples', isCheckbox: true },
];
/**
@ -45,6 +46,10 @@ export function loadInstructMode(data) {
power_user.instruct.names_force_groups = true;
}
if (power_user.instruct.skip_examples === undefined) {
power_user.instruct.skip_examples = false;
}
controls.forEach(control => {
const $element = $(`#${control.id}`);
@ -302,6 +307,10 @@ export function formatInstructModeSystemPrompt(systemPrompt){
* @returns {string} Formatted example messages string.
*/
export function formatInstructModeExamples(mesExamples, name1, name2) {
if (power_user.instruct.skip_examples) {
return mesExamples;
}
const includeNames = power_user.instruct.names || (!!selected_group && power_user.instruct.names_force_groups);
let inputSequence = power_user.instruct.input_sequence;