refactor(search): remove the Gemini search backend
The user asked to drop it: nobody had the Gemini CLI login or a key set up, and Exa then Wikipedia cover the voice use. webSearch is now live Chrome, Exa, Brave (opt-in), Wikipedia. Removes the CLI/REST backends, the GEMINI_* settings, the Docker login mount and checks, and updates the specs and docs/llm_contexts.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ Routing contract (docs/stream_browser_modes.md, web_search.spec.md):
|
||||
True False Exa
|
||||
False True/None Exa (broadcast disabled, never Chrome)
|
||||
|
||||
Gemini only runs when Exa found nothing, and the CLI only with a Google login.
|
||||
When Exa finds nothing the chain goes on to Brave (opt-in) and Wikipedia.
|
||||
"""
|
||||
|
||||
from types import SimpleNamespace
|
||||
@@ -30,10 +30,7 @@ def _ctx(stream_browser, broadcasting):
|
||||
cfg = SimpleNamespace(
|
||||
web_search_enabled=True,
|
||||
stream_browser=stream_browser,
|
||||
gemini_auth="oauth",
|
||||
gemini_api_key="",
|
||||
gemini_model="gemini-2.0-flash",
|
||||
wikipedia_fallback_enabled=False,
|
||||
wikipedia_fallback_enabled=True,
|
||||
)
|
||||
return ToolContext(
|
||||
db=None,
|
||||
@@ -59,11 +56,8 @@ def backends(monkeypatch):
|
||||
return result() if callable(result) else result
|
||||
return call
|
||||
|
||||
state = SimpleNamespace(exa=EXA_HIT, login=True, ran=ran)
|
||||
state = SimpleNamespace(exa=EXA_HIT, ran=ran)
|
||||
monkeypatch.setattr(rs, "browser_search", fake("browser", "BROWSER_RESULT"))
|
||||
monkeypatch.setattr(rs, "gemini_cli_search", fake("gemini", "GEMINI_RESULT"))
|
||||
monkeypatch.setattr(rs, "gemini_search", fake("gemini", "GEMINI_RESULT"))
|
||||
monkeypatch.setattr(rs, "gemini_oauth_ready", lambda: state.login)
|
||||
monkeypatch.setattr(ws, "_exa_search", fake("exa", lambda: state.exa))
|
||||
monkeypatch.setattr(ws, "_wikipedia_summary", fake("wikipedia", None))
|
||||
return state
|
||||
@@ -73,8 +67,6 @@ def _route(stream_browser, broadcasting, query="현재 서울 날씨"):
|
||||
res = WebSearchTool().run({"search_query": query}, _ctx(stream_browser, broadcasting))
|
||||
if res.reply_text == "BROWSER_RESULT":
|
||||
return "browser"
|
||||
if res.reply_text == "GEMINI_RESULT":
|
||||
return "gemini"
|
||||
if "EXA_TEXT" in res.reply_text:
|
||||
return "exa"
|
||||
return "fallthrough"
|
||||
@@ -110,23 +102,16 @@ def test_browser_failure_while_live_falls_through_to_exa(backends, monkeypatch):
|
||||
assert _route(True, True) == "exa"
|
||||
|
||||
|
||||
def test_exa_results_mean_gemini_never_runs(backends):
|
||||
def test_exa_results_stop_the_chain(backends):
|
||||
assert _route(False, None) == "exa"
|
||||
assert "gemini" not in backends.ran
|
||||
assert backends.ran == ["exa"]
|
||||
|
||||
|
||||
def test_exa_empty_with_login_uses_gemini_cli(backends):
|
||||
def test_exa_empty_goes_straight_to_wikipedia(backends):
|
||||
# No Brave key: after Exa the only provider left is Wikipedia.
|
||||
backends.exa = []
|
||||
assert _route(False, None) == "gemini"
|
||||
assert backends.ran == ["exa", "gemini"]
|
||||
|
||||
|
||||
def test_exa_empty_without_login_never_starts_gemini_cli(backends):
|
||||
# No Google login: the CLI would only fail, so it is not started at all.
|
||||
backends.exa = []
|
||||
backends.login = False
|
||||
assert _route(False, None) == "fallthrough"
|
||||
assert "gemini" not in backends.ran
|
||||
assert backends.ran == ["exa", "wikipedia"]
|
||||
|
||||
|
||||
def test_a_query_given_as_query_instead_of_search_query_still_searches(backends, monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user