@oadank/dsh-input-tools 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,8 @@
4
4
  - **host 入口**(`lib/index.js`):语音工具 + TTS 六引擎 + ASR + 音色克隆 + 自动语音回复
5
5
  - **client 入口**(`lib/client.js`):输入框工具条(图片/录音)+ 语音设置页 + 语音复制按钮
6
6
 
7
- 不修改任何 DSH 源码,拷包 + 配一行 + 重启即用。
7
+ 插件本体**不修改任何 DSH 源码**,通过 `dsh plugin` 命令安装注册即可用基础语音功能;
8
+ 完整语音体验(语音消息气泡 / AI 语音回复条)需配合源码补丁,见文末「语音源码补丁」。
8
9
 
9
10
  ## 功能
10
11
 
@@ -31,9 +32,11 @@
31
32
 
32
33
  ## 安装
33
34
 
34
- > `~/.dsh` DSH Web 运行时目录(Windows 为 `C:\Users\<你>\.dsh`)。
35
+ > 这是 **dsh 的命令**(不是 `npm i -g`):`dsh plugin` 会把插件装进指定的 profile
36
+ > (`~/.dsh/profiles/<name>/node_modules/`),不是装到 npm 全局。
37
+ > `~/.dsh` 指 DSH 运行时目录(Windows 为 `C:\Users\<你>\.dsh`)。
35
38
 
36
- ### 方式一(推荐):npm 一键安装
39
+ ### 方式一(推荐):dsh plugin 一键安装
37
40
 
38
41
  ```bash
39
42
  dsh plugin --profile web add @oadank/dsh-input-tools
@@ -56,11 +59,20 @@ dsh plugin --profile web add @oadank/dsh-input-tools
56
59
  name: '@oadank/dsh-input-tools'
57
60
  ```
58
61
 
59
- 3. **重启 dsh-web**:`nssm restart dsh-web`
62
+ 3. **重启 dsh-web 生效**(按你的系统选择一种):
63
+ - Windows + nssm 服务:`nssm restart dsh-web`
64
+ - Linux + systemd:`systemctl restart dsh-web`
65
+ - 手动启动:停掉当前 dsh 进程后重新运行启动命令
60
66
 
61
67
  ### 可选:本地 ASR(离线识别)
62
- 运行 `scripts/install-asr.ps1`(管理员):自动下载 sherpa-onnx + SenseVoice 模型、注册
63
- `asr` 常驻服务(端口 18790,开机自启),设置页 ASR 模式选「本地常驻服务」。
68
+
69
+ - **Windows**:管理员 PowerShell 运行 `scripts/install-asr.ps1`,自动下载
70
+ sherpa-onnx + SenseVoice 模型、注册 `asr` 常驻服务(端口 18790,开机自启)。
71
+ - **Linux**:手动部署 sherpa-onnx 离线识别服务(监听 127.0.0.1:18790,
72
+ 接口 `POST /transcribe {"audioPath":"..."}` / `GET /health`),或使用 ASR 的
73
+ cmd/api 模式。
74
+
75
+ 设置页 ASR 模式选「本地常驻服务」指向 18790 即可。
64
76
 
65
77
  ## 配置
66
78
 
@@ -83,52 +95,66 @@ ASR 模式都在设置页「语音服务」分区配置。
83
95
  2. PATH 探测(`where ffmpeg` / `which ffmpeg`)
84
96
  3. 兜底已知安装位置
85
97
 
86
- **安装**:Windows 执行 `winget install ffmpeg`(装完一般会自动加 PATH),
87
- 或把 ffmpeg.exe 所在目录加入 PATH。装好后无需任何配置,插件自动探测;
88
- 若装在特殊位置,设环境变量 `DSH_VOICE_FFMPEG_BIN=C:\路径\ffmpeg.exe` 即可。
98
+ **安装**:Windows 执行 `winget install ffmpeg`(装完一般会自动加 PATH);
99
+ Linux(Debian/Ubuntu)执行 `sudo apt install ffmpeg`。装好后无需任何配置,插件自动探测;
100
+ 若装在特殊位置,设环境变量 `DSH_VOICE_FFMPEG_BIN=/路径/ffmpeg` 即可。
89
101
 
90
102
  > 没有 ffmpeg 时:本地 ASR(service/cmd 模式)和克隆样本的非 mp3/wav 格式转换会失败,
91
103
  > 但小米/edge 在线 TTS 不受影响。
92
104
 
93
- ## 来源
94
-
95
- 由 `dsh-composer-plugin`(client 工具条)与 `dsh-host-voice`(host 语音)合并重写而来,
96
- 2026-08-21 统一为单包双入口。原 dsh-host-voice 的 git 历史备份在
97
- `plugins/_archive/dsh-voice-plugin-git-*.bundle`。
98
-
99
105
  ## 语音源码补丁(完整体验原生语音消息,可选)
100
106
 
101
107
  dsh 的 npm 安装版(0.1.0-rc.7)**契约不支持原生语音消息**(voice content、语音消息气泡、
102
108
  AI 语音回复条均为本地源码增强,官方源码/官方发布版默认都没有)。要用完整语音体验,
103
- **必须使用官方源码 + 本补丁**(推荐),或直接使用本项目 fork(oadank/deepseek-harness)。
109
+ **二选一**:
104
110
 
105
- ### 完整安装流程(小白照做)
111
+ ### 方案 A:官方源码 + 破解脚本(推荐,来源可信)
106
112
 
107
- 1. **官方源码安装**(无 git 先装 git;Windows 建议装到 D:\opt 下):
113
+ 1. **克隆官方源码**(任意目录,位置不限):
108
114
  ```bash
109
115
  git clone https://github.com/deepseek-ai/deepseek-harness.git
110
116
  cd deepseek-harness
111
117
  git checkout 141eb6fef8 # 官方 dsh-0.1.0-rc.8 release 合并点
112
118
  ```
113
- 2. **打语音补丁**(Windows 管理员 PowerShell,脚本会自动探测源码位置,
114
- 也可以在源码仓库根目录直接运行):
119
+ 2. **打语音补丁**(Windows 管理员 PowerShell;脚本自动探测源码位置,
120
+ 找不到时会提示你输入源码路径):
115
121
  ```powershell
116
122
  # 插件 npm 安装后,补丁在本机位置:
117
123
  cd node_modules\@oadank\dsh-input-tools\patches
118
124
  powershell -ExecutionPolicy Bypass -File apply-voice-patch.ps1
119
125
  ```
120
- 脚本自动:探测/指定源码仓库 → 校验补丁可应用 → 备份未提交改动 → 应用 → 幂等(已打跳过)。
126
+ 脚本自动:探测/输入源码仓库 → 校验补丁可应用 → 备份未提交改动 → 应用 → 幂等(已打跳过)。
121
127
  3. **构建并启动**:
122
128
  ```bash
123
129
  pnpm install
124
130
  pnpm run build:web # 前端语音气泡渲染在此步生效
125
- dsh --profile web # 或注册 nssm 服务方式启动
131
+ dsh --profile web # 或注册为系统服务(Windows 可用 nssm
126
132
  ```
127
133
  4. **安装语音插件**:`dsh plugin --profile web add @oadank/dsh-input-tools`
128
- 5. **可选:本地 ASR**:运行插件内 `scripts\install-asr.ps1`(管理员),
129
- 自动下载 sherpa-onnx + SenseVoice 模型、注册 `asr` 常驻服务(端口 18790)。
134
+ 5. **可选:本地 ASR**:见上文「可选:本地 ASR」。
135
+
136
+ ### 方案 B:直接克隆改造版(自带语音,零脚本)
137
+
138
+ 改造版 fork 已内置全部语音改造(与方案 A 打补丁后的结果一致),跳过第 2 步:
139
+
140
+ ```bash
141
+ git clone https://github.com/oadank/deepseek-harness.git
142
+ cd deepseek-harness
143
+ # 已是语音改造版,无需 checkout / 无需打补丁
144
+ pnpm install
145
+ pnpm run build:web
146
+ dsh --profile web
147
+ ```
148
+
149
+ 之后同样执行「安装语音插件」和「可选:本地 ASR」。
130
150
 
131
- > 补丁/脚本已随 npm 包发布(`patches/` 目录),git 仓库同步维护。
132
- > 警告:补丁基于官方 rc.8(141eb6fef8)。官方 master 更新后补丁可能冲突,请 checkout 到该基线或等待补丁更新。回滚:git apply -R 或 git checkout -- 文件。勿在官方 master 上直接打补丁。
151
+ ### 说明与限制
133
152
 
134
- **npm 版(rc.7)说明**:语音输入(录音→ASR→发送)可用;AI 语音可合成(音频生成);但语音消息气泡/语音回复条受 rc.7 前端限制无法原生显示(插件 DOM 注入方案受 React 重渲染影响不稳定,已禁用)。完整体验请使用上面的源码版。
153
+ - 补丁/脚本已随 npm 包发布(`patches/` 目录),git 仓库同步维护。
154
+ - **补丁基线**:官方 commit `141eb6fef8`(dsh-0.1.0-rc.8 release 合并点)。
155
+ 官方后续更新的 master 与本补丁可能不兼容,**请先 `git checkout 141eb6fef8` 再打补丁**;
156
+ 若已应用过,重跑脚本会检测到并跳过(幂等)。
157
+ 回滚:`git apply -R <patch>` 或 `git checkout -- <文件>`。
158
+ - **npm 版(rc.7)说明**:语音输入(录音→ASR→发送)可用;AI 语音可合成(音频生成);
159
+ 但语音消息气泡/语音回复条受 rc.7 前端限制无法原生显示(插件 DOM 注入方案受 React
160
+ 重渲染影响不稳定,已禁用)。完整体验请使用源码版(方案 A 或 B)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oadank/dsh-input-tools",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -107,6 +107,6 @@ Write-Host "==== 完成 ====" -ForegroundColor Cyan
107
107
  Write-Host "后续步骤:"
108
108
  Write-Host " 1. pnpm install"
109
109
  Write-Host " 2. pnpm run build:web (构建前端,语音气泡渲染在此步生效)"
110
- Write-Host " 3. dsh --profile web nssm 服务方式启动"
110
+ Write-Host " 3. 启动 dsh:dsh --profile web(Windows 可注册为 nssm/systemd 服务)"
111
111
  Write-Host " 4. 安装语音插件:dsh plugin --profile web add @oadank/dsh-input-tools"
112
112
  Write-Host "回滚:git checkout -- <文件> 或 git apply -R $Patch"