summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2025-03-11 08:20:25 +0800
committerGitHub <noreply@github.com>2025-03-11 08:20:25 +0800
commit9222713afccb8042ceb237cf6156606724279fb8 (patch)
tree7b739571c30049d5a126afff53971b90b737a9f3
parentfa6beb3e8b336d249ab21c9ef63eaf872dca3de1 (diff)
downloadaichat-9222713afccb8042ceb237cf6156606724279fb8.tar.gz
fix: miss </think> tag while tool calling (#1226)
-rw-r--r--src/client/openai.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/client/openai.rs b/src/client/openai.rs
index ab12b1a..37ac895 100644
--- a/src/client/openai.rs
+++ b/src/client/openai.rs
@@ -153,6 +153,10 @@ pub async fn openai_chat_completions_streaming(
.as_str()
.filter(|v| !v.is_empty()),
) {
+ if reasoning_state == 1 {
+ handler.text("\n</think>\n\n")?;
+ reasoning_state = 0;
+ }
let maybe_call_id = format!("{}/{}", id.unwrap_or_default(), index.unwrap_or_default());
if maybe_call_id != call_id && maybe_call_id.len() >= call_id.len() {
if !function_name.is_empty() {