feat(app): performance stages move the LLM between the normal and the game placement
- while the services run, game mode decides the stage (perf.rs): a game means the game stage at once (or pause with game.pauseInGame); its end brings the normal stage back after game.revertSeconds (default 30) - a change tells the voice worker the LLM switches (llm switching, with a notice), waits until the brain has written the answers in progress (llm_idle, at most 2 minutes), restarts the LLM in the stage and tells the worker it is ready or paused - the game stage runs at 16K context, one request at a time, half the engine's CPU threads and the game placement (reserve game.reserveGb, default 8, else 2 GiB, else 0 GiB, else pause), measured once at that context; every placement of a run counts other programs' memory as it was when the services started - the voice worker gates every LLM use: on switching new work waits (at most 180 s), the first spoken request that waits hears the notice once under its own id, on ready all go on, on paused nothing is answered - dashboard: "성능 단계: 게임 중 · 게임에 X GB" / 일시정지; game mode screen: game VRAM, revert wait, pause in game Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@ fn a_launcher_game_turns_game_mode_on_until_it_ends() {
|
||||
eprintln!("skipped: set JARVIS_TEST_GAME_EXE");
|
||||
return;
|
||||
};
|
||||
let w = GameWatch::start(GameSettings { detect: true, games: vec![], not_games: vec![], other_room_gb: 1.0 });
|
||||
let w = GameWatch::start(GameSettings { detect: true, games: vec![], not_games: vec![], other_room_gb: 1.0, reserve_gb: 8.0, revert_seconds: 30, pause_in_game: false });
|
||||
assert_eq!(w.view(), serde_json::Value::Null, "no game before it starts");
|
||||
let mut game = std::process::Command::new(&exe).spawn().expect("the game starts");
|
||||
let t0 = Instant::now();
|
||||
|
||||
@@ -414,3 +414,21 @@ async fn a_chat_reply_is_not_spoken_and_its_text_comes_back() {
|
||||
Got::Json(json!({"type": "reply_delivered", "id": "c2", "ok": false}))]);
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn an_llm_switch_is_announced_and_the_client_waits_until_the_brain_is_idle() {
|
||||
let w = FakeWorker::start(0).await;
|
||||
let (c, _rx) = client(&w.url(), json!({}));
|
||||
c.start();
|
||||
c.wait_ready(Duration::from_secs(2)).await.unwrap();
|
||||
assert!(c.llm_state("switching", Some("잠깐만요")));
|
||||
until(|| w.got().iter().any(|g| *g == Got::Json(json!({"type": "llm", "state": "switching", "notice": "잠깐만요"})))).await;
|
||||
// Nothing idle yet: the wait gives up after its time.
|
||||
assert!(!c.wait_llm_idle(Duration::from_millis(100)).await);
|
||||
// The worker reports idle (before or while the app waits): the wait ends.
|
||||
w.send(Message::text(json!({"type": "llm_idle"}).to_string()));
|
||||
assert!(c.wait_llm_idle(Duration::from_secs(2)).await);
|
||||
assert!(c.llm_state("ready", None));
|
||||
until(|| w.got().iter().any(|g| *g == Got::Json(json!({"type": "llm", "state": "ready"})))).await;
|
||||
c.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user