UNRELATED: this never happened.
This commit is contained in:
parent
be5d428706
commit
cc27bcb076
|
@ -410,12 +410,12 @@ async function sendMistralAIRequest(request, response) {
|
||||||
const messages = Array.isArray(request.body.messages) ? request.body.messages : [];
|
const messages = Array.isArray(request.body.messages) ? request.body.messages : [];
|
||||||
const lastMsg = messages[messages.length - 1];
|
const lastMsg = messages[messages.length - 1];
|
||||||
if (messages.length > 0 && lastMsg && (lastMsg.role === 'system' || lastMsg.role === 'assistant')) {
|
if (messages.length > 0 && lastMsg && (lastMsg.role === 'system' || lastMsg.role === 'assistant')) {
|
||||||
lastMsg.role = 'user';
|
|
||||||
if (lastMsg.role === 'assistant') {
|
if (lastMsg.role === 'assistant') {
|
||||||
lastMsg.content = lastMsg.name + ': ' + lastMsg.content;
|
lastMsg.content = lastMsg.name + ': ' + lastMsg.content;
|
||||||
} else if (lastMsg.role === 'system') {
|
} else if (lastMsg.role === 'system') {
|
||||||
lastMsg.content = '[INST] ' + lastMsg.content + ' [/INST]';
|
lastMsg.content = '[INST] ' + lastMsg.content + ' [/INST]';
|
||||||
}
|
}
|
||||||
|
lastMsg.role = 'user';
|
||||||
}
|
}
|
||||||
|
|
||||||
//system prompts can be stacked at the start, but any futher sys prompts after the first user/assistant message will break the model
|
//system prompts can be stacked at the start, but any futher sys prompts after the first user/assistant message will break the model
|
||||||
|
|
Loading…
Reference in New Issue