@oadank/dsh-input-tools 0.3.9 → 0.3.11
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 +76 -121
- package/assets/screenshots/input-toolbar.png +0 -0
- package/assets/screenshots/voice-capabilities-asr.png +0 -0
- package/assets/screenshots/voice-message-bubbles.png +0 -0
- package/assets/screenshots/voice-settings-local-ali.png +0 -0
- package/assets/screenshots/voice-settings-xiaomi.png +0 -0
- package/package.json +1 -1
- package/patches/dsh-voice-rc8.patch +37 -0
package/README.md
CHANGED
|
@@ -1,160 +1,115 @@
|
|
|
1
|
-
# dsh-input-tools ——
|
|
1
|
+
# dsh-input-tools —— DSH Web 多功能增强插件
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- **host 入口**(`lib/index.js`):语音工具 + TTS 六引擎 + ASR + 音色克隆 + 自动语音回复
|
|
5
|
-
- **client 入口**(`lib/client.js`):输入框工具条(图片/录音)+ 语音设置页 + 语音复制按钮
|
|
3
|
+
给 DSH Web 加全套实用能力:**语音**(录音输入 / 多引擎 TTS / 离线 ASR / 音色克隆 / 语音气泡 / AI 语音回复)、**图片**(文本模型也能发图识图)、**余额显示**。
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
- **host**(服务端):语音工具 + TTS 六引擎 + ASR + 音色克隆 + 自动语音回复
|
|
6
|
+
- **client**(浏览器):输入框工具条(图片/录音)+ 语音设置页 + 余额显示 + 语音文本复制
|
|
9
7
|
|
|
10
8
|
## 功能
|
|
11
9
|
|
|
12
|
-
###
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| `voiceclone` | 小米音色克隆(参考音频复刻音色,15-60 秒最佳) |
|
|
22
|
-
| `edge` | 微软 Edge(免费无 key) |
|
|
23
|
-
| `local` | 本地 TTS(HTTP 常驻服务优先,命令兜底) |
|
|
24
|
-
| `ali` | 阿里 qwen3-tts |
|
|
25
|
-
- **ASR**:service(常驻 HTTP)/ cmd(本地命令行)/ api(在线)三模式,配置见设置页。
|
|
26
|
-
- **克隆管理工具 `manage_voice_clone`**:注册/设为默认/列出/删除克隆音色。
|
|
27
|
-
|
|
28
|
-
### Client(浏览器)
|
|
29
|
-
- **输入框工具条**:图片(官方 draft 链路)+ 语音录音(秒数/取消)。
|
|
30
|
-
- **语音设置页**(设置 → 语音服务):引擎折叠卡片、小米三模型分区、克隆样本管理、ASR 模式、试听(合成/原声)。
|
|
31
|
-
- **语音消息复制按钮**:用户/AI 语音条尾部复制转写文本。
|
|
10
|
+
### 语音
|
|
11
|
+
| 能力 | 说明 |
|
|
12
|
+
|---|---|
|
|
13
|
+
| 录音输入 | 输入框麦克风按钮,录音 → 本地 ASR 识别 → 发送 |
|
|
14
|
+
| TTS 六引擎 | auto / 小米 / 音色设计 / 音色克隆 / Edge(免费) / 本地 / 阿里 |
|
|
15
|
+
| 离线 ASR | 本地 sherpa-onnx 常驻服务(18790)或命令行模式,不依赖云 |
|
|
16
|
+
| 音色克隆 | 参考音频复刻音色,自带示例样本,开箱即用 |
|
|
17
|
+
| AI 语音回复 | 用户语音后 AI 自动用语音回(send_voice 工具) |
|
|
18
|
+
| 语音气泡 | 用户/AI 语音消息可点击播放,尾部复制转写文本 |
|
|
32
19
|
|
|
33
|
-
|
|
20
|
+
### 图片
|
|
21
|
+
- 输入框图片按钮上传 → **文本模型也能发图**:图片转本地路径,AI 自动调视觉 MCP 识图后回答
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
> `~/.dsh` 指 DSH 运行时目录(Windows 为 `C:\Users\<你>\.dsh`)。
|
|
23
|
+
### 余额
|
|
24
|
+
- 直连模型时输入框右侧实时显示余额(¥xx)
|
|
38
25
|
|
|
39
|
-
###
|
|
26
|
+
### 界面截图
|
|
40
27
|
|
|
41
|
-
|
|
42
|
-
dsh plugin --profile web add @oadank/dsh-input-tools
|
|
43
|
-
```
|
|
28
|
+
**输入框工具条**(图片 + 录音 + 余额):
|
|
44
29
|
|
|
45
|
-
|
|
46
|
-
(补丁脚本 `patches/apply-voice-patch.ps1` 也已随包发布,路径在
|
|
47
|
-
`node_modules\@oadank\dsh-input-tools\patches\`。)
|
|
30
|
+

|
|
48
31
|
|
|
49
|
-
|
|
32
|
+
**语音设置页 —— 小米 TTS**(三模型分区:TTS / 音色设计 / 音色克隆):
|
|
50
33
|
|
|
51
|
-
|
|
52
|
-
`~/.dsh/profiles/node_modules/@oadank/dsh-input-tools/`
|
|
53
|
-
(`@oadank` 目录不存在就创建)
|
|
34
|
+

|
|
54
35
|
|
|
55
|
-
|
|
56
|
-
```yaml
|
|
57
|
-
- insert:
|
|
58
|
-
- id: dsh-input-tools
|
|
59
|
-
name: '@oadank/dsh-input-tools'
|
|
60
|
-
```
|
|
36
|
+
**语音设置页 —— 本地 TTS 与阿里**:
|
|
61
37
|
|
|
62
|
-
|
|
63
|
-
- Windows + nssm 服务:`nssm restart dsh-web`
|
|
64
|
-
- Linux + systemd:`systemctl restart dsh-web`
|
|
65
|
-
- 手动启动:停掉当前 dsh 进程后重新运行启动命令
|
|
38
|
+

|
|
66
39
|
|
|
67
|
-
|
|
40
|
+
**语音能力状态与 ASR 配置**:
|
|
68
41
|
|
|
69
|
-
|
|
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 模式。
|
|
42
|
+

|
|
74
43
|
|
|
75
|
-
|
|
44
|
+
**聊天语音消息展示**(用户/AI 语音气泡,可点击播放):
|
|
76
45
|
|
|
77
|
-
|
|
46
|
+

|
|
78
47
|
|
|
79
|
-
|
|
80
|
-
描述里会注入当前配置摘要,无需翻源码)。默认语音引擎、各引擎音色/Key、克隆样本、
|
|
81
|
-
ASR 模式都在设置页「语音服务」分区配置。
|
|
48
|
+
## 安装
|
|
82
49
|
|
|
83
|
-
|
|
50
|
+
### 场景一:已有 dsh 运行环境(源码版或 npm 版)
|
|
84
51
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
52
|
+
```bash
|
|
53
|
+
dsh plugin --profile web add @oadank/dsh-input-tools
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
装进当前 profile(`~/.dsh/profiles/<name>/node_modules/`),重启 dsh 生效。
|
|
57
|
+
|
|
58
|
+
### 场景二:从零开始(推荐,一键整合版)
|
|
88
59
|
|
|
89
|
-
|
|
60
|
+
整合版 fork 已内置语音改造 + 本插件 + 一键配置脚本:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git clone https://github.com/oadank/deepseek-harness.git
|
|
64
|
+
cd deepseek-harness
|
|
65
|
+
# Windows:
|
|
66
|
+
powershell -ExecutionPolicy Bypass -File scripts\setup-profile.ps1
|
|
67
|
+
# Linux/macOS:
|
|
68
|
+
bash scripts/setup-profile.sh
|
|
69
|
+
pnpm install
|
|
70
|
+
pnpm run build:web
|
|
71
|
+
dsh --profile web
|
|
72
|
+
```
|
|
90
73
|
|
|
91
|
-
|
|
92
|
-
插件按以下顺序自动定位可执行文件:
|
|
74
|
+
setup 脚本自动完成:装插件进 profile → 注册 → 检查 ffmpeg → 提示可选 ASR。**无需再执行 dsh plugin add**。
|
|
93
75
|
|
|
94
|
-
|
|
95
|
-
2. PATH 探测(`where ffmpeg` / `which ffmpeg`)
|
|
96
|
-
3. 兜底已知安装位置
|
|
76
|
+
### 可选:本地 ASR(离线识别)
|
|
97
77
|
|
|
98
|
-
|
|
99
|
-
Linux
|
|
100
|
-
若装在特殊位置,设环境变量 `DSH_VOICE_FFMPEG_BIN=/路径/ffmpeg` 即可。
|
|
78
|
+
- **Windows**:管理员 PowerShell 运行 `scripts\install-asr.ps1`(插件包内),自动下载 sherpa-onnx + 模型(约 260MB)、注册 `asr` 服务(18790)
|
|
79
|
+
- **Linux**:手动部署 18790 识别服务,或用 ASR 的 cmd/api 模式
|
|
101
80
|
|
|
102
|
-
|
|
103
|
-
> 但小米/edge 在线 TTS 不受影响。
|
|
81
|
+
### 依赖
|
|
104
82
|
|
|
105
|
-
|
|
83
|
+
- **ffmpeg**(语音转码必需):Windows `winget install ffmpeg`;Linux `sudo apt install ffmpeg`
|
|
84
|
+
- 视觉 MCP(图片识图用):在 dsh 设置里配置 vision MCP 服务(如 visionqa / zai-vision)
|
|
106
85
|
|
|
107
|
-
|
|
108
|
-
AI 语音回复条均为本地源码增强,官方源码/官方发布版默认都没有)。要用完整语音体验,
|
|
109
|
-
**二选一**:
|
|
86
|
+
## 配置
|
|
110
87
|
|
|
111
|
-
|
|
88
|
+
语音设置都在设置页「语音服务」分区(引擎、音色、Key、克隆、ASR 模式),存于 `~/.dsh/voice-config.json`。
|
|
112
89
|
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
git clone https://github.com/deepseek-ai/deepseek-harness.git
|
|
116
|
-
cd deepseek-harness
|
|
117
|
-
git checkout 141eb6fef8 # 官方 dsh-0.1.0-rc.8 release 合并点
|
|
118
|
-
```
|
|
119
|
-
2. **打语音补丁**(Windows 管理员 PowerShell;脚本自动探测源码位置,
|
|
120
|
-
找不到时会提示你输入源码路径):
|
|
121
|
-
```powershell
|
|
122
|
-
# 插件 npm 安装后,补丁在本机位置:
|
|
123
|
-
cd node_modules\@oadank\dsh-input-tools\patches
|
|
124
|
-
powershell -ExecutionPolicy Bypass -File apply-voice-patch.ps1
|
|
125
|
-
```
|
|
126
|
-
脚本自动:探测/输入源码仓库 → 校验补丁可应用 → 备份未提交改动 → 应用 → 幂等(已打跳过)。
|
|
127
|
-
3. **构建并启动**:
|
|
128
|
-
```bash
|
|
129
|
-
pnpm install
|
|
130
|
-
pnpm run build:web # 前端语音气泡渲染在此步生效
|
|
131
|
-
dsh --profile web # 或注册为系统服务(Windows 可用 nssm)
|
|
132
|
-
```
|
|
133
|
-
4. **安装语音插件**:`dsh plugin --profile web add @oadank/dsh-input-tools`
|
|
134
|
-
5. **可选:本地 ASR**:见上文「可选:本地 ASR」。
|
|
90
|
+
## 语音源码补丁(完整体验原生语音消息)
|
|
135
91
|
|
|
136
|
-
|
|
92
|
+
dsh 官方版(npm rc.7 / 官方源码)**契约不支持原生语音消息**(voice 消息气泡、AI 语音回复条)。二选一:
|
|
137
93
|
|
|
138
|
-
|
|
94
|
+
### 方案 A:官方源码 + 破解脚本
|
|
139
95
|
|
|
140
96
|
```bash
|
|
141
|
-
git clone https://github.com/
|
|
97
|
+
git clone https://github.com/deepseek-ai/deepseek-harness.git
|
|
142
98
|
cd deepseek-harness
|
|
143
|
-
#
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
dsh --profile web
|
|
99
|
+
git checkout 141eb6fef8 # 官方 dsh-0.1.0-rc.8 基线
|
|
100
|
+
# 打补丁(脚本自动探测/输入源码位置):
|
|
101
|
+
powershell -ExecutionPolicy Bypass -File <插件目录>\patches\apply-voice-patch.ps1
|
|
102
|
+
pnpm install && pnpm run build:web && dsh --profile web
|
|
147
103
|
```
|
|
148
104
|
|
|
149
|
-
|
|
105
|
+
### 方案 B:直接用整合版 fork(推荐)
|
|
150
106
|
|
|
151
|
-
|
|
107
|
+
```bash
|
|
108
|
+
git clone https://github.com/oadank/deepseek-harness.git
|
|
109
|
+
cd deepseek-harness
|
|
110
|
+
powershell -ExecutionPolicy Bypass -File scripts\setup-profile.ps1
|
|
111
|
+
pnpm install && pnpm run build:web && dsh --profile web
|
|
112
|
+
```
|
|
152
113
|
|
|
153
|
-
|
|
154
|
-
|
|
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)。
|
|
114
|
+
> 补丁基线官方 rc.8(141eb6fef8),官方后续更新可能不兼容,请先 checkout 该基线再打。回滚:`git apply -R`。
|
|
115
|
+
> npm 版(rc.7)限制:语音输入/合成可用,但语音气泡/AI 语音回复条无法原生显示(完整体验用源码版)。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -3607,6 +3607,43 @@ index 395e2da55f..d1548d4961 100644
|
|
|
3607
3607
|
if (facts.bindHost !== '127.0.0.1') return 'browse'
|
|
3608
3608
|
if (present(facts.env.SSH_CONNECTION) || present(facts.env.SSH_TTY)) return 'browse'
|
|
3609
3609
|
if (facts.platform === 'darwin' || facts.platform === 'win32') return 'native'
|
|
3610
|
+
diff --git a/packages/llm/llm-deepseek/src/adapter.ts b/packages/llm/llm-deepseek/src/adapter.ts
|
|
3611
|
+
index 638d555b1e..f93aaa2ed8 100644
|
|
3612
|
+
--- a/packages/llm/llm-deepseek/src/adapter.ts
|
|
3613
|
+
+++ b/packages/llm/llm-deepseek/src/adapter.ts
|
|
3614
|
+
@@ -236,19 +236,20 @@ export class DeepSeekAdapter extends LlmAdapter {
|
|
3615
|
+
let attachments: AttachmentStore | undefined
|
|
3616
|
+
if (hasImages) {
|
|
3617
|
+
const model = connection.models.find(entry => entry.id === options.model)
|
|
3618
|
+
- if (model?.inputModalities?.includes('image') !== true) {
|
|
3619
|
+
- throw new LlmError(
|
|
3620
|
+
- `DeepSeek model "${options.model}" does not accept image input.`,
|
|
3621
|
+
- 'UNSUPPORTED_CONTENT',
|
|
3622
|
+
- )
|
|
3623
|
+
- }
|
|
3624
|
+
- attachments = this.config.resolveAttachments?.()
|
|
3625
|
+
- if (attachments === undefined) {
|
|
3626
|
+
- throw new LlmError(
|
|
3627
|
+
- 'DeepSeek image conversion requires the durable attachment service.',
|
|
3628
|
+
- 'UNSUPPORTED_CONTENT',
|
|
3629
|
+
- )
|
|
3630
|
+
+ if (model?.inputModalities?.includes('image') === true) {
|
|
3631
|
+
+ // 多模态模型:走附件转换(图片转 base64 附件随请求发送)
|
|
3632
|
+
+ attachments = this.config.resolveAttachments?.()
|
|
3633
|
+
+ if (attachments === undefined) {
|
|
3634
|
+
+ throw new LlmError(
|
|
3635
|
+
+ 'DeepSeek image conversion requires the durable attachment service.',
|
|
3636
|
+
+ 'UNSUPPORTED_CONTENT',
|
|
3637
|
+
+ )
|
|
3638
|
+
+ }
|
|
3639
|
+
}
|
|
3640
|
+
+ // [本地改造 2026-08-21] 非多模态模型(文本模型)不抛错:
|
|
3641
|
+
+ // request() 走 serializeRequest → serializeMessages → imagesAsText,
|
|
3642
|
+
+ // 图片块会转成本地路径文本,agent 用视觉 MCP(mcp__visionqa__look 等)识图后再回答,
|
|
3643
|
+
+ // 因此 deepseek-v4-flash 等文本模型同样支持发图(不再报 does not accept image input)。
|
|
3644
|
+
}
|
|
3645
|
+
const apiKey = await this.config.resolveApiKey(connection)
|
|
3646
|
+
const userId = this.config.resolveUserId()
|
|
3610
3647
|
diff --git a/packages/llm/llm-deepseek/src/serialize.ts b/packages/llm/llm-deepseek/src/serialize.ts
|
|
3611
3648
|
index 498b3fb2f7..a5e8458366 100644
|
|
3612
3649
|
--- a/packages/llm/llm-deepseek/src/serialize.ts
|