From c08b897d4a6a77c54a7e8d2e705e2048ab4797ba Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Wed, 21 Aug 2024 23:50:09 -0400 Subject: [PATCH] fix(puterai): adapt message role for claude --- src/backend/src/modules/puterai/ClaudeService.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/src/modules/puterai/ClaudeService.js b/src/backend/src/modules/puterai/ClaudeService.js index a0382db9..473ecd83 100644 --- a/src/backend/src/modules/puterai/ClaudeService.js +++ b/src/backend/src/modules/puterai/ClaudeService.js @@ -41,6 +41,7 @@ class ClaudeService extends BaseService { if ( whatis(message.content) !== 'array' ) { message.content = [message.content]; } + if ( ! message.role ) message.role = 'user'; if ( message.role === 'user' && previous_was_user ) { const last_msg = adapted_messages[adapted_messages.length-1]; last_msg.content.push(