Merge pull request #1902 from khanonnie/patch-1

Fix Claude 3 inline images when "Add Character Names" setting is enabled
This commit is contained in:
Cohee 2024-03-06 21:43:00 +02:00 committed by GitHub
commit 8be17251fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,7 +151,11 @@ function convertClaudeMessages(messages, prefillString, useSysPrompt, humanMsgFi
// Take care of name properties since claude messages don't support them
mergedMessages.forEach((message) => {
if (message.name) {
message.content = `${message.name}: ${message.content}`;
if (Array.isArray(message.content)) {
message.content[0].text = `${message.name}: ${message.content[0].text}`;
} else {
message.content = `${message.name}: ${message.content}`;
}
delete message.name;
}
});