From a9534542da32187f74e0e907b398ce1032675230 Mon Sep 17 00:00:00 2001 From: uliboooo Date: Mon, 24 Nov 2025 21:17:32 +0900 Subject: [PATCH 1/3] feat: Add Gemini API key fallback --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2596298..4e490e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ use std::{ const ANTHROPIC_API: &str = "GGW_ANTHROPIC_API"; const GEMINI_API: &str = "GGW_GEMINI_API"; +const GEMINI_API_FALL: &str = "GEMINI_API_KEY"; const OPENAI_API: &str = "GGW_OPENAI_API"; const DEEPSEEK: &str = "GGW_DEEPSEEK_API"; @@ -217,7 +218,13 @@ fn resolve_api_key(model: &config::Model) -> Result, Error> { Ok(match prov { llm::Provider::Ollama => None, llm::Provider::OpenAI => Some(env::var(OPENAI_API)), - llm::Provider::Gemini => Some(env::var(GEMINI_API)), + llm::Provider::Gemini => Some(match env::var(GEMINI_API) { + Ok(v) => Ok(v), + Err(_) => match env::var(GEMINI_API_FALL) { + Ok(vv) => Ok(vv), + Err(e) => Err(e), + }, + }), llm::Provider::Anthropic => Some(env::var(ANTHROPIC_API)), llm::Provider::DeepSeek => Some(env::var(DEEPSEEK)), } From c93df15d902005ac0b8c117ec8dfe0c0aa8320d9 Mon Sep 17 00:00:00 2001 From: uliboooo Date: Mon, 24 Nov 2025 21:18:04 +0900 Subject: [PATCH 2/3] fix README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6cbcad1..5babc0a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ cargo install ghost_git_writer - Gemini - `GGW_GEMINI_API` + - `GEMINI_API_KEY` - Anthropic - `GGW_ANTHROPIC_API` - OpenAI From c96f6ee4f9db47a904f20703c59eb9556ee75eda Mon Sep 17 00:00:00 2001 From: uliboooo Date: Mon, 24 Nov 2025 21:18:51 +0900 Subject: [PATCH 3/3] update version info --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f9c81f0..96fbb7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -454,7 +454,7 @@ dependencies = [ [[package]] name = "ghost_git_writer" -version = "0.17.0" +version = "0.18.0" dependencies = [ "atty", "chrono", diff --git a/Cargo.toml b/Cargo.toml index effda1c..fc52748 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ghost_git_writer" description = "write a git commit message, README or Diff Summary by LLM services." -version = "0.17.0" +version = "0.18.0" repository = "https://github.com/Uliboooo/ghost_git_writer" edition = "2024" license = "MIT OR Apache-2.0"