From 8bd7db9aab2e0d96cac2530a5de3b0609ef58d27 Mon Sep 17 00:00:00 2001 From: wwsheng009 Date: Tue, 18 Feb 2025 11:34:12 +0800 Subject: fix: better handle OpenAI-Compatible streaming responses (#1184) --- src/client/openai.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/client') diff --git a/src/client/openai.rs b/src/client/openai.rs index 26c2dd3..9be4722 100644 --- a/src/client/openai.rs +++ b/src/client/openai.rs @@ -142,7 +142,8 @@ pub async fn openai_chat_completions_streaming( reason_state = 1; } handler.text(text)?; - } else if let (Some(function), index, id) = ( + } + if let (Some(function), index, id) = ( data["choices"][0]["delta"]["tool_calls"][0]["function"].as_object(), data["choices"][0]["delta"]["tool_calls"][0]["index"].as_u64(), data["choices"][0]["delta"]["tool_calls"][0]["id"] -- cgit v1.2.3