[建议 / Feature] 支持用户自定义每个模型的思考档位及参数映射
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复提议 / I searched existing issues and confirmed this isn't a duplicate.
- 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category
模型设置 / 切换 · Model config / switching
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
使用场景 · Use case
背景 自定义供应商/中转站模型越来越多,但思考档位目前完全由客户端内置目录和硬编码规则决定,用户无法干预,产生了一批同类问题:#507、#594、#564、#623、#607。
现状与根因(以 3.11.2 为例)
档位表来自三处:本地目录 resources/model-providers/models_catalog_china_llm_*.json、服务端 /api/v1/client/configs 下发的 builtinModels/magic_name、agent 内置的模型家族规则(resolveModelCapabilityDefaults)。
家族规则按模型 ID 子串匹配(如含 "gpt"、"claude"),档位硬编码。GPT 系固定为 low/medium/high/xhigh,封顶 xhigh 没有 max——但我的中转把 GPT 包成 anthropic 兼容接口、能透传 output_config.effort: max(anthropic 的 effort 枚举本身含 max),客户端却无法选到。
这些规则带 replaceReasoning: true,会无条件覆盖用户在 provider 配置里写的 reasoning 字段,导致手动改 ~/.zcode/v2/config.json 也无效。
建议方案
在"编辑模型"对话框(目前只能改上下文窗口)中开放"思考档位"编辑:档位列表 + 每档的参数映射(按 anthropic / openai-compatible 分别配置 providerOptions),支持从模板(GLM-5.3 / Kimi / OpenAI / Claude / DeepSeek)导入或直接编辑 JSON。
修优先级:模型带有用户配置的 reasoning 时(modified: true 或新增 reasoningSource: "user" 标记),跳过 agent 侧家族规则,即 applyModelCapabilityDefaults 仅在 reasoning === undefined 时生效。
(可选)服务端 magic_name 下发机制已支持免升级新增档位映射,希望新模型接入时同步维护。
为什么可行 存储层 schema(reasoning: {enabled, levels: {档位名: {anthropic/openai-compatible: {set/unset}}}, defaultLevel})已经存在,桌面端 buildProtocolReasoningState → providerOptionsByLevel 的转换链路也已经在为内置模型工作,只差 UI 暴露和优先级修正。参考实现:cc-switch 已支持用户自定义每个供应商/模型的思考档位。
收益 一次性解决 #507/#594/#564/#623/#607 这一类"档位不生效/缺失"的问题,覆盖 new-api/one-api 中转用户这个不小的群体。
建议方案 · Proposal
建议方案
- 开放用户配置:在「编辑模型」对话框中增加"思考档位"配置项——每个模型可自定义档位列表(如 low/high/max)、默认档位、以及每档对应的请求参数映射(anthropic 走 output_config.effort/thinking,openai-compatible 走 reasoning_effort),支持模板导入和 JSON 直编。
- 修配置优先级:用户在 provider 配置中写入了 reasoning 时,应以用户配置为准;目前 agent 侧按模型 ID 猜家族的内置规则(带 replaceReasoning 标记)会无条件覆盖用户配置,建议改为仅在模型无 reasoning 配置时才套用内置规则。
- 放宽档位校验:请求侧 effort 枚举已含 max,但 GPT/Claude 系模型的档位表硬编码封顶在 xhigh,建议允许通过用户配置或服务端 magic_name 下发补充档位(如 max),避免中转站透传的高档位选不到。
- 兼容存量:自定义档位配置沿用现有 config.json 的 reasoning 字段结构(levels → set/unset 参数映射),与内置模型目录共用一套链路,无 schema 变更。
预期价值 · Expected value
No response
你认为的优先级 · Your perceived priority
No response
你使用的 ZCode 版本 / 环境 · ZCode version / environment
No response
补充材料 · Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing resources/model-providers/models_catalog_china_llm_*.json, resolveModelCapabilityDefaults, applyModelCapabilityDefaults, and the desktop buildProtocolReasoningState → providerOptionsByLevel path. Compare those paths with the existing reasoning structure in ~/.zcode/v2/config.json and the /api/v1/client/configs builtinModels/magic_name response. Done means the edit-model UI exposes custom levels and mappings, user reasoning takes precedence, and configured levels such as max can be selected.
Written by the indexing model from the issue text.
Assessment
- Domain
- ai, backend-api-design, desktop-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100