mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
[PR #2477] [MERGED] feat: Add client-side thinking content filtering for Minimax M2.1 #2509
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?
📋 Pull Request Information
Original PR: https://github.com/langgenius/dify-official-plugins/pull/2477
Author: @DeiuDesHommies
Created: 1/23/2026
Status: ✅ Merged
Merged: 1/31/2026
Merged by: @crazywoola
Base:
main← Head:fix/openai-compatible-minimax-thinking📝 Commits (2)
b62e19ffeat: Add client-side thinking content filtering for Minimax M2.15d9293bfix: Address code review feedback from Gemini Code Assist📊 Changes
2 files changed (+65 additions, -2 deletions)
View changed files
📝
models/openai_api_compatible/manifest.yaml(+1 -1)📝
models/openai_api_compatible/models/llm/llm.py(+64 -1)📄 Description
Summary
This PR adds client-side filtering support for models like Minimax M2.1 that don't support server-side thinking mode control via API parameters.
Problem
Minimax M2.1 model deployed on SGLang/vLLM frameworks doesn't respond to API parameters like
thinking: {type: "disabled"}orchat_template_kwargs: {enable_thinking: false}. The model always returns thinking content wrapped in<think>tags, even when the user disables thinking mode in Dify UI.Testing Results
Tested 10+ different API parameter combinations:
thinking.type = "disabled"(GLM format)chat_template_kwargs.enable_thinking = false(vLLM format)reasoning_split = true(Minimax official parameter)Conclusion: Minimax M2.1's SGLang deployment does not support server-side thinking mode control.
Solution
Added client-side response filtering that:
<think>...</think>blocks from responsesenable_thinkingis explicitly set toFalseImplementation Details
Smart Triggering Logic
The filter only activates when:
enable_thinking = False)<think>tags (prevents unnecessary processing)Compatibility
Models NOT Affected
<think>tags in response when disabled<think>present AND user disabled thinkingModels Benefited
<think>blocks when SGLang ignores parametersTesting
✅ Tested with Minimax M2.1 on SGLang framework
✅ Tested 10+ different API parameter combinations
✅ Confirmed GLM models are not affected
✅ Verified backward compatibility
Impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.