Merge pull request #3908 from cloak1505/staging

Remove last message role restriction for Cohere
This commit is contained in:
Cohee
2025-04-25 13:27:59 +03:00
committed by GitHub

View File

@@ -351,11 +351,6 @@ export function convertCohereMessages(messages, names) {
} }
}); });
// A prompt should end with a user/tool message
if (messages.length && !['user', 'tool'].includes(messages[messages.length - 1].role)) {
messages[messages.length - 1].role = 'user';
}
return { chatHistory: messages }; return { chatHistory: messages };
} }