From 84bb06cc76e4637b519d668e2c3a7e66a99837f0 Mon Sep 17 00:00:00 2001 From: xiaoxixi Date: Tue, 28 Apr 2026 20:52:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BA=EF=BC=9A=E6=96=9C=E6=9D=A0=E5=91=BD=E4=BB=A4=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E6=89=93=E5=8D=B0=EF=BC=8C=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E5=86=97=E4=BD=99=E7=9A=84=E5=8E=8B=E7=BC=A9=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加斜杠命令执行的 info 日志 - Context compression 日志只在实际触发压缩时输出 (debug级别) --- src/agent/context_compressor.rs | 13 ++++--------- src/session/session.rs | 2 ++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/agent/context_compressor.rs b/src/agent/context_compressor.rs index e2161fb..f27d9dc 100644 --- a/src/agent/context_compressor.rs +++ b/src/agent/context_compressor.rs @@ -110,17 +110,11 @@ impl ContextCompressor { // Check if compression is needed let tokens = estimate_tokens(&history); if tokens <= self.threshold() { - #[cfg(debug_assertions)] - tracing::info!( - tokens = tokens, - threshold = self.threshold(), - msg_count = history.len(), - "Context compression not needed" - ); return Ok(history); } - tracing::info!( + #[cfg(debug_assertions)] + tracing::debug!( tokens = tokens, threshold = self.threshold(), msg_count = history.len(), @@ -172,7 +166,8 @@ impl ContextCompressor { } } - tracing::info!( + #[cfg(debug_assertions)] + tracing::debug!( final_tokens = estimate_tokens(¤t_history), final_msg_count = current_history.len(), "Context compression completed" diff --git a/src/session/session.rs b/src/session/session.rs index 271ae70..ca7619f 100644 --- a/src/session/session.rs +++ b/src/session/session.rs @@ -265,6 +265,8 @@ impl SessionManager { .find(|c| c.name == command) .ok_or_else(|| AgentError::Other(format!("Unknown command: {}", command)))?; + tracing::info!(cmd = %cmd.name, args = ?args, "Executing slash command"); + match cmd.name { "new" => { let title = args.map(|s| s.to_string());