fix: drop webSearch when a site is named in screen-share, forcing controlBrowser

The 3B model kept choosing webSearch over controlBrowser even when offered, so
'네이버에서 X 검색' still used the invisible web path. When broadcasting and the
user explicitly names a site, remove webSearch from the allow-list so the
on-screen browser is the only search route.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-06-14 02:57:51 +09:00
parent f3d34bab4d
commit 642fa42561

View File

@@ -1045,6 +1045,19 @@ def run_reply_engine(db: "Database", cfg, tts: Optional[Any],
for _bt in ("controlBrowser", "browseAndPlay"):
if _bt in _full_catalog_names and _bt not in routed_tools:
routed_tools = routed_tools + [_bt]
# When the user explicitly names a website (a proper noun, not a language
# pattern), the on-screen browser is unambiguously what they want — but
# the small router reflexively keeps webSearch and the model picks the
# invisible web path. Drop webSearch for that turn so controlBrowser
# wins. Only fires when a site is named AND we're in screen-share mode.
_site_tokens = (
"naver", "네이버", "google", "구글", "daum", "다음",
"youtube", "유튜브", "유투브", "bing",
)
if "controlBrowser" in routed_tools and "webSearch" in routed_tools \
and any(_tok in redacted.lower() for _tok in _site_tokens):
routed_tools = [t for t in routed_tools if t != "webSearch"]
debug_log("screen-share: site named — dropping webSearch so controlBrowser wins", "tools")
_planner_schema = generate_tools_json_schema(routed_tools, mcp_tools)
_planner_tool_catalog: list[tuple[str, str]] = []