fix: v0.8.0 修订 — 思考用户意图优先 · 移除元信息硬门控 · 实施清单入库
- 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:
@@ -126,11 +126,10 @@ export class MimoAdapter extends OpenAICompatibleAdapter {
|
||||
|
||||
// Thinking 模式(与 DeepSeek 参数结构一致)
|
||||
// MiMo API 默认 thinking.type = "enabled",必须显式发送 disabled 才能关闭
|
||||
// v0.8.0 P0-3: 模型能力门控 —— supportsThinking===false 的模型强制 disabled
|
||||
//(思考 token 计入 max_completion_tokens,能力不符的模型上会耗尽输出预算)
|
||||
const modelThinkingSupported =
|
||||
MimoAdapter.MODEL_INFO[this.config.defaultModel]?.supportsThinking !== false;
|
||||
const wantThinking = request.params.thinkingEnabled !== false && modelThinkingSupported;
|
||||
// v0.8.0 修订(用户意图优先): 思考参数完全遵循用户配置,不再按
|
||||
// supportsThinking 元信息硬门控 —— 预算耗尽风险由引擎空响应守卫的
|
||||
// 降级重试链路兜底;元信息与配置不符时仅告警不拦截。
|
||||
const wantThinking = request.params.thinkingEnabled !== false;
|
||||
if (!wantThinking) {
|
||||
// 显式禁用思考:传 disabled + temperature/top_p(非思考模式下这两个参数有效)
|
||||
body.thinking = { type: 'disabled' };
|
||||
@@ -140,6 +139,12 @@ export class MimoAdapter extends OpenAICompatibleAdapter {
|
||||
// 启用思考(包括 undefined,因为 MiMo 默认 enabled)
|
||||
// 思考模式下 temperature/top_p 被 API 强制覆盖为 1.0/0.95,不传
|
||||
body.thinking = { type: 'enabled' };
|
||||
// 元信息标注不支持思考但用户开启 —— 告知降级兜底路径(不拦截)
|
||||
if (MimoAdapter.MODEL_INFO[this.config.defaultModel]?.supportsThinking === false) {
|
||||
log.warn(
|
||||
`[MiMo] model "${this.config.defaultModel}" metadata says thinking unsupported — sending thinking params per user config (degraded retry handles budget exhaustion)`,
|
||||
);
|
||||
}
|
||||
// v0.8.0 P0-3: 思考占用输出预算 —— 钳制后预算过小时显式告警
|
||||
const effectiveMax = body.max_completion_tokens as number;
|
||||
if (typeof effectiveMax === 'number' && effectiveMax < 8192) {
|
||||
|
||||
Reference in New Issue
Block a user