more last prompt fixes + added an svg

This commit is contained in:
based 2023-12-16 09:44:47 +10:00
parent 65fa333513
commit af059a6af6
2 changed files with 21 additions and 2 deletions

15
public/img/mistralai.svg Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="63.000000pt" height="63.000000pt" viewBox="0 0 63.000000 63.000000"
preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,63.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M40 320 l0 -240 70 0 70 0 0 95 c0 95 0 95 25 95 23 0 25 -3 25 -50
l0 -50 70 0 70 0 0 50 c0 47 2 50 25 50 25 0 25 0 25 -95 l0 -95 70 0 70 0 0
240 0 240 -70 0 -70 0 0 -44 0 -45 -47 -3 -48 -3 -3 -47 c-3 -43 -5 -48 -28
-48 -22 0 -24 4 -24 50 l0 50 -45 0 -45 0 0 45 0 45 -70 0 -70 0 0 -240z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 731 B

View File

@ -407,8 +407,12 @@ async function sendMistralAIRequest(request, response) {
//can't send a system role as the last message.
const messages = Array.isArray(request.body.messages) ? request.body.messages : [];
if (messages.length > 0 && messages[messages.length - 1].role === 'system') {
messages[messages.length - 1].role = 'user';
const lastMsg = messages[messages.length - 1];
if (messages.length > 0 && lastMsg && (lastMsg.role === 'system' || lastMsg.role === 'assistant')) {
lastMsg.role = 'user';
if(lastMsg.role === 'assistant') {
lastMsg.content = lastMsg.name + ': ' + lastMsg.content;
}
}
try {