prediction: split out maintenance (and thereby the logging interface) of the UI conversation to a separate task, so log::* can work in realtime.

This commit is contained in:
2026-06-17 22:16:19 +02:00
parent a8a44dae63
commit 89125d2def
5 changed files with 84 additions and 50 deletions
+10 -5
View File
@@ -26,7 +26,8 @@ pub struct Ui {
transcription: TranscriptionControl,
audio: AudioInputControl,
tts: TtsControl,
predictions: SessionControl
predictions: SessionControl,
conversation: Vec<ConversationEntry>
}
#[derive(Debug)]
@@ -51,7 +52,8 @@ impl Ui {
focus_state: FocusState::UserInput,
tts,
predictions,
last_tick: Instant::now()
last_tick: Instant::now(),
conversation: vec![]
}
}
@@ -114,7 +116,7 @@ impl Ui {
.constraints([Constraint::Fill(4), Constraint::Fill(1)])
.split(layout[0]);
frame.render_stateful_widget(Conversation(self.scene.conversation()), scene_layout[0], &mut self.conversation_state);
frame.render_stateful_widget(Conversation(&self.conversation), scene_layout[0], &mut self.conversation_state);
self.draw_narration(frame, scene_layout[1]);
self.draw_options(frame, layout[1]);
@@ -198,7 +200,7 @@ impl Ui {
KeyCode::Up => self.conversation_state.select_next(),
KeyCode::Enter => {
let row_num = self.conversation_state.selected().unwrap();
if let ConversationEntry::Eva(text) = &self.scene.conversation()[self.scene.conversation().len() - 1 - row_num] {
if let ConversationEntry::Eva(text) = &self.conversation[self.conversation.len() - 1 - row_num] {
self.tts.speak(text.clone()).await;
self.focus_state = FocusState::UserInput;
self.conversation_state.select(None);
@@ -264,7 +266,10 @@ impl Ui {
SessionUpdate::Scene(scene) => {
self.scene = scene;
self.reply_state.select_first();
}
},
SessionUpdate::Conversation(conversation) => {
self.conversation = conversation;
},
}
},
next_volume = self.audio.next() => {