Fix mistral undefined name

This commit is contained in:
Cohee 2024-01-01 18:31:17 +02:00
parent 9106696f2f
commit f53d937782
2 changed files with 2 additions and 2 deletions

View File

@ -2024,7 +2024,7 @@ function formatGenerationTimer(gen_started, gen_finished, tokenCount) {
tokenCount > 0 ? `Token rate: ${Number(tokenCount / seconds).toFixed(1)} t/s` : '',
].join('\n');
if (isNaN(seconds)) {
if (isNaN(seconds) || seconds < 0) {
return { timerValue: '', timerTitle };
}

View File

@ -443,7 +443,7 @@ async function sendMistralAIRequest(request, response) {
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')) {
if (lastMsg.role === 'assistant') {
if (lastMsg.role === 'assistant' && lastMsg.name) {
lastMsg.content = lastMsg.name + ': ' + lastMsg.content;
} else if (lastMsg.role === 'system') {
lastMsg.content = '[INST] ' + lastMsg.content + ' [/INST]';