Fix model restoration on load

This commit is contained in:
Cohee
2024-10-30 02:09:28 +02:00
parent f5f11eebb2
commit 4babf322c1

View File

@ -1652,7 +1652,8 @@ function saveModelList(data) {
})); }));
}); });
if (!oai_settings.nanogpt_model && model_list.length > 0) { const selectedModel = model_list.find(model => model.id === oai_settings.nanogpt_model);
if (model_list.length > 0 && (!selectedModel || !oai_settings.nanogpt_model)) {
oai_settings.nanogpt_model = model_list[0].id; oai_settings.nanogpt_model = model_list[0].id;
} }
@ -4010,6 +4011,11 @@ async function onModelChange() {
} }
if ($(this).is('#model_nanogpt_select')) { if ($(this).is('#model_nanogpt_select')) {
if (!value) {
console.debug('Null NanoGPT model selected. Ignoring.');
return;
}
console.log('NanoGPT model changed to', value); console.log('NanoGPT model changed to', value);
oai_settings.nanogpt_model = value; oai_settings.nanogpt_model = value;
} }