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, )