wuxinzhe/dsh-cyberdog-speech-sherpa ↗★ 2
dsh-cyberdog-speech-sherpa
DeepSeek Harness 本地离线语音插件:STT 语音识别 + TTS 语音合成 + WebUI 按住说话(Sherpa-ONNX)
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:wuxinzhe/dsh-cyberdog-speech-sherpa说明文档
阅读完整 README ↗dsh-speech-sherpa
DeepSeek Harness(dsh)本地离线语音插件,基于 Sherpa-ONNX。
- 全本地离线,不联网、不收费、CPU 可运行
- STT:Zipformer 中文流式识别(
stt_transcribe) - TTS:VITS 中文多音色(
tts_speak) - WebUI 按住说话:聊天输入框工具行 🎤 按钮——按住录音、松开发送(最长 120 秒,带倒计时)
架构
dsh-speech-sherpa/
├── index.mjs # host 插件(Cordis):注册 3 个工具 + HTTP 路由
├── remote.mjs # HTTP 路由(/speech-api/*,浏览器录音按钮直调)
├── http-body.mjs # HTTP 请求体读取
├── core/ # 平台无关核心(STT/TTS/模型管理/WAV 编解码)
│ ├── index.js # createSpeechService() 门面
│ ├── models.js # 模型管理(状态/下载/断点续传/镜像回退)
│ ├── stt.js # 语音识别(wav 文件 / data URL)
│ ├── tts.js # 语音合成(data URL / wav 文件)
│ └── wav.js # WAV 编解码 + 8kHz→16kHz 重采样
├── client/ # 浏览器端插件(录音按钮)
│ ├── index.ts # 源码(TSX)
│ └── dist/client.js # 构建产物(CJS factory bundle)
├── cordis.bundle.yml # dsh bundle patch(dsh plugin add 安装)
├── cordis.patch.yml # --patch 开发加载示例
└── scripts/
├── build-client.mjs # 构建 client bundle(esbuild)
└── verify-dsh.mjs # 插件契约验证(mock cordis ctx)
安装
dsh plugin --profile add /path/to/dsh-speech-sherpa
# 或从 git:dsh plugin --profile add github:you/dsh-speech-sherpa
开发期用 --patch:
cd
pnpm dsh --profile web --patch C:\Users\Administrator\Documents\dsh-speech-sherpa\cordis.patch.yml --port 3099
工具
| 工具 | 输入 | 输出 |
|---|---|---|
stt_transcribe | audioPath(wav 文件)或 audioBase64(data URL) | {text} |
tts_speak | text、speed?、sid?、inline? | {audioPath, text, dataUrl?} |
sherpa_models_download | kinds?(['stt','tts']) | {results, modelDir} |
模型自愈:stt_transcribe/tts_speak 发现模型缺失会报错并提示调用 ,agent 可自行下载。