mind: move send_context_info and update_status to event_loop
Both are pure UI operations that read config/shared state and format display messages. No Mind state mutation involved. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
4eb0c891c4
commit
54cd3783eb
2 changed files with 31 additions and 35 deletions
|
|
@ -130,6 +130,32 @@ fn cmd_adjust_sampling(agent: &Arc<Mutex<Agent>>, param: usize, delta: f32) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn update_status(shared: &crate::mind::SharedMindState, ui_tx: &ui_channel::UiSender) {
|
||||
let s = shared.lock().unwrap();
|
||||
let _ = ui_tx.send(UiMessage::StatusUpdate(ui_channel::StatusInfo {
|
||||
dmn_state: s.dmn.label().to_string(),
|
||||
dmn_turns: s.dmn_turns,
|
||||
dmn_max_turns: s.max_dmn_turns,
|
||||
prompt_tokens: 0, completion_tokens: 0,
|
||||
model: String::new(), turn_tools: 0,
|
||||
context_budget: String::new(),
|
||||
}));
|
||||
}
|
||||
|
||||
pub fn send_context_info(config: &crate::config::SessionConfig, ui_tx: &ui_channel::UiSender) {
|
||||
let context_groups = crate::config::get().context_groups.clone();
|
||||
let (instruction_files, memory_files) = crate::mind::identity::context_file_info(
|
||||
&config.prompt_file,
|
||||
config.app.memory_project.as_deref(),
|
||||
&context_groups,
|
||||
);
|
||||
let _ = ui_tx.send(UiMessage::Info(format!(
|
||||
" context: {}K chars ({} config, {} memory files)",
|
||||
config.context_parts.iter().map(|(_, c)| c.len()).sum::<usize>() / 1024,
|
||||
instruction_files.len(), memory_files.len(),
|
||||
)));
|
||||
}
|
||||
|
||||
pub async fn cmd_switch_model(
|
||||
agent: &Arc<Mutex<Agent>>,
|
||||
name: &str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue