show model and provider

This commit is contained in:
Dhanji Prasanna
2025-10-02 14:53:38 +10:00
parent 57b1b51e65
commit bf5efde06e
2 changed files with 17 additions and 5 deletions

View File

@@ -204,10 +204,10 @@ async fn run_interactive_retro(config: Config, show_prompt: bool, show_code: boo
// Display provider and model information
match agent.get_provider_info() {
Ok((provider, model)) => {
tui.output(&format!("SYSTEM: PROVIDER: {} | MODEL: {}", provider, model));
tui.update_provider_info(&provider, &model);
}
Err(e) => {
tui.error(&format!("Failed to get provider info: {}", e));
tui.update_provider_info("ERROR", &e.to_string());
}
}

View File

@@ -55,6 +55,8 @@ struct TerminalState {
status_line: String,
/// Context window info
context_info: (u32, u32, f32),
/// Provider and model info
provider_info: (String, String),
/// Should exit
should_exit: bool,
}
@@ -76,6 +78,7 @@ impl TerminalState {
last_blink: Instant::now(),
status_line: "READY".to_string(),
context_info: (0, 0, 0.0),
provider_info: ("UNKNOWN".to_string(), "UNKNOWN".to_string()),
should_exit: false,
}
}
@@ -217,7 +220,7 @@ impl RetroTui {
Self::draw_output_area(f, chunks[1], &state.output_history, state.scroll_offset);
// Draw status bar
Self::draw_status_bar(f, chunks[2], &state.status_line, state.context_info);
Self::draw_status_bar(f, chunks[2], &state.status_line, state.context_info, &state.provider_info);
})?;
Ok(())
@@ -332,6 +335,7 @@ impl RetroTui {
area: Rect,
status_line: &str,
context_info: (u32, u32, f32),
provider_info: &(String, String),
) {
let (used, total, percentage) = context_info;
@@ -340,9 +344,10 @@ impl RetroTui {
let filled = ((percentage / 100.0) * bar_width as f32) as usize;
let meter = format!("[{}{}]", "".repeat(filled), "".repeat(bar_width - filled));
let (provider, model) = provider_info;
let status_text = format!(
" STATUS: {} | CONTEXT: {} {:.1}% ({}/{} tokens) | ↑↓ SCROLL | CTRL-C EXIT ",
status_line, meter, percentage, used, total
" STATUS: {} | CONTEXT: {} {:.1}% ({}/{}) | PROVIDER: {} | MODEL: {} ",
status_line, meter, percentage, used, total, provider, model
);
let status = Paragraph::new(status_text)
@@ -376,6 +381,13 @@ impl RetroTui {
});
}
/// Update provider and model info
pub fn update_provider_info(&self, provider: &str, model: &str) {
if let Ok(mut state) = self.state.lock() {
state.provider_info = (provider.to_string(), model.to_string());
}
}
/// Send error message
pub fn error(&self, error: &str) {
let _ = self.tx.send(TuiMessage::Error(error.to_string()));