fix(deepseek): map max thinking level to max instead of high - #360
Open
xiaYuTian11 wants to merge 2 commits into
Open
fix(deepseek): map max thinking level to max instead of high#360xiaYuTian11 wants to merge 2 commits into
xiaYuTian11 wants to merge 2 commits into
Conversation
DeepSeek adapter has a bug where the catalog declares 'max' as a supported thinking level for deepseek-v4-flash and deepseek-v4-pro, but both DEEPSEEK_THINKING_LEVEL_MAP and mapDeepSeekReasoningEffort only map 'xhigh' → 'max'. Any non-xhigh value (including 'max') falls through to 'high', making the UI's '最高' setting behave identically to '高'. Fix: - Add max: 'max' to DEEPSEEK_THINKING_LEVEL_MAP so the wire value is correct when the catalog declares max support. - Update mapDeepSeekReasoningEffort to treat both 'xhigh' and 'max' as 'max', so the payload adapter sends reasoning_effort: 'max' when the user selects the highest level. This affects all three call sites: 1. normalizeDeepSeekOpenAIPayload (OpenAI-compat path) 2. normalizeDeepSeekAnthropicPayload (Anthropic-compat path) 3. resolveDeepSeekAnthropicThinkingRuntime in streamByApi.ts
Contributor
|
PR governance checks passed. Awaiting human review. |
StackCairn
marked this pull request as draft
August 2, 2026 07:12
xiaYuTian11
marked this pull request as ready for review
August 2, 2026 07:18
StackCairn
marked this pull request as draft
August 2, 2026 07:19
xiaYuTian11
marked this pull request as ready for review
August 2, 2026 07:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Closes #361
Summary
DeepSeek 适配器缺失
max思考档位的映射,导致 UI 上选择「最高」与「高」发出完全相同的请求。模型目录
catalog.generated.ts声明deepseek-v4-flash/deepseek-v4-pro支持["high", "max"],UI 因此渲染出「高 / 最高」两档。但适配器侧DEEPSEEK_THINKING_LEVEL_MAP与mapDeepSeekReasoningEffort只认xhigh → max;而xhigh目录并未声明、永远不可选,于是max → max这条路径不可达,所有档位都落进 else 分支被压成"high"。目录与适配器是同一发布包内的两个文件,属于构造性不对齐,用户侧无任何配置可以绕过。
reasoning_efforthigh)"high""high"max)"high"← bug"max"Change scope
crates/agent-gui/src/lib/providers/deepSeekProviderAdapter.ts(单文件,+2/-1)两处改动:
修复覆盖三个调用点:
normalizeDeepSeekOpenAIPayloadreasoning_effortnormalizeDeepSeekAnthropicPayloadoutput_config.effortresolveDeepSeekAnthropicThinkingRuntime(streamByApi.ts)effortScreenshots / preview
关于「无可视变化」:本 PR 虽改动
crates/agent-gui/src/下的文件,但不触及渲染层。composer 的 ✨ 档位下拉在修复前后都显示「高 / 最高」两档,界面截图逐像素一致、不构成任何证据。真正变化的是发往模型的请求体,故上图给出 wire payload 的前后对照(并按 CONTRIBUTING 对后端类改动的要求,在下方以文本复现)。驱动真实
streamSimpleByApi+onPayload管线(模型经createModelFromConfig构造,mockopenai-completions的stream拦截请求体):修复前
修复后
注意
clampOpenAI=max:档位完整通过目录钳制、以"max"抵达适配器,是适配器自身的映射把它丢弃的。函数级对照:
Verification
无回归
非 DeepSeek 模型不进适配器,档位原样透传:
gpt-5.6-terra的low/high/xhigh/max全部未受影响,deepSeekProviderAdapter=falsethinkingLevelMap仍与目录声明对齐,applyDeepSeekModelDefaults中「wire 表不得复活目录裁掉的档」这一约束未被破坏:thinkingLevelMapdeepseek-v4-pro/-flash{minimal:null, low:null, medium:null, high:"high", max:"max"}["high","max"]一致deepseek-chatreasoning=false,无max键deepseek-reasonernull执行的检查
那 5 项失败与本改动无关,已在父提交
7de95a20上复现同样失败,属仓库既有状态:mention-composer-selection(2 项)与mention-refetch(2 项)是测试自身的函数提取正则问题,preset scripts stay in sync with the Rust builtin presets是 Rust 预设同步检查。该适配器不在
scripts/mirror-manifest.json内,gateway WebUI 侧亦无对应文件,无需同步改动。关于测试用例:现有
request-options.test.mjs已断言model.thinkingLevelMap.max === "max"(目录侧),但没有覆盖max档的 wire 值。如维护者希望补一条针对reasoning: "max"→reasoning_effort: "max"的回归测试,我可以在本分支追加。Pre-submit checklist