Replace {{name}} macros in instruct suffixes

This commit is contained in:
Cohee 2024-07-13 00:16:31 +03:00
parent 2232a4fbd7
commit 974f142f24

View File

@ -333,6 +333,9 @@ export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvata
if (power_user.instruct.macro) { if (power_user.instruct.macro) {
prefix = substituteParams(prefix, name1, name2); prefix = substituteParams(prefix, name1, name2);
prefix = prefix.replace(/{{name}}/gi, name || 'System'); prefix = prefix.replace(/{{name}}/gi, name || 'System');
suffix = substituteParams(suffix, name1, name2);
suffix = suffix.replace(/{{name}}/gi, name || 'System');
} }
if (!suffix && power_user.instruct.wrap) { if (!suffix && power_user.instruct.wrap) {
@ -398,6 +401,8 @@ export function formatInstructModeExamples(mesExamplesArray, name1, name2) {
inputPrefix = inputPrefix.replace(/{{name}}/gi, name1); inputPrefix = inputPrefix.replace(/{{name}}/gi, name1);
outputPrefix = outputPrefix.replace(/{{name}}/gi, name2); outputPrefix = outputPrefix.replace(/{{name}}/gi, name2);
inputSuffix = inputSuffix.replace(/{{name}}/gi, name1);
outputSuffix = outputSuffix.replace(/{{name}}/gi, name2);
if (!inputSuffix && power_user.instruct.wrap) { if (!inputSuffix && power_user.instruct.wrap) {
inputSuffix = '\n'; inputSuffix = '\n';