From e14885fa803b7544eb69c31cbc93d39f18ccb0c2 Mon Sep 17 00:00:00 2001 From: Felix <307253927@qq.com> Date: Sat, 21 Mar 2026 20:53:41 +0800 Subject: [PATCH] fix: Empty string IDs are overwritten, leading to inconsistencies in certain models. --- crates/openfang-runtime/src/drivers/openai.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/openfang-runtime/src/drivers/openai.rs b/crates/openfang-runtime/src/drivers/openai.rs index 7d54c432..5ef38cf7 100644 --- a/crates/openfang-runtime/src/drivers/openai.rs +++ b/crates/openfang-runtime/src/drivers/openai.rs @@ -1173,7 +1173,10 @@ impl LlmDriver for OpenAIDriver { // ID (sent in first chunk for this tool) if let Some(id) = call["id"].as_str() { - tool_accum[idx].0 = id.to_string(); + // Fix: Empty string IDs are overwritten, leading to inconsistencies in certain models. + if !id.is_empty() { + tool_accum[idx].0 = id.to_string(); + } } if let Some(func) = call.get("function") {