mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
Qwen3 Switching between thinking and non thinking #252
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @chunxingque on GitHub (May 5, 2025).
Self Checks
Dify version
1.2.0
Cloud or Self Hosted
Self Hosted (Source), Self Hosted (Docker)
Steps to reproduce
I deploy the latest Qwen3 model using sglang
(https://www.modelscope.cn/models/Qwen/Qwen3-32B)
run shell:
Using OpenAI-API compatible plugin to use the model
model repo: [https://www.modelscope.cn/models/Qwen/Qwen3-32B]
Qwen3 can switch between thinking and non thinking modes, as follows:
We provide a soft switch mechanism that allows users to dynamically control the model's behavior when enable_thinking=True. Specifically, you can add /think and /no_think to user prompts or system messages to switch the model's thinking mode from turn to turn. The model will follow the most recent instruction in multi-turn conversations.
✔️ Expected Behavior
When I use the/no_think tag, dify still returns the tag for thinking
I want to remove the content of
<think>\n\n\n\n</think>\n\nHow can I achieve this?or,How to add the parameter
chat_template_kwargs": {"enable_thinking": false}in the OpenAI-API compatible plugin?example:
❌ Actual Behavior
No response
@dosubot[bot] commented on GitHub (May 5, 2025):
Hello @chunxingque! I'm Dosu, your friendly bot here to help you solve bugs, answer questions, and assist with becoming a contributor. I'm here while you wait for a human maintainer. How can I assist you today?
I couldn't find specific information on how to configure the
chat_template_kwargsparameter in the OpenAI-API compatible plugin within Dify. However, I did find a similar unsolved discussion that might be relevant to your issue: Help how can I split the thought content? I just want the final answer. [1].For your issue with the
<think>tags, Dify processes and returns these tags by rendering them on the frontend instead of the backend. This change prevents HTML tags from being inserted into the API response content while still allowing the display of the thinking process. The functionality is managed by thepreprocessThinkTagfunction inweb/app/components/base/markdown.tsx. In Dify v0.15.3 and above, the thinking process and answer are automatically separated using HTML details tags, which improves the rendering of the separation in the frontend. However, in Dify v0.15.3, the<think>tag is not returned in the response when using the OpenAI-API-compatible interface, unlike when accessing the native OpenAI API directly. This feature has been restored in a recent pull request (PR langgenius/dify#13392) and will be available in versions after v0.15.3 [2][3][4][5].To remove the
<think>content, you might need to handle it on the client side by stripping out these tags from the response before displaying it. If you are looking to configure thechat_template_kwargsparameter, you might need to explore the plugin's documentation or source code for more details, as I couldn't find specific guidance on this.To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
@quicksandznzn commented on GitHub (May 5, 2025):
update OpenAI-API-compatible to 0.0.14
@chunxingque commented on GitHub (May 6, 2025):
找到问题了,流返回的第二条返回"reasoning_content":"\n\n",所以dify返回
<think>\n\n\n\n</think>\n\n内容。@dosubot[bot] commented on GitHub (Aug 19, 2025):
Hi, @chunxingque. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!