Add names for non-sysprompt example messages

This commit is contained in:
Cohee 2024-03-09 21:10:12 +02:00
parent 26c0886856
commit 2f6ae8d49a
1 changed files with 6 additions and 0 deletions

View File

@ -111,6 +111,12 @@ function convertClaudeMessages(messages, prefillString, useSysPrompt, humanMsgFi
// Now replace all further messages that have the role 'system' with the role 'user'. (or all if we're not using one)
messages.forEach((message) => {
if (message.role === 'system') {
if (userName && message.name === 'example_user') {
message.content = `${userName}: ${message.content}`;
}
if (charName && message.name === 'example_assistant') {
message.content = `${charName}: ${message.content}`;
}
message.role = 'user';
}
});