yfwu2020/dsh-selection-explain ↗★ 0

@yfwu2020/dsh-selection-explain

DSH 划词解读:选中文字浮出按钮,点击弹窗流式显示专业中英翻译 + 该文字在当前上下文中的含义详解 适合在阅读或对话中需要快速翻译和专业词汇释义的用户。

Package
@yfwu2020/dsh-selection-explain
Compatibility
Unverified
Harness peer range
>=0.1.5-rc <2
Cordis peer range
>=4.0.2 <5
Version
0.1.3
License
MIT
Last updated
Sep 25, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:yfwu2020/dsh-selection-explain

配置

配置写在 profile 的 cordis.patch.yml 里同 id 的行上(dsh plugin add 装好后,包自带的 cordis.patch.yml 里已有可改的样板):

- insert:
    - id: selection-explain
      name: '@yfwu2020/dsh-selection-explain'
      config:
        reasoningEffort: high
        sessionContextMaxMessages: 24

下表默认值取自 src/index.ts 的 Config schema,也就是推荐值。 不填即用默认。

模型与推理

字段默认说明
provider''固定 provider 路由;留空 = 跟随「设置 → 默认模型」
model''固定 model id;留空 = 跟随默认模型
reasoningEfforthigh详解阶段推理档位(off / low / high / max)
translationReasoningEffortlow首轮翻译单独一档。这一轮只需挑英文片段,压低换首字速度
chatReasoningEfforthigh追问档位(追问要准不要快;想更快可调 low)
temperature-1采样温度。-1 = 不传,交给供应商默认(与主会话一致);0~2 之间才真的传
maxTokens0单次输出上限(tokens)。0 = 不限制。填正数可控成本 / 控时延
timeoutMs300000单次调用超时(含工具轮;客户端断开即中止上游)

推理档位三档分开是有原因的:翻译不需要深度推理,详解需要。默认 translationReasoningEffort: low 让首字快、reasoningEffort: high 让详解细。

上下文与缓存

字段默认说明
maxSelectionChars4000选中文字长度上限(超了不出现按钮,host 侧也会拦截并给出明确报错)
maxContextChars12000局部上下文上限(选区前后各取一段窗口)
sessionContexttrue是否注入当前会话的对话背景(判断指代与前提的关键)
sessionContextFastMessages8首轮翻译用的背景条数;越小首字越快
sessionContextMaxMessages24详解 / 追问用的背景条数(自选中文字所在消息向上取)
sessionContextMaxChars0会话背景字符上限;0 = 不限(只按条数取窗口)
resultCacheTtlMs600000共享结果缓存 TTL(毫秒);0 = 关闭
historyMaxEntries20小窗对话历史保留多少个划词条目;0 = 关闭历史
maxRequestsPerMinute40本地限流,防误触发刷爆额度

工具(联网 / 文件)

字段默认说明
toolstrue是否允许解读过程调用工具
toolNamesadvanced_search,platform_search,read,grep,glob工具白名单(逗号分隔)。默认用 free-search 插件的搜索工具,支持多引擎、时间过滤、平台搜索
fallbackToolNamesweb_search备用清单:只在首选里的联网工具一个都不在时才补进来(没装 free-search 时兜底)
maxToolRounds2最多几轮工具调用(用完会补一轮不带工具的收尾,避免"转半天没回答")
toolResultMaxChars3000单个工具结果注入模型前的字符上限
toolReadRoot''文件类工具(read/grep/glob)的读取边界:'' = 会话工作目录,'*' = 不限制,其他 = 指定目录。越界在执行前被拒