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 -0Ignore whitespace
public/scripts/openai.js+7 -0
@@ -1938,6 +1938,13 @@ function saveModelList(data) {
1938 }1938 }
1939 });1939 });
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
1941 const selectedModel = model_list.find(model => model.id === oai_settings.google_model);1948 const selectedModel = model_list.find(model => model.id === oai_settings.google_model);
1942 if (model_list.length > 0 && (!selectedModel || !oai_settings.google_model)) {1949 if (model_list.length > 0 && (!selectedModel || !oai_settings.google_model)) {
1943 oai_settings.google_model = model_list[0].id;1950 oai_settings.google_model = model_list[0].id;