From 118ef9c691f34382654713c7ab7bb558585c8d8e Mon Sep 17 00:00:00 2001 From: dal Date: Mon, 10 Feb 2025 12:29:13 -0700 Subject: [PATCH] ok streaming it back --- api/src/utils/agent/agent.rs | 41 ++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/api/src/utils/agent/agent.rs b/api/src/utils/agent/agent.rs index 754257d2b..8c377b6f5 100644 --- a/api/src/utils/agent/agent.rs +++ b/api/src/utils/agent/agent.rs @@ -424,31 +424,26 @@ impl Agent { for tool_call in tool_calls { pending.update_from_delta(tool_call); - // Only send intermediate updates if we have a function name + // Send an update if we have a name, regardless of arguments if let Some(name) = &pending.function_name { - if !pending.arguments.trim().is_empty() { - let temp_tool_call = ToolCall { - id: pending.id.clone().unwrap_or_default(), - function: FunctionCall { - name: name.clone(), - arguments: pending.arguments.clone(), - }, - call_type: pending - .call_type - .clone() - .unwrap_or_default(), - code_interpreter: None, - retrieval: None, - }; + let temp_tool_call = ToolCall { + id: pending.id.clone().unwrap_or_default(), + function: FunctionCall { + name: name.clone(), + arguments: pending.arguments.clone(), + }, + call_type: pending.call_type.clone().unwrap_or_default(), + code_interpreter: None, + retrieval: None, + }; - let _ = tx - .send(Ok(Message::assistant( - None, - Some(vec![temp_tool_call]), - Some(MessageProgress::InProgress), - ))) - .await; - } + let _ = tx + .send(Ok(Message::assistant( + None, + Some(vec![temp_tool_call]), + Some(MessageProgress::InProgress), + ))) + .await; } } }