fix: enable_thinking parameter for qwen3 models in non-streaming calls (#2424)
* Initial plan * Fix ModelScope enable_thinking parameter for non-streaming calls Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * Tighten enable_thinking condition to only Qwen/Qwen3 models Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * qwen3 model handle * Update astrbot/core/provider/sources/openai_source.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -99,6 +99,11 @@ class ProviderOpenAIOfficial(Provider):
|
||||
for key in to_del:
|
||||
del payloads[key]
|
||||
|
||||
# 针对 qwen3 模型的特殊处理:非流式调用必须设置 enable_thinking=false
|
||||
model = payloads.get("model", "")
|
||||
if "qwen3" in model.lower():
|
||||
extra_body["enable_thinking"] = False
|
||||
|
||||
completion = await self.client.chat.completions.create(
|
||||
**payloads, stream=False, extra_body=extra_body
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user