suppress printout of final_output

This commit is contained in:
Dhanji Prasanna
2025-10-01 15:26:55 +10:00
parent 046b54c49b
commit 98cf72c12a

View File

@@ -1276,6 +1276,8 @@ The tool will execute immediately and you'll receive the result (success or erro
// Execute the tool with formatted output // Execute the tool with formatted output
println!(); // New line before tool execution println!(); // New line before tool execution
// Skip printing tool call details for final_output
if tool_call.tool != "final_output" {
// Tool call header // Tool call header
println!("┌─ {}", tool_call.tool); println!("┌─ {}", tool_call.tool);
if let Some(args_obj) = tool_call.args.as_object() { if let Some(args_obj) = tool_call.args.as_object() {
@@ -1306,6 +1308,7 @@ The tool will execute immediately and you'll receive the result (success or erro
} }
} }
println!("├─ output:"); println!("├─ output:");
}
let exec_start = Instant::now(); let exec_start = Instant::now();
let tool_result = self.execute_tool(&tool_call).await?; let tool_result = self.execute_tool(&tool_call).await?;
@@ -1321,6 +1324,7 @@ The tool will execute immediately and you'll receive the result (success or erro
)); ));
// Display tool execution result with proper indentation // Display tool execution result with proper indentation
if tool_call.tool != "final_output" {
let output_lines: Vec<&str> = tool_result.lines().collect(); let output_lines: Vec<&str> = tool_result.lines().collect();
const MAX_LINES: usize = 5; const MAX_LINES: usize = 5;
@@ -1339,6 +1343,7 @@ The tool will execute immediately and you'll receive the result (success or erro
if hidden_count == 1 { "" } else { "s" } if hidden_count == 1 { "" } else { "s" }
); );
} }
}
// Check if this was a final_output tool call // Check if this was a final_output tool call
if tool_call.tool == "final_output" { if tool_call.tool == "final_output" {
@@ -1355,10 +1360,12 @@ The tool will execute immediately and you'll receive the result (success or erro
} }
// Closure marker with timing // Closure marker with timing
if tool_call.tool != "final_output" {
println!("└─ ⚡️ {}", Self::format_duration(exec_duration)); println!("└─ ⚡️ {}", Self::format_duration(exec_duration));
println!(); println!();
print!("🤖 "); print!("🤖 ");
io::stdout().flush()?; io::stdout().flush()?;
}
// Add the tool call and result to the context window // Add the tool call and result to the context window
// Only include the text content if it's not already in full_response // Only include the text content if it's not already in full_response