This commit is contained in:
based 2023-12-16 09:45:31 +10:00
parent af059a6af6
commit 47357da20c
1 changed files with 1 additions and 1 deletions

View File

@ -405,7 +405,7 @@ async function sendMistralAIRequest(request, response) {
return response.status(400).send({ error: true });
}
//can't send a system role as the last message.
//must send a user role as last message
const messages = Array.isArray(request.body.messages) ? request.body.messages : [];
const lastMsg = messages[messages.length - 1];
if (messages.length > 0 && lastMsg && (lastMsg.role === 'system' || lastMsg.role === 'assistant')) {