From 9c3fde5eb7acf7fdedf126247051cd7463b64dff Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Fri, 7 Nov 2025 10:01:05 -0300 Subject: [PATCH] feat(bot, web): improve progress display and simplify context indicator Use `print!` with stdout flush for smoother in-place GPU/CPU/token progress updates in the bot module. Simplify context indicator logic in the web UI by always removing visibility class to streamline behavior. --- src/bot/mod.rs | 6 ++++-- web/html/index.html | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 210c4562..9d12fdd5 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -566,8 +566,9 @@ let gpu_bar = "█".repeat((metrics.gpu_usage.unwrap_or(0.0) / 5.0).round() as u let cpu_bar = "█".repeat((metrics.cpu_usage / 5.0).round() as usize); let token_ratio = current_tokens as f64 / max_context_size.max(1) as f64; let token_bar = "█".repeat((token_ratio * 20.0).round() as usize); -eprintln!( - "\nGPU [{:<20}] {:.1}% | CPU [{:<20}] {:.1}% | TOKENS [{:<20}] {}/{}", +use std::io::{self, Write}; +print!( + "\rGPU [{:<20}] {:.1}% | CPU [{:<20}] {:.1}% | TOKENS [{:<20}] {}/{}", gpu_bar, metrics.gpu_usage.unwrap_or(0.0), cpu_bar, @@ -576,6 +577,7 @@ eprintln!( current_tokens, max_context_size ); +io::stdout().flush().unwrap(); } last_progress_update = Instant::now(); } diff --git a/web/html/index.html b/web/html/index.html index 5225779b..a1ba4104 100644 --- a/web/html/index.html +++ b/web/html/index.html @@ -714,12 +714,8 @@ contextUsage=u; const p=Math.min(100,Math.round(u*100)); contextPercentage.textContent=`${p}%`; contextProgressBar.style.width=`${p}%`; -if(p>=50){ -contextIndicator.classList.add('visible'); -}else{ contextIndicator.classList.remove('visible'); } -} function flashScreen(){ gsap.to(flashOverlay,{