Fix model restoration on load

4babf322c1201d22c1b77207716c5ca1ad41dc2d

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +7 -1Ignore whitespace
public/scripts/openai.js+7 -1
@@ -1652,7 +1652,8 @@ function saveModelList(data) {
1652 }));1652 }));
1653 });1653 });
16541654
1655 if (!oai_settings.nanogpt_model && model_list.length > 0) {1655 const selectedModel = model_list.find(model => model.id === oai_settings.nanogpt_model);
1656 if (model_list.length > 0 && (!selectedModel || !oai_settings.nanogpt_model)) {
1656 oai_settings.nanogpt_model = model_list[0].id;1657 oai_settings.nanogpt_model = model_list[0].id;
1657 }1658 }
16581659
@@ -4010,6 +4011,11 @@ async function onModelChange() {
4010 }4011 }
40114012
4012 if ($(this).is('#model_nanogpt_select')) {4013 if ($(this).is('#model_nanogpt_select')) {
4014 if (!value) {
4015 console.debug('Null NanoGPT model selected. Ignoring.');
4016 return;
4017 }
4018
4013 console.log('NanoGPT model changed to', value);4019 console.log('NanoGPT model changed to', value);
4014 oai_settings.nanogpt_model = value;4020 oai_settings.nanogpt_model = value;
4015 }4021 }