show model and provider
This commit is contained in:
@@ -204,10 +204,10 @@ async fn run_interactive_retro(config: Config, show_prompt: bool, show_code: boo
|
|||||||
// Display provider and model information
|
// Display provider and model information
|
||||||
match agent.get_provider_info() {
|
match agent.get_provider_info() {
|
||||||
Ok((provider, model)) => {
|
Ok((provider, model)) => {
|
||||||
tui.output(&format!("SYSTEM: PROVIDER: {} | MODEL: {}", provider, model));
|
tui.update_provider_info(&provider, &model);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tui.error(&format!("Failed to get provider info: {}", e));
|
tui.update_provider_info("ERROR", &e.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ struct TerminalState {
|
|||||||
status_line: String,
|
status_line: String,
|
||||||
/// Context window info
|
/// Context window info
|
||||||
context_info: (u32, u32, f32),
|
context_info: (u32, u32, f32),
|
||||||
|
/// Provider and model info
|
||||||
|
provider_info: (String, String),
|
||||||
/// Should exit
|
/// Should exit
|
||||||
should_exit: bool,
|
should_exit: bool,
|
||||||
}
|
}
|
||||||
@@ -76,6 +78,7 @@ impl TerminalState {
|
|||||||
last_blink: Instant::now(),
|
last_blink: Instant::now(),
|
||||||
status_line: "READY".to_string(),
|
status_line: "READY".to_string(),
|
||||||
context_info: (0, 0, 0.0),
|
context_info: (0, 0, 0.0),
|
||||||
|
provider_info: ("UNKNOWN".to_string(), "UNKNOWN".to_string()),
|
||||||
should_exit: false,
|
should_exit: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,7 +220,7 @@ impl RetroTui {
|
|||||||
Self::draw_output_area(f, chunks[1], &state.output_history, state.scroll_offset);
|
Self::draw_output_area(f, chunks[1], &state.output_history, state.scroll_offset);
|
||||||
|
|
||||||
// Draw status bar
|
// 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(())
|
Ok(())
|
||||||
@@ -332,6 +335,7 @@ impl RetroTui {
|
|||||||
area: Rect,
|
area: Rect,
|
||||||
status_line: &str,
|
status_line: &str,
|
||||||
context_info: (u32, u32, f32),
|
context_info: (u32, u32, f32),
|
||||||
|
provider_info: &(String, String),
|
||||||
) {
|
) {
|
||||||
let (used, total, percentage) = context_info;
|
let (used, total, percentage) = context_info;
|
||||||
|
|
||||||
@@ -340,9 +344,10 @@ impl RetroTui {
|
|||||||
let filled = ((percentage / 100.0) * bar_width as f32) as usize;
|
let filled = ((percentage / 100.0) * bar_width as f32) as usize;
|
||||||
let meter = format!("[{}{}]", "█".repeat(filled), "░".repeat(bar_width - filled));
|
let meter = format!("[{}{}]", "█".repeat(filled), "░".repeat(bar_width - filled));
|
||||||
|
|
||||||
|
let (provider, model) = provider_info;
|
||||||
let status_text = format!(
|
let status_text = format!(
|
||||||
" STATUS: {} | CONTEXT: {} {:.1}% ({}/{} tokens) | ↑↓ SCROLL | CTRL-C EXIT ",
|
" STATUS: {} | CONTEXT: {} {:.1}% ({}/{}) | PROVIDER: {} | MODEL: {} ",
|
||||||
status_line, meter, percentage, used, total
|
status_line, meter, percentage, used, total, provider, model
|
||||||
);
|
);
|
||||||
|
|
||||||
let status = Paragraph::new(status_text)
|
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
|
/// Send error message
|
||||||
pub fn error(&self, error: &str) {
|
pub fn error(&self, error: &str) {
|
||||||
let _ = self.tx.send(TuiMessage::Error(error.to_string()));
|
let _ = self.tx.send(TuiMessage::Error(error.to_string()));
|
||||||
|
|||||||
Reference in New Issue
Block a user