commit
73886c9fff
|
@ -2531,9 +2531,18 @@
|
|||
<h4 data-i18n="MistralAI Model">MistralAI Model</h4>
|
||||
<select id="model_mistralai_select">
|
||||
<optgroup label="Latest">
|
||||
<option value="mistral-tiny">mistral-tiny</option>
|
||||
<option value="mistral-small">mistral-small</option>
|
||||
<option value="mistral-medium">mistral-medium</option>
|
||||
<option value="open-mistral-7b">open-mistral-7b</option>
|
||||
<option value="open-mixtral-8x7b">open-mixtral-8x7b</option>
|
||||
<option value="mistral-small-latest">mistral-small-latest</option>
|
||||
<option value="mistral-medium-latest">mistral-medium-latest</option>
|
||||
<option value="mistral-large-latest">mistral-large-latest</option>
|
||||
</optgroup>
|
||||
<optgroup label="Sub-versions">
|
||||
<option value="mistral-tiny-2312">mistral-tiny-2312</option>
|
||||
<option value="mistral-small-2312">mistral-small-2312</option>
|
||||
<option value="mistral-small-2402">mistral-small-2402</option>
|
||||
<option value="mistral-medium-2312">mistral-medium-2312</option>
|
||||
<option value="mistral-large-2402">mistral-large-2402</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -216,7 +216,7 @@ const default_settings = {
|
|||
claude_model: 'claude-instant-v1',
|
||||
google_model: 'gemini-pro',
|
||||
ai21_model: 'j2-ultra',
|
||||
mistralai_model: 'mistral-medium',
|
||||
mistralai_model: 'mistral-medium-latest',
|
||||
custom_model: '',
|
||||
custom_url: '',
|
||||
custom_include_body: '',
|
||||
|
@ -285,7 +285,7 @@ const oai_settings = {
|
|||
claude_model: 'claude-instant-v1',
|
||||
google_model: 'gemini-pro',
|
||||
ai21_model: 'j2-ultra',
|
||||
mistralai_model: 'mistral-medium',
|
||||
mistralai_model: 'mistral-medium-latest',
|
||||
custom_model: '',
|
||||
custom_url: '',
|
||||
custom_include_body: '',
|
||||
|
@ -3365,8 +3365,16 @@ async function onModelChange() {
|
|||
}
|
||||
|
||||
if ($(this).is('#model_mistralai_select')) {
|
||||
// Upgrade old mistral models to new naming scheme
|
||||
// would have done this in loadOpenAISettings, but it wasn't updating on preset change?
|
||||
if (value === 'mistral-medium' || value === 'mistral-small' || value === 'mistral-tiny') {
|
||||
value = value + '-latest';
|
||||
} else if (value === '') {
|
||||
value = default_settings.mistralai_model;
|
||||
}
|
||||
console.log('MistralAI model changed to', value);
|
||||
oai_settings.mistralai_model = value;
|
||||
$('#model_mistralai_select').val(oai_settings.mistralai_model);
|
||||
}
|
||||
|
||||
if (value && $(this).is('#model_custom_select')) {
|
||||
|
|
|
@ -419,6 +419,9 @@ async function sendMistralAIRequest(request, response) {
|
|||
try {
|
||||
//must send a user role as last message
|
||||
const messages = Array.isArray(request.body.messages) ? request.body.messages : [];
|
||||
//large seems to be throwing a 500 error if we don't make the first message a user role, most likely a bug since the other models won't do this
|
||||
if (request.body.model.includes('large'))
|
||||
messages[0].role = 'user';
|
||||
const lastMsg = messages[messages.length - 1];
|
||||
if (messages.length > 0 && lastMsg && (lastMsg.role === 'system' || lastMsg.role === 'assistant')) {
|
||||
if (lastMsg.role === 'assistant' && lastMsg.name) {
|
||||
|
|
Loading…
Reference in New Issue