fix(settings): fix Gemini CLI model edit resetting provider fields and not persisting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-10 21:26:55 +08:00
parent 21bbb5492c
commit 3dfa913584

View File

@@ -676,6 +676,7 @@ function patchGeminiConfigText(
if (typeof patch.model === "string") { if (typeof patch.model === "string") {
delete config.model delete config.model
delete config.model_name delete config.model_name
assignOrRemoveEnv(GEMINI_ENV_KEYS.model, patch.model)
} }
assignOrRemoveEnv(GEMINI_ENV_KEYS.baseUrl, patch.apiBaseUrl) assignOrRemoveEnv(GEMINI_ENV_KEYS.baseUrl, patch.apiBaseUrl)
if (typeof patch.apiBaseUrl === "string") { if (typeof patch.apiBaseUrl === "string") {
@@ -800,6 +801,12 @@ function patchGeminiAuthMode(
next.googleApiKey = "" next.googleApiKey = ""
return next return next
} }
if (mode === "model_provider") {
next.googleCloudProject = ""
next.googleCloudLocation = ""
next.googleApplicationCredentials = ""
return next
}
next.apiBaseUrl = "" next.apiBaseUrl = ""
next.geminiApiKey = "" next.geminiApiKey = ""
next.googleApiKey = "" next.googleApiKey = ""