wangzhanchao883/dsh-hold-to-talk0

dsh-hold-to-talk

DSH Web 输入框长按语音输入插件:支持本地离线语音识别(SenseVoice),无需 API 密钥,松开即可将文字插入草稿。

AI 分析

核心用途是提供类似微信电脑版的长按语音输入体验。适合习惯语音输入、且对隐私和离线识别有较高要求的用户。

包名
dsh-hold-to-talk
版本
0.1.2
许可证
MIT
最近更新
2026年9月11日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:wangzhanchao883/dsh-hold-to-talk

Configuration

Namespace dsh-hold-to-talk (written to settings.yaml by the Web settings panel), or override in the profile's cordis.patch.yml:

- id: dsh-hold-to-talk
  name: dsh-hold-to-talk
  config:
    holdThresholdMs: 400     # long-press threshold
    cancelSlidePx: 60        # slide-up-to-cancel distance
    interimIntervalMs: 1500  # live-preview cadence
    maxWindowSec: 6          # preview decode window; the final always uses all audio
    minHoldMs: 250           # shorter holds are discarded (mis-taps)
    maxHoldMs: 60000         # auto-finish limit
    autoSend: false          # insert only; never auto-send by default
    language: auto           # auto / zh / en / ja / ko / yue
    useItn: true             # inverse text normalization ("二零二六" -> "2026")
    numThreads: 2            # native engine threads
    mirror: https://hf-mirror.com
    modelDir: ""             # empty = ~/.dsh/hold-to-talk/models

Priority: settings panel > cordis.patch.yml > plugin defaults.

首次使用

页面加载后插件会在后台自动下载模型(model.int8.onnx 228MB + tokens.txt,走 hf-mirror.com,支持断点续传)。下载期间长按会看到"语音模型准备中 x%",只会发生一次。想提前下好:

npm run model:fetch

模型缓存在 ~/.dsh/hold-to-talk/models/(可用 modelDir 改)。

配置

设置命名空间 dsh-hold-to-talk(Web 设置面板写入 settings.yaml),或在 profile 的 cordis.patch.yml 里按 id 覆盖:

- id: dsh-hold-to-talk
  name: dsh-hold-to-talk
  config:
    holdThresholdMs: 400     # 长按判定阈值
    cancelSlidePx: 60        # 上滑取消的位移
    interimIntervalMs: 1500  # 实时预览间隔
    maxWindowSec: 6          # 预览解码的滑动窗口上限;定稿始终用完整音频
    minHoldMs: 250           # 短于此时长直接丢弃(防误触)
    maxHoldMs: 60000         # 单次长按上限,到点自动定稿
    autoSend: false          # 定稿后是否自动发送(默认只写进输入框)
    language: auto           # auto / zh / en / ja / ko / yue
    useItn: true             # 逆文本规整("二零二六年"→"2026年")
    numThreads: 2            # 原生引擎线程数
    mirror: https://hf-mirror.com
    modelDir: ""             # 留空 = ~/.dsh/hold-to-talk/models

优先级:设置面板 > cordis.patch.yml > 插件默认值。

使用

  1. 打开任意会话,把鼠标停在输入框上按住不动约 0.4 秒(首次会弹麦克风授权,允许)。
  2. 浮层出现后开始说话,字幕会一段一段跟上来。
  3. 松手 → 定稿文字追加进输入框,由你自己按发送。
  4. 说错了就按住上滑再松手,或按 Esc 直接丢弃。