From bdb012fc7c18763cbebf0e550d00b86db8f521ff Mon Sep 17 00:00:00 2001 From: javis-bot Date: Mon, 15 Jun 2026 01:02:35 +0900 Subject: [PATCH] fix: weather passes named city from utterance; clean navigate reply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GeoIP auto-detect is unavailable in the container, so '부산 날씨' failed (no location). Extract the city from the utterance and pass it to getWeather. Also report navigate by site name instead of the mid-load about:blank url. --- src/jarvis/reply/engine.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/jarvis/reply/engine.py b/src/jarvis/reply/engine.py index db576b9..8301def 100644 --- a/src/jarvis/reply/engine.py +++ b/src/jarvis/reply/engine.py @@ -894,7 +894,9 @@ def _maybe_deterministic_site_search(text: str, db, cfg, language) -> Optional[s if res and getattr(res, "success", False): debug_log(f"deterministic browser: {args}", "tools") if args["action"] == "navigate": - return res.reply_text or f"{site} 메인 페이지로 이동했습니다." + # Don't echo the tool's mid-load url (often about:blank); give a + # clean confirmation by site name. + return f"{site} 메인 페이지로 이동했습니다." return res.reply_text or f"{site}에서 '{q}'를 검색해 화면에 띄웠습니다." except Exception as e: # noqa: BLE001 debug_log(f"deterministic browser failed (fail-open): {e}", "tools") @@ -918,9 +920,21 @@ def _maybe_deterministic_weather(text: str, db, cfg, language) -> Optional[str]: low = (text or "").lower() if not any(w in low for w in _WEATHER_INTENT_WORDS): return None + # Extract a city candidate from the utterance (GeoIP auto-detect is + # unavailable in the container, so a named city must be passed through). + import re + _loc = text + for w in _WEATHER_INTENT_WORDS + ( + "알려줘", "어때", "어떄", "말해줘", "확인해줘", "확인", "해줘", + "오늘", "지금", "현재", "좀", "그래서", "그럼", + ): + _loc = re.sub(re.escape(w), " ", _loc, flags=re.IGNORECASE) + _loc = re.sub(r"(은|는|이|가|의|에|에서|로|을|를)\b", " ", _loc) + _loc = re.sub(r"\s+", " ", _loc).strip(" .,!?。") + args = {"location": _loc} if 1 <= len(_loc) <= 12 else {} from ..tools.registry import run_tool_with_retries res = run_tool_with_retries( - db=db, cfg=cfg, tool_name="getWeather", tool_args={}, + db=db, cfg=cfg, tool_name="getWeather", tool_args=args, system_prompt="", original_prompt="", redacted_text=redact(text), max_retries=1, language=language, )