Code clean-up

This commit is contained in:
Cohee1207 2023-07-21 23:40:53 +03:00
parent 374e931b2e
commit bc6e46bac8
1 changed files with 0 additions and 4 deletions

View File

@ -695,12 +695,10 @@ function saveModelList(data) {
$('#model_openrouter_select').empty(); $('#model_openrouter_select').empty();
$('#model_openrouter_select').append($('<option>', { value: openrouter_website_model, text: 'Use OpenRouter website setting' })); $('#model_openrouter_select').append($('<option>', { value: openrouter_website_model, text: 'Use OpenRouter website setting' }));
model_list.forEach((model) => { model_list.forEach((model) => {
const selected = model.id == oai_settings.openrouter_model;
$('#model_openrouter_select').append( $('#model_openrouter_select').append(
$('<option>', { $('<option>', {
value: model.id, value: model.id,
text: model.id, text: model.id,
selected: selected,
})); }));
}); });
$('#model_openrouter_select').val(oai_settings.openrouter_model).trigger('change'); $('#model_openrouter_select').val(oai_settings.openrouter_model).trigger('change');
@ -709,12 +707,10 @@ function saveModelList(data) {
if (oai_settings.chat_completion_source == chat_completion_sources.OPENAI) { if (oai_settings.chat_completion_source == chat_completion_sources.OPENAI) {
$('#openai_external_category').empty(); $('#openai_external_category').empty();
model_list.forEach((model) => { model_list.forEach((model) => {
const selected = model.id == oai_settings.openai_model && oai_settings.show_external_models;
$('#openai_external_category').append( $('#openai_external_category').append(
$('<option>', { $('<option>', {
value: model.id, value: model.id,
text: model.id, text: model.id,
selected: selected,
})); }));
}); });
// If the selected model is not in the list, revert to default // If the selected model is not in the list, revert to default