fix: v0.8.0 修订 — 思考用户意图优先 · 移除元信息硬门控 · 实施清单入库
CI / 类型检查 + Lint + 单元测试 (push) Failing after 9m8s
CI / 全量测试 (Electron ABI) (push) Failing after 6m8s
CI / 产物编译验证 (push) Successful in 11m1s

- DeepSeek/MiMo/Agnes 移除 supportsThinking 元信息硬门控:思考参数完全遵循用户配置
  (事故复盘中 vision-exp 元信息标注不支持思考、实际产生了 8189 token 推理内容,
  元信息不可靠;预算耗尽由引擎降级重试兜底,元信息不符仅告警不拦截)
- Ollama 保留 /api/show 能力探测门控(服务端硬协议约束:向不支持思考的模型发
  think 每次请求 400,属协议正确性而非意图覆盖),探测失败 fail-open
- LLM 设置提示文案修订:元信息不符仍按用户配置发送,降级重试自动兜底
- 测试契约反向钉住:vision-exp + 用户开启→照发 enabled+reasoning_effort;
  关闭/未配置→显式 disabled;Ollama 探测 false→不发 think / null→fail-open
- 补录 docs/v0.8.0-迭代实施清单.md(含逐项验证记录与本次修订记录;
  首次提交时该文件因故未入库,本次补齐)
- 验证:typecheck 0 错误 / lint 0 问题 / 系统 Node 2146 通过 / thinking 矩阵 101 用例全绿
This commit is contained in:
2026-09-05 20:49:20 +08:00
parent 5b9d4d19b3
commit 839860083f
9 changed files with 312 additions and 56 deletions
+10 -7
View File
@@ -99,19 +99,22 @@ export class AgnesAdapter extends OpenAICompatibleAdapter {
// 显式发送 enable_thinking:false —— 原实现只在 thinkingEnabled===true 时写该字段,
// 若服务端默认开启思考,客户端没有任何路径把它关掉(DeepSeek/MiMo 均显式发送
// disabled 保持对称,唯独此处漏了)。
// v0.8.0 P0-3: 模型能力门控 —— supportsThinking===false 的模型强制关闭思考
// v0.8.0 修订(用户意图优先): enable_thinking 完全遵循用户配置,不再按
// supportsThinking 元信息硬门控 —— 预算耗尽风险由引擎空响应守卫的降级
// 重试链路兜底;元信息与配置不符时仅告警不拦截。
{
const effort = request.params.thinkingEffort ?? 'high';
const modelThinkingSupported =
AgnesAdapter.MODEL_INFO[this.config.defaultModel]?.supportsThinking !== false;
// 未配置 thinkingEnabled 一律显式关闭 —— 与 DeepSeek/MiMo 的"服务端默认开启,
// 必须显式发送 disabled"口径对齐,让行为确定性不依赖服务端隐式默认。
const wantThinking =
request.params.thinkingEnabled === true && effort !== 'low' && modelThinkingSupported;
const wantThinking = request.params.thinkingEnabled === true && effort !== 'low';
body.chat_template_kwargs = { enable_thinking: wantThinking };
if (request.params.thinkingEnabled === true && !modelThinkingSupported) {
if (
request.params.thinkingEnabled === true &&
wantThinking &&
AgnesAdapter.MODEL_INFO[this.config.defaultModel]?.supportsThinking === false
) {
log.warn(
`[Agnes] model "${this.config.defaultModel}" does not support thinking — sending enable_thinking:false (P0-3 capability gate)`,
`[Agnes] model "${this.config.defaultModel}" metadata says thinking unsupported — sending enable_thinking per user config (degraded retry handles budget exhaustion)`,
);
}
}