Bundle
dshtools-sensevoice-input
SenseVoiceSmall-powered local speech-to-text for the DSH Desktop input box: click the mic beside the composer, speak, and the recognized draft (with language/emotion tags) is written into the input.
- Source
- ilovedyou6666-hub
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 5 days ago
Readme
# dshtools-sensevoice-input [](https://github.com/ilovedyou6666-hub/dshtools-sensevoice-input) [](https://www.npmjs.com/package/dshtools-sensevoice-input) [](https://opensource.org/licenses/MIT) [](https://github.com/ilovedyou6666-hub/dshtools-sensevoice-input/actions/workflows/ci.yml) 基于 [SenseVoiceSmall](https://www.modelscope.cn/models/iic/SenseVoiceSmall) 的 **DSH Desktop 本地语音输入插件**:点击输入框旁的 🎤 说话,文本自动写入输入框草稿,并显示语言/情感标签(如 `zh · NEUTRAL`)。支持 50+ 语言,全程本地 CPU 推理,音频不出本机。 ## 特性 - 🎤 composer 内嵌麦克风按钮,识别文本自动写入草稿(`inputActions.setDraft`) - 🏷️ 语言/情感标签解析(`<|zh|><|NEUTRAL|>…` → 结构化字段) - 🖥️ funasr + SenseVoiceSmall 本地推理,无任何云服务 - ⚡ 模型懒加载(首次 10–30s,之后单次几秒);Python 进程崩溃自愈 - 🌓 主题自适应 UI ## 安装 / 卸载 **1. 准备推理环境(一次性,约 5 GB)** ```powershell .\scripts\setup.ps1 # uv → Python 3.12 venv → torch/funasr → 下载 SenseVoiceSmall 模型 ``` > 默认安装到 `~\.dsh-sensevoice`,模型缓存 `~\.cache\modelscope`; > 也可自行用任意装有 funasr 的 Python,并通过环境变量 `DSHSENSEVOICE_PYTHON` 指定解释器。 **2. 安装插件(任选其一,重启 DSH Desktop 后生效)** ```powershell # npm(推荐;已上架 DSH 插件市场,市场内一键安装同款) dsh plugin --profile desktop add dshtools-sensevoice-input # GitHub 源码 dsh plugin --profile desktop add github:ilovedyou6666-hub/dshtools-sensevoice-input ``` > 若 PATH 中没有 `dsh`,在 DSH Desktop 内置终端执行,或从 设置 → 插件市场 安装。 > 更新:`remove` 后再 `add`(强制刷新);安装后可在 设置 → 插件 中确认。 **3. 卸载** ```powershell dsh plugin --profile desktop remove dshtools-sensevoice-input ``` ## 使用 1. 点击输入框左下 🎤 开始录音(再点结束,最长 60s); 2. 等待「♪ SenseVoice 正在识别…」,文本自动写入输入框; 3. 悬浮按钮可看模型就绪状态;失败显示具体原因,再点重试。 ## 开发 ```powershell pnpm install && pnpm check && pnpm test # 依赖 / 类型检查 / 测试 pnpm build # tsdown → lib/(host ESM + client bundle) pnpm verify:package && pnpm release:check # 包契约 / 发布元数据校验 ``` ``` src/ TypeScript 源码(host:桥/路由/内嵌 Python;client:组件/音频/API) tests/ vitest 测试 lib/ 构建产物(已提交,github 安装免构建) scripts/ setup.ps1 · verify-package · release-check .github/ CI / 发布工作流 / issue 模板 ``` ## 故障排查 | 现象 | 处理 | | --- | --- | | 点击后 `HTTP 405` / `403` | 旧版时序问题,更新到最新版并重启 | | 「无法访问麦克风」 | 允许 Electron 的麦克风权限 | | `python_not_found` | 先执行 `scripts\setup.ps1` | | `model_load_failed` | 模型缓存缺失,重跑 setup.ps1 的模型下载 | | 首次识别很慢 | 正常:CPU 加载模型 10–30s,之后复用 | ## 已知限制 - 离线批处理,无流式;单段 ≤ 60s; - 首次识别需等待模型加载; - 仅服务 127.0.0.1 桌面进程(桌面自带访问控制)。 ## 版本记录 详见 [CHANGELOG.md](./CHANGELOG.md)(当前 1.1.1)。 ## 许可证 MIT
Install
dsh plugin --profile web add github:ilovedyou6666-hub/dshtools-sensevoice-input
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dshtools-sensevoice-input from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.