Skip to content

Releases: wuwan911-cell/dsh-relay-reasoning

v2.0.0 — 中转站推理等级:关/低/中/高/max 五档

Choose a tag to compare

@wuwan911-cell wuwan911-cell released this 18 Oct 12:58

dsh-relay-reasoning v2.0.0

让 DSH 支持中转站的推理等级:为每个模型提供 关 / 低 / 中 / 高 / max 五档可选,适配任意 OpenAI 兼容中转站。

它是做什么的

中转站(比如自建网关、一个地址挂很多模型)接受 reasoning_effort 参数,但 DSH 对它们不显示任何推理控制。原因是结构性的:@deepseek-ai/dsh-llm-pi-ai 只给声明了 reasoningEfforts 字段的模型提供可选档位,手工配置的路由什么都不显示。

插件激活时把 reasoningEfforts 写进 llm-pi-ai 条目的每个模型,选择器立刻出现这五档。不用重启,也不用改你的模型列表。

为什么是这五档

pi-ai 认识七档,但中转站并不能把七档都区分开。用三道题、跑两轮实测,各档推理 token 中位数:

档位 推理 token 中位数
关 0
minimal 108
低 122
中 155
高 142
xhigh 125
max 359

max 大约是其它档的两倍,是真实更强的一档,所以默认提供。

中间五档(minimal ~ xhigh)在这条路由上互相落在噪声范围内,放出来只是重复选项,因此不提供。需要时可经 levels 自行指定。

需要注意的两个实现细节

不覆盖 llm-pi-ai 那一行。 Cordis 的 loader patch 是整体替换该行的 config,用 patch 加字段会把 baseURL、密钥引用和整个模型列表冲掉。插件改用 settings.mutate() 做路径级写入,只碰 providers.<name>.models[i].reasoningEfforts。

在激活事务之外写入。 HMR 配置编辑器拒绝嵌套事务,而它的 AsyncLocalStorage 守卫会跨 await 和 timer 传播,单纯延后无效。插件等 Loader 稳定后,通过 hmr.executing.exit() 在无事务上下文中写入。

配置

- insert:
    - id: relay-reasoning
      name: dsh-relay-reasoning
      config:
        target: llm-pi-ai                      # 要配置的 profile 条目
        providers: []                          # 空 = 该条目下所有 provider
        levels: [off, low, medium, high, max]  # 可改,按升序写入
        force: false                           # true = 即使已正确也重写
        debugLog: ""                           # 可选,诊断日志路径

providers: [] 表示覆盖该条目上所有 provider,新增中转站不用改插件。写入是幂等的:配置已经对了就跳过,不会反复折腾。

如果你的中转站不认 max,用 levels: [off, low, medium, high] 去掉它。

安装

plugin_manager install_bundle → dsh-relay-reasoning

需要 DSH >=0.2.1-rc.1。零运行时依赖,只用 node:fs 和宿主服务。MIT 许可。