From bf5efde06ee3be5f01ce4b35c13e65c36d6f9ac7 Mon Sep 17 00:00:00 2001 From: Dhanji Prasanna Date: Thu, 2 Oct 2025 14:53:38 +1000 Subject: [PATCH] show model and provider --- crates/g3-cli/src/lib.rs | 4 ++-- crates/g3-cli/src/retro_tui.rs | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/crates/g3-cli/src/lib.rs b/crates/g3-cli/src/lib.rs index 7f4e3da..0c1167b 100644 --- a/crates/g3-cli/src/lib.rs +++ b/crates/g3-cli/src/lib.rs @@ -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()); } } diff --git a/crates/g3-cli/src/retro_tui.rs b/crates/g3-cli/src/retro_tui.rs index 3762e9d..5252ce8 100644 --- a/crates/g3-cli/src/retro_tui.rs +++ b/crates/g3-cli/src/retro_tui.rs @@ -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()));