mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
[Feature Request] Make "Instruct i/o sequence macro replacing" optional SillyTavern/SillyTavern#546
This commit is contained in:
@@ -1654,6 +1654,10 @@
|
|||||||
<input id="instruct_wrap" type="checkbox" />
|
<input id="instruct_wrap" type="checkbox" />
|
||||||
<span data-i18n="Wrap Sequences with Newline">Wrap Sequences with Newline</span>
|
<span data-i18n="Wrap Sequences with Newline">Wrap Sequences with Newline</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label for="instruct_macro" class="checkbox_label">
|
||||||
|
<input id="instruct_macro" type="checkbox" />
|
||||||
|
<span data-i18n="Replace Macro is Sequences">Replace Macro is Sequences</span>
|
||||||
|
</label>
|
||||||
<label for="instruct_names" class="checkbox_label">
|
<label for="instruct_names" class="checkbox_label">
|
||||||
<input id="instruct_names" type="checkbox" />
|
<input id="instruct_names" type="checkbox" />
|
||||||
<span data-i18n="Include Names">Include Names</span>
|
<span data-i18n="Include Names">Include Names</span>
|
||||||
|
@@ -12,7 +12,6 @@ import {
|
|||||||
eventSource,
|
eventSource,
|
||||||
event_types,
|
event_types,
|
||||||
getCurrentChatId,
|
getCurrentChatId,
|
||||||
is_send_press,
|
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
import { favsToHotswap } from "./RossAscends-mods.js";
|
import { favsToHotswap } from "./RossAscends-mods.js";
|
||||||
import {
|
import {
|
||||||
@@ -151,6 +150,7 @@ let power_user = {
|
|||||||
output_sequence: '### Response:',
|
output_sequence: '### Response:',
|
||||||
preset: 'Alpaca',
|
preset: 'Alpaca',
|
||||||
separator_sequence: '',
|
separator_sequence: '',
|
||||||
|
macro: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
personas: {},
|
personas: {},
|
||||||
@@ -649,6 +649,7 @@ function loadInstructMode() {
|
|||||||
{ id: "instruct_output_sequence", property: "output_sequence", isCheckbox: false },
|
{ id: "instruct_output_sequence", property: "output_sequence", isCheckbox: false },
|
||||||
{ id: "instruct_stop_sequence", property: "stop_sequence", isCheckbox: false },
|
{ id: "instruct_stop_sequence", property: "stop_sequence", isCheckbox: false },
|
||||||
{ id: "instruct_names", property: "names", isCheckbox: true },
|
{ id: "instruct_names", property: "names", isCheckbox: true },
|
||||||
|
{ id: "instruct_macro", property: "macro", isCheckbox: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
controls.forEach(control => {
|
controls.forEach(control => {
|
||||||
@@ -701,11 +702,11 @@ function loadInstructMode() {
|
|||||||
|
|
||||||
export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvatar, name1, name2) {
|
export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvatar, name1, name2) {
|
||||||
const includeNames = isNarrator ? false : (power_user.instruct.names || !!selected_group || !!forceAvatar);
|
const includeNames = isNarrator ? false : (power_user.instruct.names || !!selected_group || !!forceAvatar);
|
||||||
const sequence = substituteParams(
|
let sequence = (isUser || isNarrator) ? power_user.instruct.input_sequence : power_user.instruct.output_sequence;
|
||||||
(isUser || isNarrator) ? power_user.instruct.input_sequence : power_user.instruct.output_sequence,
|
|
||||||
name1,
|
if (power_user.instruct.macro) {
|
||||||
name2
|
sequence = substituteParams(sequence, name1, name2);
|
||||||
);
|
}
|
||||||
|
|
||||||
const separator = power_user.instruct.wrap ? '\n' : '';
|
const separator = power_user.instruct.wrap ? '\n' : '';
|
||||||
const separatorSequence = power_user.instruct.separator_sequence && !isUser
|
const separatorSequence = power_user.instruct.separator_sequence && !isUser
|
||||||
@@ -729,11 +730,11 @@ export function formatInstructStoryString(story, systemPrompt) {
|
|||||||
|
|
||||||
export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2) {
|
export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2) {
|
||||||
const includeNames = power_user.instruct.names || !!selected_group;
|
const includeNames = power_user.instruct.names || !!selected_group;
|
||||||
const sequence = substituteParams(
|
let sequence = isImpersonate ? power_user.instruct.input_sequence : power_user.instruct.output_sequence;
|
||||||
isImpersonate ? power_user.instruct.input_sequence : power_user.instruct.output_sequence,
|
|
||||||
name1,
|
if (power_user.instruct.macro) {
|
||||||
name2
|
sequence = substituteParams(sequence, name1, name2);
|
||||||
);
|
}
|
||||||
|
|
||||||
const separator = power_user.instruct.wrap ? '\n' : '';
|
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);
|
||||||
|
Reference in New Issue
Block a user