feat(one): 设置面板可配 agent 节点默认渠道/模型/思考级别 - #117
Merged
Merged
Conversation
- 新增 lib/agent-defaults.js:dsh 用户级持久化(plugin-data/.../agent-defaults.json, 0600 原子写)、normalize 整形(model 依附渠道、档位依附模型)、对照 ctx.llm 目录 校验、resolveAgentModelSelection 解析链纯函数 - runAgentNode 解析链改为:节点显式配置 > Workflow One 默认值 > dsh 全局选择; 模型与思考档位只在同渠道同模型时继承,跨渠道不错配 - 新增 /wf1/api/agent-defaults(GET/PUT,scoped:false——设置面板没有会话上下文, 偏好本身是 dsh 用户级,与飞书凭据同存放层级) - /wf1/api/llm-config 改 scoped:false:目录只读 ctx.llm 运行时,与工作区无关, 设置面板需要它渲染渠道/模型/档位选项 - 测试:agent-defaults 16 例 + 路由集成 7 例(含畸形请求体 400 兜底) - 顺带同步 package-lock 到 0.8.0 + dsh-agent peer(#114 漏更,npm install 自动对齐)
- 渠道/模型/思考级别三个下拉,目录来自 /wf1/api/llm-config(视觉模型带 👁 标记) - 级联重置:换渠道清空模型与档位、换模型清空档位;无档位模型禁用档位下拉 - 已保存值从目录下线时保留展示(目录中不可用/模型不支持),不静默改写用户配置 - 保存前显示「当前生效」解析结果,保存后与后端同一解析链回显 - __test 暴露 modelOptionsFor/effortOptionsFor/providerNameOf 并补装配用例
This was referenced Sep 3, 2026
chumingjun
added a commit
that referenced
this pull request
Sep 3, 2026
背景:渠道/模型/思考级别已有设置面板默认值层(#117/#125),但 agent 节点 的两个超时旋钮(节点总超时 500s / 模型单请求超时 300s)只能逐节点配置。 另发现 #122 意外把 engine NODE_TIMEOUT_MS 从 500s 回退成 300s(#114 语义 是 500s),UI placeholder 与引擎实际值不符。 方案(解析链与模型层同构:节点 data > WF1 默认值 > 内置默认): - agent-defaults:新增 nodeTimeoutSec/modelTimeoutSec(正整数秒,0=不设置, 上限 86400);resolveAgentTimeouts 统一解析,导出 500/300 内置默认 - 引擎:engine.js 加 resolveNodeTimeout 注入位(仅 agent 节点吃 WF1 默认值, 其余节点维持内置 300s);runAgentNode 单请求超时、单节点测试入口同步走链 - API:agent-defaults GET/PUT 回包 defaults/effective 带超时字段; llm-config 的 wf1Defaults 自动同源下发;旧配置文件读回自动补 0 - 设置面板:AgentDefaultsCard 加「节点超时(秒)/单次超时(秒)」两个输入框, 前端预校验非法值 - NodePanel:agent 面板超时 placeholder 如实展示实际生效秒数(WF1 默认值 或内置);容错区占位按节点类型区分(agent 500 / 其他 300),上限放宽到 86400 验证:orchestrator 17+ 套、web 15 套、全仓 npm test 绿;build-web.sh 双构建 + canvasui 防漂移通过;实机 dsh 验证 PUT 900/180 落盘、llm-config 下发、 非法值 400、旧文件兼容读回。
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.
背景
dsh 设置 →「Workflow One」此前只有版本/升级卡片。agent 节点的渠道/模型/思考级别只能逐节点配置,或整体跟随 dsh 全局选择——缺少一层「Workflow One 自己的默认值」。
方案
新增解析链中间层:节点显式配置 > Workflow One 默认值 > dsh 全局选择(跨渠道不错配:默认模型只在默认渠道生效,全局模型只在最终渠道恰为全局渠道时继承)。
lib/agent-defaults.js(normalize/validate/原子落盘 0600 + 解析链纯函数);新端点GET/PUT /wf1/api/agent-defaults;/wf1/api/llm-config改scoped:false(目录只读ctx.llm,设置面板无会话上下文);runAgentNode 切到统一解析链plugin-data/dsh-ccpg-orchestrator/state/agent-defaults.json(与飞书凭据同层级)——跨工作区偏好,且设置面板没有 workspace 上下文验证
npm test全量绿build-web.sh双构建通过;canvasui bundle--check逐字一致deepseek-official/deepseek-v4-flash+ High → 节点实际模型正是它(全局选择是 tokenhub-deepseek,证明默认值层生效),reasoningTokens: 1705;改成 Off 再跑 →reasoningTokens: 0。思考级别默认值真实影响 LLM 调用