From 10b9228060d144f89fccbb41b22ae87558b38357 Mon Sep 17 00:00:00 2001 From: ZvZPvz <130430455+ZvZPvz@users.noreply.github.com> Date: Tue, 26 Aug 2025 20:44:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E7=94=A8=20deepseek-reasoner?= =?UTF-8?q?=20=E6=97=B6=E8=87=AA=E5=8A=A8=E7=A7=BB=E9=99=A4=20tools=20(#25?= =?UTF-8?q?31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 调用DeepSeek为思考模式时自动移除tools * Update astrbot/core/provider/sources/openai_source.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update openai_source.py * Update openai_source.py --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- astrbot/core/provider/sources/openai_source.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index b286eb701..9ee0fc695 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -99,10 +99,13 @@ class ProviderOpenAIOfficial(Provider): for key in to_del: del payloads[key] - # 针对 qwen3 模型的特殊处理:非流式调用必须设置 enable_thinking=false model = payloads.get("model", "") + # 针对 qwen3 模型的特殊处理:非流式调用必须设置 enable_thinking=false if "qwen3" in model.lower(): - extra_body["enable_thinking"] = False + extra_body["enable_thinking"] = False + # 针对 deepseek 模型的特殊处理:deepseek-reasoner调用必须移除 tools ,否则将被切换至 deepseek-chat + elif model == "deepseek-reasoner" and "tools" in payloads: + del payloads["tools"] completion = await self.client.chat.completions.create( **payloads, stream=False, extra_body=extra_body