summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwwsheng009 <vincentwwsheng@gmail.com>2025-02-18 11:34:12 +0800
committerGitHub <noreply@github.com>2025-02-18 11:34:12 +0800
commit8bd7db9aab2e0d96cac2530a5de3b0609ef58d27 (patch)
tree7a9614c352ecd289df3a1c6c5d0970dc377b4442
parentd72ce9c0e492aa8b5e61db5cc701fabd89c875d7 (diff)
downloadaichat-8bd7db9aab2e0d96cac2530a5de3b0609ef58d27.tar.gz
fix: better handle OpenAI-Compatible streaming responses (#1184)
-rw-r--r--src/client/openai.rs3
1 files changed, 2 insertions, 1 deletions
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"]