fix(gemini): read GEMINI_MODEL from ~/.gemini/.env (#131)

When using gemini backend without --model flag, now automatically
reads GEMINI_MODEL from ~/.gemini/.env file, consistent with how
claude backend reads model from settings.
This commit is contained in:
NieiR
2026-01-23 12:03:50 +08:00
committed by GitHub
parent a21c31fd89
commit 669b1d82ce

View File

@@ -940,6 +940,11 @@ func RunCodexTaskWithContext(parentCtx context.Context, taskSpec TaskSpec, backe
// Load gemini env from ~/.gemini/.env if exists
if cfg.Backend == "gemini" {
fileEnv = loadGeminiEnv()
if cfg.Mode != "resume" && strings.TrimSpace(cfg.Model) == "" {
if model := fileEnv["GEMINI_MODEL"]; model != "" {
cfg.Model = model
}
}
}
useStdin := taskSpec.UseStdin