Solve the issue where selecting an unofficial Gemini model and then clicking 'Connect' causes the selection to be reset (#4139)

8b5a8914b1bef5732587698ebd8b02a783f2f251

InterestingDarkness <computeridiot999@gmail.com>

Signed
1 files changed, +7 -0Showing whitespace changes
public/scripts/openai.js+7 -0
@@ -1938,6 +1938,13 @@ function saveModelList(data) {
19381938 }
19391939 });
19401940
1941+ // Merge static models into model_list
1942+ staticModels.forEach(modelId => {
1943+ if (!model_list.some(model => model.id === modelId)) {
1944+ model_list.push({ id: modelId });
1945+ }
1946+ });
1947+
19411948 const selectedModel = model_list.find(model => model.id === oai_settings.google_model);
19421949 if (model_list.length > 0 && (!selectedModel || !oai_settings.google_model)) {
19431950 oai_settings.google_model = model_list[0].id;