From 4788c20816412448fe27aa24a767a15a9626026a Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 13 Sep 2025 16:18:22 +0800 Subject: [PATCH] fix: model variable referenced before assignment --- astrbot/core/provider/sources/openai_source.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index 467ae9f5b..5b199ed96 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -104,6 +104,8 @@ class ProviderOpenAIOfficial(Provider): if isinstance(custom_extra_body, dict): extra_body.update(custom_extra_body) + model = payloads.get("model", "").lower() + # 针对 deepseek 模型的特殊处理:deepseek-reasoner调用必须移除 tools ,否则将被切换至 deepseek-chat if model == "deepseek-reasoner" and "tools" in payloads: del payloads["tools"]