deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
PROJECT README
DeepSeek Harness Web 语音输入插件:在输入框发送键同一行、靠发送键左侧加一个「按住说话」麦克风按钮。松手后语音在本机离线转成文字并追加到当前草稿,不自动发送。模型免费、离线,中文/英文/中英夹杂(以及日/韩/粤)均可识别。
Voice input plugin for the DeepSeek Harness Web UI: hold the mic button next to the send key to talk; on release the audio is transcribed by a local offline ASR engine and appended to the draft. It never auto-sends. Free, offline, zh/en mixed supported.
双端插件(一个包,两个半边):
| 半边 | 位置 | 职责 |
|---|---|---|
| 主机 half | src/index.ts → lib/index.js |
极简 HTTP 服务,只监听 127.0.0.1:18765;sherpa-onnx + SenseVoice-Small INT8 离线识别;模型缺失时自动下载 |
| 浏览器 half | src/client/index.ts → lib/client.js |
麦克风按钮(官方 slot conversation.input.right);MediaRecorder 16 kHz 单声道录音;WAV 编码后 POST 到本机 ASR;用官方事件把文本追加进草稿 |
conversation.input.right(发送键左侧同一行),不替换 composer、不动发送键。slash/input-insert-text(payload { text, span },span 带 draftRev CAS)追加到草稿末尾;草稿非空时前面补一个空格。sherpa-onnx-node(npm 包,含 Windows x64 预编译二进制)+ 模型 sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2024-07-17(INT8,model.int8.onnx ≈ 228 MB,压缩包 ≈ 229 MB)。cd D:\dsh\dsh-plugin-voice-input
npm install # 安装 sherpa-onnx-node 原生扩展 + 构建工具(一次性)
npm run build # 产出 lib/index.js(主机半边)和 lib/client.js(浏览器半边)
npm run typecheck # 可选
浏览器半边需要行名是可解析的包名(client-modules 会读 <name>/package.json),--patch 里放文件路径只能加载主机半边:
dsh web --patch D:\dsh\dsh-plugin-voice-input\cordis.dev.yml
# 验证服务:
Invoke-RestMethod http://127.0.0.1:18765/health
dsh plugin --profile web add D:\dsh\dsh-plugin-voice-input
# 重启 dsh web(插件集在启动时读取)
dsh web --port 3080
打开 http://127.0.0.1:3080,发送键旁应出现麦克风按钮。卸载:
dsh plugin --profile web remove dsh-plugin-voice-input
注意:
dsh plugin add会修改$DSH_HOME/profiles/web的 profile 清单;正在运行的实例需要重启后才生效。
dsh plugin --profile web add github:<owner>/dsh-plugin-voice-input
首次安装时 pnpm ≥10 会拒绝执行 git 依赖的 prepare 构建脚本,按 dsh 提示把包名加进 profile 的 pnpm-workspace.yaml:
allowBuilds:
dsh-plugin-voice-input: true
再重跑一次 add 即可(prepare 会自动构建 lib/;模型在首次识别时自动下载)。建议固定到某个提交:github:<owner>/dsh-plugin-voice-input#<sha>。
首次识别(POST /asr)时自动下载 sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2024-07-17.tar.bz2(约 229 MB)到插件数据目录,并用系统自带 tar(Windows 10+ 自带)解压。GET /health 可看下载进度。
数据目录(默认):$DSH_HOME/plugins/dsh-plugin-voice-input,未设置 DSH_HOME 时是 ~\.dsh\plugins\dsh-plugin-voice-input。
也可以手动下载(放对位置后不会再触发自动下载):
$dir = if ($env:DSH_HOME) { "$env:DSH_HOME\plugins\dsh-plugin-voice-input" } else { "$HOME\.dsh\plugins\dsh-plugin-voice-input" }
New-Item -ItemType Directory -Force -Path $dir | Out-Null
Invoke-WebRequest "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2024-07-17.tar.bz2" -OutFile "$dir\sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2024-07-17.tar.bz2"
tar -xjf "$dir\sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2024-07-17.tar.bz2" -C $dir
| 项 | 值 |
|---|---|
| ASR 服务 | http://127.0.0.1:18765(只绑回环,不监听 0.0.0.0) |
DSH_VOICE_ASR_PORT |
覆盖端口(默认 18765) |
DSH_VOICE_DATA_DIR |
覆盖模型数据目录 |
| CORS | 仅接受 localhost / 127.0.0.1 / ::1 / 内网地址来源的页面 |
sherpa-onnx-node(^1.13.5,随 npm install 自动装好,含预编译二进制,无需 GPU/Electron/Docker)。tar.exe(模型解压用)。dsh web 打开后,发送键左侧能看到麦克风按钮。dsh web 启动(或停掉 18765 端口)时按按钮 → 提示「语音服务不可用」。Invoke-RestMethod http://127.0.0.1:18765/health 返回 ok: true(模型就绪后)。MIT 协议开源,欢迎任何人提 Issue / PR 共同维护。本地开发环境:
git clone git@github.com:<owner>/dsh-plugin-voice-input.git
cd dsh-plugin-voice-input
npm install # 依赖(含 sherpa-onnx-node 原生扩展与 esbuild)
npm run build # 产出 lib/index.js 与 lib/client.js
npm run typecheck # 类型检查
node scripts/test-host.mjs # 主机半边独立冒烟(不需要 dsh)
dsh --profile web --patch D:\dsh\dsh-plugin-voice-input\cordis.dev.yml # 主机半边联调
修改后 npm run build 再验证。常见贡献方向:VAD/流式识别、录音格式回退、更多语言、错误文案与 i18n。
draftRev CAS,若识别期间用户改过草稿且已提交(draft 已清空/更换),插入失败会提示重试;普通打字不影响(按识别完成时的最新草稿追加)。auto),不按会话固定语言。CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。