From c19bca798b731c25fcd45a8eea1e33aeabde2a2f Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Mon, 14 Jul 2025 22:07:28 +0800 Subject: [PATCH] fix: xfyun model tool use error workaround fixes: #1359 --- astrbot/core/provider/sources/openai_source.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index e44b4261..e7ce0d54 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -187,6 +187,9 @@ class ProviderOpenAIOfficial(Provider): func_name_ls = [] tool_call_ids = [] for tool_call in choice.message.tool_calls: + if isinstance(tool_call, str): + # workaround for #1359 + tool_call = json.loads(tool_call) for tool in tools.func_list: if tool.name == tool_call.function.name: # workaround for #1454