logging optimization

This commit is contained in:
Dhanji Prasanna
2025-09-27 12:18:27 +10:00
parent fb114cfcf5
commit 7595ee083e
2 changed files with 41 additions and 0 deletions

View File

@@ -959,6 +959,7 @@ The tool will execute immediately and you'll receive the result (success or erro
// Check for tool calls - prioritize native tool calls over JSON parsing
let mut detected_tool_call = None;
let mut is_text_based_tool_call = false;
// First check for native tool calls in the chunk
if let Some(ref tool_calls) = chunk.tool_calls {
@@ -985,6 +986,7 @@ The tool will execute immediately and you'll receive the result (success or erro
detected_tool_call = parser.add_chunk(&chunk.content);
if detected_tool_call.is_some() {
debug!("Found JSON tool call in text content for native provider");
is_text_based_tool_call = true;
}
}
@@ -1035,6 +1037,20 @@ The tool will execute immediately and you'll receive the result (success or erro
io::stdout().flush()?;
}
// Check if this was a JSON tool call detected from text (not native)
// If so, show a brief indicator that we detected a text-based tool call
let provider = self.providers.get(None)?;
if provider.has_native_tool_calling() && is_text_based_tool_call {
// This means we detected a JSON tool call in text for a native provider
// Show a brief indicator instead of the raw JSON
if !response_started {
print!("\r🤖 "); // Clear thinking indicator and show response indicator
response_started = true;
}
print!("🔧 "); // Brief tool call indicator
io::stdout().flush()?;
}
// Execute the tool with formatted output
println!(); // New line before tool execution