feat(app): place the LLM's experts so the speech-to-text worker keeps its room

- with an NVIDIA card the app sets --expert-vram itself by the M0 kit's formula: what the card
  holds before the start, the model without experts, the STT worker's share (2740 MiB), the
  engine's margin (768 MiB) and room for programs opened later (game.otherRoomGb, default 1 GB)
  are left free; Strata's own placement filled the card and left the STT no room
- the model without experts is measured once per context and card (a start with
  expert-vram=0, one short answer, the card's memory and the engine log's staging), kept in
  config/llm-probe.json; the real start replaces that server
- placement.rs also works out the game placement (the reserve, else the 2 GiB minimum and the
  room a game really gets, else pause) for the switching that comes next
- with the game PC's M0 numbers the normal placement comes out at 1.5 GiB, as M0 measured

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-14 09:53:20 +09:00
parent 7e83b09dd5
commit af6f2c855d
9 changed files with 333 additions and 21 deletions

View File

@@ -102,11 +102,19 @@ pub struct FeatureSettings {
/// Game detection (admin.spec.md, "Game detection"): on by default; the person's own games and
/// programs that are never games, as program file names (".exe" may be left out).
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq)]
pub struct GameSettings {
pub detect: bool,
pub games: Vec<String>,
pub not_games: Vec<String>,
/// Graphics memory the normal placement leaves for programs opened later (GB, default 1).
pub other_room_gb: f64,
}
impl GameSettings {
pub fn other_room_mib(&self) -> i64 {
(self.other_room_gb * 1024.0).round() as i64
}
}
/// Background collection (admin.spec.md, "Background collection"); no targets by default.
@@ -202,7 +210,7 @@ impl Default for Settings {
features: FeatureSettings { weather: true, web_search: true, meals: true, collect: true, browser: true, browser_share: false },
mcp_servers: vec![],
collect: CollectSettings { keep_days: 30, targets: vec![] },
game: GameSettings { detect: true, games: vec![], not_games: vec![] },
game: GameSettings { detect: true, games: vec![], not_games: vec![], other_room_gb: 1.0 },
}
}
}
@@ -563,8 +571,15 @@ fn parse_game(raw: &Map<String, Value>, d: &GameSettings) -> Result<GameSettings
}
Ok(v)
};
let other_room_gb = match g.and_then(|m| m.get("otherRoomGb")) {
None => d.other_room_gb,
Some(v) => match v.as_f64() {
Some(n) if (0.0..=8.0).contains(&n) => n,
_ => return err("game.otherRoomGb must be a number 0-8 (GB)"),
},
};
Ok(GameSettings { detect: get_bool(g, "detect", "game", d.detect)?, games: list("games", &d.games)?,
not_games: list("notGames", &d.not_games)? })
not_games: list("notGames", &d.not_games)?, other_room_gb })
}
fn parse_collect(raw: &Map<String, Value>, d: &CollectSettings) -> Result<CollectSettings, SettingsError> {
@@ -836,10 +851,11 @@ mod tests {
#[test]
fn game_detection_settings_are_read_and_checked() {
assert_eq!(parse_settings(&json!({})).unwrap().game, GameSettings { detect: true, games: vec![], not_games: vec![] });
let s = parse_settings(&json!({"game": {"detect": false, "games": [" MyGame.exe ", ""], "notGames": ["obs64"]}})).unwrap();
assert_eq!(s.game, GameSettings { detect: false, games: vec!["MyGame.exe".into()], not_games: vec!["obs64".into()] });
for bad in [json!({"game": {"games": ["C:\\x\\a.exe"]}}), json!({"game": {"notGames": "a"}}), json!({"game": {"detect": 1}})] {
assert_eq!(parse_settings(&json!({})).unwrap().game, GameSettings { detect: true, games: vec![], not_games: vec![], other_room_gb: 1.0 });
let s = parse_settings(&json!({"game": {"detect": false, "games": [" MyGame.exe ", ""], "notGames": ["obs64"], "otherRoomGb": 2.5}})).unwrap();
assert_eq!(s.game, GameSettings { detect: false, games: vec!["MyGame.exe".into()], not_games: vec!["obs64".into()], other_room_gb: 2.5 });
assert_eq!(s.game.other_room_mib(), 2560);
for bad in [json!({"game": {"games": ["C:\\x\\a.exe"]}}), json!({"game": {"notGames": "a"}}), json!({"game": {"detect": 1}}), json!({"game": {"otherRoomGb": 9}})] {
assert!(parse_settings(&bad).unwrap_err().0.contains("game."), "{bad}");
}
}