Fix mistral undefined name
This commit is contained in:
parent
9106696f2f
commit
f53d937782
|
@ -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 };
|
||||
}
|
||||
|
||||
|
|
|
@ -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]';
|
||||
|
|
Loading…
Reference in New Issue