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:
@@ -253,6 +253,28 @@ class TestWeatherTool:
|
||||
# Verify location detection was called (fallback was attempted)
|
||||
mock_location.assert_called_once()
|
||||
|
||||
@patch('requests.get')
|
||||
@patch('src.jarvis.tools.builtin.weather.get_location_info')
|
||||
def test_without_a_place_the_place_set_in_the_settings_is_used(self, mock_location, mock_get):
|
||||
"""Live 2026-11-16: detection failed on the game PC and "날씨 어때" got "tell me the city";
|
||||
the place set in the settings (brain.location, default 대한민국) is the answer instead."""
|
||||
self.context.cfg.location_name = "South Korea"
|
||||
geo = Mock(raise_for_status=Mock())
|
||||
geo.json.return_value = {"results": [{"latitude": 36.5, "longitude": 127.75, "name": "South Korea",
|
||||
"country": "South Korea"}]}
|
||||
weather = Mock(raise_for_status=Mock())
|
||||
weather.json.return_value = {"current": {"temperature_2m": 12.0, "apparent_temperature": 12.0,
|
||||
"weather_code": 0}}
|
||||
mock_get.side_effect = [geo, weather]
|
||||
result = self.tool.run({}, self.context)
|
||||
assert result.success, result.reply_text
|
||||
assert mock_get.call_args_list[0].kwargs["params"]["name"] == "South Korea"
|
||||
mock_location.assert_not_called()
|
||||
# A place the person asked about still wins over the set one.
|
||||
mock_get.side_effect = [geo, weather]
|
||||
self.tool.run({"location": "Busan"}, self.context)
|
||||
assert mock_get.call_args_list[2].kwargs["params"]["name"] == "Busan"
|
||||
|
||||
@patch('src.jarvis.tools.builtin.weather.get_location_info')
|
||||
def test_run_no_args_uses_fallback(self, mock_location):
|
||||
"""Test weather with no arguments uses user's detected location as fallback."""
|
||||
|
||||
Reference in New Issue
Block a user