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:
@@ -226,8 +226,14 @@ pub struct Settings {
|
||||
/// The window's close button (X) hides it to the tray instead of quitting (`app.closeButton`:
|
||||
/// "tray" or "quit", default "quit"; admin.spec.md, "Window and Windows build").
|
||||
pub close_to_tray: bool,
|
||||
/// Where the people Jarvis answers are, by default (`brain.location`, default "대한민국"): the
|
||||
/// brain's location for the time line, weather without a place and searches (admin.spec.md,
|
||||
/// "LLM"); None (an empty value) leaves it to the brain's own detection.
|
||||
pub location: Option<String>,
|
||||
}
|
||||
|
||||
pub const DEFAULT_LOCATION: &str = "대한민국";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct SettingsError(pub String);
|
||||
|
||||
@@ -279,6 +285,7 @@ impl Default for Settings {
|
||||
type_text: Level::Ask, run: Level::Ask,
|
||||
screen_exclude: ["1Password", "Bitwarden", "KeePass", "KeePassXC"].map(String::from).into() },
|
||||
close_to_tray: false,
|
||||
location: Some(DEFAULT_LOCATION.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -632,6 +639,13 @@ pub fn parse_settings(raw: &Value) -> Result<Settings, SettingsError> {
|
||||
"quit" => false,
|
||||
_ => return err("app.closeButton must be tray or quit"),
|
||||
},
|
||||
location: {
|
||||
let l = get_str(section(raw, "brain")?, "location", "brain", DEFAULT_LOCATION)?.trim().to_owned();
|
||||
if l.chars().count() > 100 {
|
||||
return err("brain.location must be at most 100 characters");
|
||||
}
|
||||
(!l.is_empty()).then_some(l)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1006,6 +1020,12 @@ mod tests {
|
||||
#[test]
|
||||
fn the_close_button_choice_is_read_and_checked() {
|
||||
assert!(!parse_settings(&json!({})).unwrap().close_to_tray, "closing quits by default");
|
||||
assert_eq!(parse_settings(&json!({})).unwrap().location.as_deref(), Some(DEFAULT_LOCATION));
|
||||
assert_eq!(parse_settings(&json!({"brain": {"location": " 부산 "}})).unwrap().location.as_deref(), Some("부산"));
|
||||
assert_eq!(parse_settings(&json!({"brain": {"location": " "}})).unwrap().location, None, "empty: the brain detects it");
|
||||
for bad in [json!({"brain": {"location": 1}}), json!({"brain": {"location": "가".repeat(101)}}), json!({"brain": 1})] {
|
||||
assert!(parse_settings(&bad).unwrap_err().0.contains("brain"), "{bad}");
|
||||
}
|
||||
assert!(parse_settings(&json!({"app": {"closeButton": "tray"}})).unwrap().close_to_tray);
|
||||
assert!(!parse_settings(&json!({"app": {"closeButton": "quit"}})).unwrap().close_to_tray);
|
||||
for bad in [json!({"app": {"closeButton": "hide"}}), json!({"app": {"closeButton": 1}}), json!({"app": 1})] {
|
||||
|
||||
Reference in New Issue
Block a user