Merge branch 'staging' into webpack

This commit is contained in:
Cohee
2024-10-19 13:15:54 +03:00
9 changed files with 66 additions and 18 deletions

View File

@ -1610,6 +1610,33 @@ function saveModelList(data) {
$('#model_blockentropy_select').val(oai_settings.blockentropy_model).trigger('change');
}
if (oai_settings.chat_completion_source == chat_completion_sources.MISTRALAI) {
/** @type {HTMLSelectElement} */
const mistralModelSelect = document.querySelector('#model_mistralai_select');
if (mistralModelSelect) {
const options = Array.from(mistralModelSelect.options);
options.forEach((option) => {
const existingModel = model_list.find(model => model.id === option.value);
if (!existingModel) {
option.remove();
}
});
const otherOptionsGroup = mistralModelSelect.querySelector('#mistralai_other_models');
for (const model of model_list.filter(model => model?.capabilities?.completion_chat)) {
if (!options.some(option => option.value === model.id) && otherOptionsGroup) {
otherOptionsGroup.append(new Option(model.id, model.id));
}
}
const selectedModel = model_list.find(model => model.id === oai_settings.mistralai_model);
if (!selectedModel) {
oai_settings.mistralai_model = model_list.find(model => model?.capabilities?.completion_chat)?.id;
$('#model_mistralai_select').val(oai_settings.mistralai_model).trigger('change');
}
}
}
}
function appendOpenRouterOptions(model_list, groupModels = false, sort = false) {
@ -4103,6 +4130,8 @@ async function onModelChange() {
$('#openai_max_context').attr('max', max_64k);
} else if (oai_settings.mistralai_model.includes('pixtral')) {
$('#openai_max_context').attr('max', max_128k);
} else if (oai_settings.mistralai_model.includes('ministral')) {
$('#openai_max_context').attr('max', max_32k);
} else {
$('#openai_max_context').attr('max', max_32k);
}
@ -4660,6 +4689,8 @@ export function isImageInliningSupported() {
'chatgpt-4o-latest',
'yi-vision',
'pixtral-latest',
'pixtral-12b-latest',
'pixtral-12b',
'pixtral-12b-2409',
];