Fix TUI display formatting issues for better terminal compatibility
- Simplified header design from complex Unicode borders to fixed-width lines - Streamlined status bar from multi-line bordered display to clean single-line format - Fixed terminal width calculation dependencies that caused layout breaks - Enhanced status display: "🤖 Model Provider • 💾 Session" format - Improved features display with color-coded indicators (✓/✗) - Removed problematic border calculations causing wrapping issues - All display tests pass, maintains functionality while fixing visual problems 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
11ae676101
commit
1a1df93521
61
src/cli.rs
61
src/cli.rs
|
|
@ -42,16 +42,19 @@ impl ChatCLI {
|
||||||
|
|
||||||
pub async fn run(&mut self) -> Result<()> {
|
pub async fn run(&mut self) -> Result<()> {
|
||||||
self.display.print_header();
|
self.display.print_header();
|
||||||
self.display
|
|
||||||
.print_info("Type your message and press Enter. Commands start with '/'.");
|
|
||||||
self.display.print_info("Type /help for help.");
|
|
||||||
|
|
||||||
|
// Enhanced status bar with comprehensive information
|
||||||
let provider = get_provider_for_model(&self.session.model);
|
let provider = get_provider_for_model(&self.session.model);
|
||||||
let display_name = get_display_name_for_model(&self.session.model);
|
let display_name = get_display_name_for_model(&self.session.model);
|
||||||
self.display
|
let features = vec![
|
||||||
.print_model_info(&display_name, provider.as_str());
|
("Web Search", self.session.enable_web_search),
|
||||||
self.display.print_session_info(&self.session.name);
|
("Reasoning", self.session.enable_reasoning_summary),
|
||||||
|
("Extended Thinking", self.session.enable_extended_thinking),
|
||||||
|
];
|
||||||
|
|
||||||
|
self.display.print_status_bar(&display_name, provider.as_str(), &self.session.name, &features);
|
||||||
|
|
||||||
|
self.display.print_info("Type your message and press Enter. Commands start with '/' (try /help).");
|
||||||
println!();
|
println!();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -68,7 +71,16 @@ impl ChatCLI {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let Err(e) = self.handle_user_message(line).await {
|
if let Err(e) = self.handle_user_message(line).await {
|
||||||
self.display.print_error(&format!("Error: {}", e));
|
// Enhanced error display with context and suggestions
|
||||||
|
let error_msg = format!("Error: {}", e);
|
||||||
|
let context = Some("This error occurred while processing your message.");
|
||||||
|
let suggestions = vec![
|
||||||
|
"Check your API key configuration",
|
||||||
|
"Verify your internet connection",
|
||||||
|
"Try switching to a different model with /model",
|
||||||
|
"Use /help to see available commands"
|
||||||
|
];
|
||||||
|
self.display.print_error_with_context(&error_msg, context, &suggestions);
|
||||||
}
|
}
|
||||||
println!(); // Add padding before next prompt
|
println!(); // Add padding before next prompt
|
||||||
}
|
}
|
||||||
|
|
@ -425,33 +437,18 @@ impl ChatCLI {
|
||||||
|
|
||||||
async fn tools_manager(&mut self) -> Result<()> {
|
async fn tools_manager(&mut self) -> Result<()> {
|
||||||
loop {
|
loop {
|
||||||
// Show current tool status
|
// Show current tool status using enhanced display
|
||||||
self.display.print_info("Tool Management:");
|
let features = vec![
|
||||||
|
("Web Search", self.session.enable_web_search, Some("Search the web for up-to-date information")),
|
||||||
|
("Reasoning Summaries", self.session.enable_reasoning_summary, Some("Show reasoning process summaries")),
|
||||||
|
("Extended Thinking", self.session.enable_extended_thinking, Some("Enable deeper reasoning capabilities")),
|
||||||
|
];
|
||||||
|
|
||||||
let web_status = if self.session.enable_web_search {
|
self.display.print_feature_status(&features);
|
||||||
"✓ enabled"
|
|
||||||
} else {
|
|
||||||
"✗ disabled"
|
|
||||||
};
|
|
||||||
let reasoning_status = if self.session.enable_reasoning_summary {
|
|
||||||
"✓ enabled"
|
|
||||||
} else {
|
|
||||||
"✗ disabled"
|
|
||||||
};
|
|
||||||
let extended_thinking_status = if self.session.enable_extended_thinking {
|
|
||||||
"✓ enabled"
|
|
||||||
} else {
|
|
||||||
"✗ disabled"
|
|
||||||
};
|
|
||||||
|
|
||||||
println!(" Web Search: {}", web_status);
|
// Additional status information
|
||||||
println!(" Reasoning Summaries: {}", reasoning_status);
|
self.display.print_info(&format!("Reasoning Effort: {}", self.session.reasoning_effort));
|
||||||
println!(" Reasoning Effort: {}", self.session.reasoning_effort);
|
self.display.print_info(&format!("Thinking Budget: {} tokens", self.session.thinking_budget_tokens));
|
||||||
println!(" Extended Thinking: {}", extended_thinking_status);
|
|
||||||
println!(
|
|
||||||
" Thinking Budget: {} tokens",
|
|
||||||
self.session.thinking_budget_tokens
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check model compatibility
|
// Check model compatibility
|
||||||
let model = self.session.model.clone();
|
let model = self.session.model.clone();
|
||||||
|
|
|
||||||
1032
src/utils/display.rs
1032
src/utils/display.rs
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue