fix: play on YouTube in one step, Korea as the default location, searches in the user's language
- botBrowser `play`: searches YouTube for the words as said, opens the first video (not an ad, without the playlist) and starts it, in one call (an address given opens that page); `type` also takes `query`. Live 0.1.19: the model stopped on YouTube's home page or the results, a retry was refused as a third call, and the answer still said the video played. - `brain.location` (기본 위치, default 대한민국) goes to the brain as `location_name`: the time line says it without GeoIP (no database on the game PC), and getWeather without a place uses it. - Planner and webSearch keep search words in the user's language (never translated into English), so recommendations fit where the user is. Evals (qwen3:8b, 3 runs): play ending on a playing video found with the words as said 0/6 -> 5/6; Korean searches for Korean requests 6/9 -> 8/9. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,3 +111,33 @@ def test_auto_detect_rejects_private_ip_from_opendns():
|
||||
patch("jarvis.utils.location._resolve_public_ip_via_opendns", return_value="192.168.1.1"):
|
||||
result = _get_external_ip_automatically()
|
||||
assert result is None
|
||||
|
||||
|
||||
def test_a_place_set_in_the_settings_is_the_location_and_detection_is_not_tried():
|
||||
"""brain.location (default 대한민국) reaches the brain as location_name: the time line says it,
|
||||
without GeoIP (which has no database on the game PC: "Location: Unknown" before)."""
|
||||
from jarvis.reply import engine
|
||||
with patch.object(engine, "get_location_context_with_timezone") as detect:
|
||||
line = engine._live_time_location_string(types.SimpleNamespace(location_enabled=True, location_name="대한민국"))
|
||||
assert "Location: 대한민국" in line and "Current local time" in line
|
||||
detect.assert_not_called()
|
||||
# Location turned off still wins; no place set means detection as before.
|
||||
off = engine._live_time_location_string(types.SimpleNamespace(location_enabled=False, location_name="대한민국"))
|
||||
assert "Location: Disabled" in off
|
||||
with patch.object(engine, "get_location_context_with_timezone", return_value=("Location: Seoul", None)) as detect:
|
||||
assert "Location: Seoul" in engine._live_time_location_string(types.SimpleNamespace(location_enabled=True, location_name=None))
|
||||
detect.assert_called_once()
|
||||
|
||||
|
||||
def test_the_settings_file_carries_the_place():
|
||||
import json
|
||||
import tempfile
|
||||
from jarvis.config import load_settings
|
||||
with tempfile.NamedTemporaryFile("w", suffix=".json", delete=False) as f:
|
||||
json.dump({"location_name": " 대한민국 "}, f)
|
||||
with patch.dict("os.environ", {"JARVIS_CONFIG_PATH": f.name}):
|
||||
assert load_settings().location_name == "대한민국"
|
||||
with tempfile.NamedTemporaryFile("w", suffix=".json", delete=False) as f:
|
||||
json.dump({"location_name": None}, f)
|
||||
with patch.dict("os.environ", {"JARVIS_CONFIG_PATH": f.name}):
|
||||
assert load_settings().location_name is None
|
||||
|
||||
Reference in New Issue
Block a user