Solve the issue where selecting an unofficial Gemini model and then clicking 'Connect' causes the selection to be reset (#4139)
Signed| @@ -1938,6 +1938,13 @@ function saveModelList(data) { | ||
| 1938 | 1938 | } |
| 1939 | 1939 | }); |
| 1940 | 1940 | |
| 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 | 1948 | const selectedModel = model_list.find(model => model.id === oai_settings.google_model); |
| 1942 | 1949 | if (model_list.length > 0 && (!selectedModel || !oai_settings.google_model)) { |
| 1943 | 1950 | oai_settings.google_model = model_list[0].id; |