diff options
| author | sigoden <sigoden@gmail.com> | 2025-06-23 11:52:52 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-23 11:52:52 +0800 |
| commit | ffcb19dc8113f5a52699f47481e5639211456a9a (patch) | |
| tree | 8d85a505873f2270303bae4c0788c23ca8deb9d6 | |
| parent | a22da5609ef2861c8d64f515e88b732100becafc (diff) | |
| download | aichat-ffcb19dc8113f5a52699f47481e5639211456a9a.tar.gz | |
fix: openai api omits content field from tool_calls message (#1326)
| -rw-r--r-- | src/client/openai.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/client/openai.rs b/src/client/openai.rs index 37ac895..7f62ec6 100644 --- a/src/client/openai.rs +++ b/src/client/openai.rs @@ -241,7 +241,7 @@ pub fn openai_build_chat_completions_body(data: ChatCompletionsData, model: &Mod match content { MessageContent::ToolCalls(MessageContentToolCalls { tool_results, - text, + text: _, sequence, }) => { if !sequence { @@ -255,9 +255,8 @@ pub fn openai_build_chat_completions_body(data: ChatCompletionsData, model: &Mod }, }) }).collect(); - let text = if text.is_empty() { Value::Null } else { text.into() }; let mut messages = vec![ - json!({ "role": MessageRole::Assistant, "content": text, "tool_calls": tool_calls }) + json!({ "role": MessageRole::Assistant, "tool_calls": tool_calls }) ]; for tool_result in tool_results { messages.push( @@ -274,7 +273,6 @@ pub fn openai_build_chat_completions_body(data: ChatCompletionsData, model: &Mod vec