From 4bc7f836ae0be6e305bfde8b227a347d5e90e02c Mon Sep 17 00:00:00 2001 From: javis-bot Date: Sun, 14 Jun 2026 03:08:49 +0900 Subject: [PATCH] fix: native tool-calling for qwen2.5 (tools actually fire) + kill Chrome infobars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause of "weather/search do nothing": the engine forced TEXT tool-calling for all <=7B models, but qwen2.5:3b emits clean NATIVE tool calls and fails at the text format — so it just narrated ("부산 날씨는 맑습니다") and never called getWeather/webSearch/controlBrowser. Use native tool-calling for tool-capable small families (qwen2.5/qwen3/llama3.x/mistral); native still auto-falls back to text on HTTP 400, so non-tool models (gemma) are unaffected. Also launch Chrome with --test-type (removes the "--no-sandbox unsupported flag" infobar) and disable the Translate feature/popup. Co-Authored-By: Claude Opus 4.7 --- docker/run-chrome.sh | 5 +++++ src/jarvis/reply/engine.py | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docker/run-chrome.sh b/docker/run-chrome.sh index d41832b..d1d5e05 100755 --- a/docker/run-chrome.sh +++ b/docker/run-chrome.sh @@ -13,6 +13,11 @@ export DISPLAY=:1 # broadcast-visible Google/YouTube search. Bound to loopback (same container). exec google-chrome \ --no-sandbox --no-first-run --disable-dev-shm-usage \ + --test-type \ + --disable-infobars \ + --no-default-browser-check \ + --disable-translate \ + --disable-features=Translate,TranslateUI,InfoBars \ --remote-debugging-port="${CDP_PORT:-9222}" \ --remote-debugging-address=127.0.0.1 \ --user-data-dir="${CHROME_PROFILE_DIR:-/root/chrome-profile}" \ diff --git a/src/jarvis/reply/engine.py b/src/jarvis/reply/engine.py index 7473dfe..4960846 100644 --- a/src/jarvis/reply/engine.py +++ b/src/jarvis/reply/engine.py @@ -1470,7 +1470,18 @@ def run_reply_engine(db: "Database", cfg, tts: Optional[Any], # can't recognise. The markdown-fence format is explicit in the system prompt, so the # model has a concrete template to follow. Using text tools from the start also avoids # the wasted round-trip and prompt confusion of starting native and falling back mid-turn. - use_text_tools = (model_size == ModelSize.SMALL) + # …BUT some small models emit clean native tool calls (qwen2.5/qwen3, + # llama3.x, mistral). Forcing text tools on those suppresses tool use almost + # entirely — the model just narrates ("부산 날씨는 맑습니다") and never emits a + # call, so getWeather/webSearch/controlBrowser never run. Use native for the + # tool-capable families (native still auto-falls-back to text on HTTP 400); + # only genuinely non-tool small models (e.g. gemma) default to text. + _model_l = (cfg.ollama_chat_model or "").lower() + _native_capable = any(k in _model_l for k in ( + "qwen2.5", "qwen2", "qwen3", "llama3.1", "llama3.2", "llama3.3", + "mistral", "hermes", "command-r", "firefunction", + )) + use_text_tools = (model_size == ModelSize.SMALL) and not _native_capable prompts = get_system_prompts(model_size) debug_log(f"Model size detected: {model_size.value} for {cfg.ollama_chat_model} (use_text_tools={use_text_tools})", "planning")