mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-09 08:38:53 +01:00
Fix macro not being subbed in example separators for instruct
This commit is contained in:
parent
a10cff376b
commit
6d65d47f00
@ -372,7 +372,7 @@ export function formatInstructModeSystemPrompt(systemPrompt) {
|
||||
* @returns {string[]} Formatted example messages string.
|
||||
*/
|
||||
export function formatInstructModeExamples(mesExamplesArray, name1, name2) {
|
||||
const blockHeading = power_user.context.example_separator ? power_user.context.example_separator + '\n' : '';
|
||||
const blockHeading = power_user.context.example_separator ? `${substituteParams(power_user.context.example_separator)}\n` : '';
|
||||
|
||||
if (power_user.instruct.skip_examples) {
|
||||
return mesExamplesArray.map(x => x.replace(/<START>\n/i, blockHeading));
|
||||
|
@ -431,15 +431,15 @@ function convertChatCompletionToInstruct(messages, type) {
|
||||
const exampleMessages = messages.filter(x => x.role === 'system' && (x.name === 'example_user' || x.name === 'example_assistant'));
|
||||
|
||||
if (exampleMessages.length) {
|
||||
examplesText = power_user.context.example_separator + '\n';
|
||||
examplesText += exampleMessages.map(toString).join('\n');
|
||||
examplesText = formatInstructModeExamples(examplesText, name1, name2);
|
||||
const blockHeading = power_user.context.example_separator ? (substituteParams(power_user.context.example_separator) + '\n') : '';
|
||||
const examplesArray = exampleMessages.map(m => '<START>\n' + toString(m));
|
||||
examplesText = blockHeading + formatInstructModeExamples(examplesArray, name1, name2).join('');
|
||||
}
|
||||
|
||||
const chatMessages = messages.slice(firstChatMessage);
|
||||
|
||||
if (chatMessages.length) {
|
||||
chatMessagesText = power_user.context.chat_start + '\n';
|
||||
chatMessagesText = substituteParams(power_user.context.chat_start) + '\n';
|
||||
|
||||
for (const message of chatMessages) {
|
||||
const name = getPrefix(message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user