Repository navigation
feat(adapter): 传输感知的 effort 判定,标题档位改为可配置 - #133
Merged
Merged
Conversation
effort 是否可上线原先只查模型快照(KNOWN_EFFORTS)。目录把声明了 off 的 DeepSeek V4 模型标成支持 /provider/v1/messages 之后,该模型的标题调用 (purpose 强制 off)把 output_config.effort:"off" 发到本端点,上游只接受 low|medium|high|xhigh|max,回 HTTP 400 invalid_request_error(2026-11-25 真实账号实测:关闭 400、默认 200)。 改动: - effortOnWire(intent, model, transport):模型快照决定档位是否存在,传输 决定拼写是否合法,两者都满足才上线;三个组包函数各自传入自己的 transport。 - GenerateCallFacts.reasoningEffort 改名 effortIntent,避免把"想发什么" 与"能发什么"混为一个值;追踪记录改记实际发出的档位。 - Config.titleEffort:off(默认,维持 Mars-Sea#88)| low(三条传输都接受的最低 档)| inherit(跟随调用方)。 - 文档与用例同步:Messages 通道在 off 上不发 output_config,chat 与 CLI 仍原样发送。 默认值边界:唯一的行为变化是"本来会被上游以 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.
背景
deepseek/deepseek-v4.1-flash的标题辅助调用在 DSH 中失败:同一会话的普通对话正常。这是 #122(GOAT 套餐的历史消息 thinking 回传)之外的另一条 400 路径。
复现(真实账号,2026-11-25)
同一会话、同一模型,仅改变推理强度:
off)invalid_request_error默认档通过,说明端点接受该模型,
thinking: { type: 'adaptive' }与max_tokens: 4096都不成问题。原因
标题请求带
purpose: 'session-title',适配器在模型快照声明off时强制该档位;KNOWN_EFFORTS['deepseek/deepseek-v4.1-flash']含off,因此请求必然以off发出。同时目录已把该模型标记为支持/messages:routesToMessages()据此把它路由到/provider/v1/messages,buildMessagesBody()再把 effort 写进output_config。而该端点的取值集合是low | medium | high | xhigh | max。原判断只查了模型快照这一项:
「模型声明
off」与「该端点接受off」是两件事,此前两个集合不相交(声明off的 DeepSeek 只走 chat/cli,走 messages 的只有 Claude 且不声明off),目录开放/messages后首次相交。关于上游语义:仅凭一次 400 无法区分「端点枚举不含
off」与「Command Code 对off整体不提供支持」。两者的适配器结论相同——off不应出现在 Messages 请求里。改动
effortOnWire(intent, model, transport):模型快照决定档位是否存在,传输决定拼写是否合法,取交集;三个组包函数各自传入自己的通道(chat / cli / messages)。GenerateCallFacts.reasoningEffort改名effortIntent:只往下传「这次想用什么」,不放「能发什么」;流追踪改记实际发出的档位,否则日志无法解释线上报文。Config.titleEffort:off(默认,维持 会话标题自动生成必定失败:辅助调用(purpose: 'session-title')未下发reasoning_effort,64 token 预算被推理全额吃光 #88)|low(三条传输都接受的最低合法档)|inherit(跟随调用方)。无论取哪个值,仍要经过effortOnWire。默认值边界
唯一的行为变化是「本来会被上游以 400 拒绝的请求不再发出」:
off在 Messages 通道退化为不发送output_config(等价于你实测通过的「默认」),在 chat 与 CLI 上仍原样发送;low/inherit是新选项,默认不启用。titleEffort默认off,#88的契约不变。测试
Messages 通道丢弃 off:标题调用与手选关闭都不发 output_config:目录把 DeepSeek 模型路由到/messages,断言请求落在该端点、off不产生output_config、high仍照发。titleEffort 决定标题调用的意图,取值仍受传输约束:off→ 丢弃、low→{ effort: 'low' }、inherit→ 跟随调用方。off。本地结果:
tests/adapter.test.ts382/382;npm test1250/1250;npm run typecheck退出码 0;npm run build通过,lib/已重建并随本 PR 提交。未验证与后续
titleEffort控件,只能通过 profile 配置设置;需要的话可以单独补一个下拉框与中英文案。