feat: 调用 deepseek-reasoner 时自动移除 tools (#2531)

* 调用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>
This commit is contained in:
ZvZPvz
2025-08-26 20:44:56 +08:00
committed by GitHub
parent 5872f1e017
commit 10b9228060
@@ -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