优化日志输出:斜杠命令执行时打印,过滤冗余的压缩日志
- 添加斜杠命令执行的 info 日志 - Context compression 日志只在实际触发压缩时输出 (debug级别)
This commit is contained in:
parent
7220e89a22
commit
84bb06cc76
@ -110,17 +110,11 @@ impl ContextCompressor {
|
|||||||
// Check if compression is needed
|
// Check if compression is needed
|
||||||
let tokens = estimate_tokens(&history);
|
let tokens = estimate_tokens(&history);
|
||||||
if tokens <= self.threshold() {
|
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);
|
return Ok(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing::info!(
|
#[cfg(debug_assertions)]
|
||||||
|
tracing::debug!(
|
||||||
tokens = tokens,
|
tokens = tokens,
|
||||||
threshold = self.threshold(),
|
threshold = self.threshold(),
|
||||||
msg_count = history.len(),
|
msg_count = history.len(),
|
||||||
@ -172,7 +166,8 @@ impl ContextCompressor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing::info!(
|
#[cfg(debug_assertions)]
|
||||||
|
tracing::debug!(
|
||||||
final_tokens = estimate_tokens(¤t_history),
|
final_tokens = estimate_tokens(¤t_history),
|
||||||
final_msg_count = current_history.len(),
|
final_msg_count = current_history.len(),
|
||||||
"Context compression completed"
|
"Context compression completed"
|
||||||
|
|||||||
@ -265,6 +265,8 @@ impl SessionManager {
|
|||||||
.find(|c| c.name == command)
|
.find(|c| c.name == command)
|
||||||
.ok_or_else(|| AgentError::Other(format!("Unknown command: {}", command)))?;
|
.ok_or_else(|| AgentError::Other(format!("Unknown command: {}", command)))?;
|
||||||
|
|
||||||
|
tracing::info!(cmd = %cmd.name, args = ?args, "Executing slash command");
|
||||||
|
|
||||||
match cmd.name {
|
match cmd.name {
|
||||||
"new" => {
|
"new" => {
|
||||||
let title = args.map(|s| s.to_string());
|
let title = args.map(|s| s.to_string());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user