feat(brain): add Gemini CLI OAuth path for STREAM_BROWSER=false real-time search
Adds a GEMINI_AUTH=oauth (default) sub-mode that shells out to the Gemini CLI using the user's Google-account login instead of an API key. gemini_cli_search() runs `gemini -p <query> -o json --skip-trust --approval-mode yolo`, strips GEMINI_API_KEY/GOOGLE_API_KEY and sets GOOGLE_GENAI_USE_GCA=true so the CLI selects the account OAuth method and fails fast when no login exists. Bounded by a 30s timeout and fail-open to the DDG/Brave/Wikipedia cascade on any failure (CLI missing, login expired, quota 429, timeout). GEMINI_AUTH=apikey keeps the legacy REST path. Specs and docs/llm_contexts.md updated; behaviour covered by tests/test_realtime_gemini_cli.py. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -243,6 +243,10 @@ class Settings:
|
||||
# True -> browser tools drive the on-screen Chrome (visible on the broadcast).
|
||||
# False -> geminiSearch uses the Gemini API (gemini_api_key / gemini_model).
|
||||
stream_browser: bool
|
||||
# "oauth" -> geminiSearch shells out to the Gemini CLI using the user's
|
||||
# Google account login (no API key); built-in web-search grounding.
|
||||
# "apikey" -> legacy REST path using gemini_api_key / gemini_model.
|
||||
gemini_auth: str
|
||||
gemini_api_key: str
|
||||
gemini_model: str
|
||||
# Zero-config Wikipedia fallback toggle. When True (default), the tool
|
||||
@@ -588,6 +592,7 @@ def load_settings() -> Settings:
|
||||
voice_debug = os.environ.get("JARVIS_VOICE_DEBUG", "0") == "1"
|
||||
# Real-time info mode + Gemini account (shared with the bot's .env).
|
||||
stream_browser = os.environ.get("STREAM_BROWSER", "true").strip().lower() not in ("0", "false", "no")
|
||||
gemini_auth = os.environ.get("GEMINI_AUTH", "oauth").strip().lower() or "oauth"
|
||||
gemini_api_key = os.environ.get("GEMINI_API_KEY", "").strip()
|
||||
gemini_model = os.environ.get("GEMINI_MODEL", "").strip() or "gemini-2.0-flash"
|
||||
|
||||
@@ -866,6 +871,7 @@ def load_settings() -> Settings:
|
||||
web_search_enabled=web_search_enabled,
|
||||
brave_search_api_key=brave_search_api_key,
|
||||
stream_browser=stream_browser,
|
||||
gemini_auth=gemini_auth,
|
||||
gemini_api_key=gemini_api_key,
|
||||
gemini_model=gemini_model,
|
||||
wikipedia_fallback_enabled=wikipedia_fallback_enabled,
|
||||
|
||||
Reference in New Issue
Block a user