dsh-xiaomi-tts 2.0.1 → 2.3.0

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.en.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  <p><a href="README.md"><strong>中文说明 →</strong></a></p>
4
4
 
5
- Xiaomi MiMo text-to-speech controls for finalized assistant messages in DeepSeek Harness Web.
5
+ Add Xiaomi MiMo TTS read-aloud playback to assistant replies in DeepSeek Harness Web.
6
+
7
+ > Powered by Xiaomi MiMo TTS models to turn assistant replies into smooth, clear natural speech. MiMo TTS is currently free for a limited time; refer to Xiaomi MiMo for the current policy.
6
8
 
7
9
  ## Preview
8
10
 
@@ -14,49 +16,93 @@ Xiaomi MiMo text-to-speech controls for finalized assistant messages in DeepSeek
14
16
 
15
17
  ## Features
16
18
 
17
- - Adds an optional read-aloud button to the assistant message action strip; it is enabled by default.
18
- - Uses Xiaomi MiMo's official `mimo-v2.5-tts` and `mimo-v2.5-tts-voicedesign` Chat Completions-compatible APIs.
19
- - Switches between preset voices and custom voice design, and configures the API key, autoplay, built-in voice, voice description, and MP3/WAV format under **Settings → Plugins → Plugin configuration**. The voice-design selector defaults to **Custom**; custom text can be edited and saved, then restored after switching to another template.
20
- - Keeps the API key on the DSH Host. The browser sends only the response text to a same-origin plugin route.
21
- - Supports pause, resume, regeneration, request errors, and browser autoplay rejection.
22
- - Cleans speech text before sending it to TTS: URLs, file paths, code blocks, emoji, icons, and control characters are removed, and common Chinese punctuation is converted to ASCII punctuation.
19
+ - Shows a read-aloud button below each completed assistant reply body when needed; enabled by default.
20
+ - Uses Xiaomi MiMo's currently limited-time-free TTS models: `mimo-v2.5-tts` outputs smooth, clear audio; preset-voice autoplay uses streaming PCM16, while manual playback uses MP3 or WAV.
21
+ - Uses `mimo-v2.5-tts-voicedesign` Voice Design to create the voice you want from a text description.
22
+ - Lets you switch between the preset-voice model and the custom voice-design model under **Settings → Plugins → Plugin configuration**, and configure the API key, autoplay, voice, voice description, and format.
23
+ - Keeps the API key on the DSH Host. The browser sends only the reply body text to a same-origin Host route.
24
+ - Supports pause, resume, regeneration, and autoplay-blocked prompts. Automatic playback only triggers for the latest reply newly completed in the current run; opening messages from history does not play them.
25
+ - Aggressively cleans speech text before sending it to TTS: URLs, file paths, code blocks, emoji, icons, and control characters are removed, and common Chinese punctuation is converted to ASCII punctuation.
26
+
27
+ ## Requirements
23
28
 
24
- Official Xiaomi MiMo TTS reference: <https://mimo.mi.com/static/docs/api/audio/tts.md>
29
+ - `@deepseek-ai/dsh` `0.1.0-rc.7` or a compatible version
30
+ - Node.js 22+
31
+ - Xiaomi MiMo API Key
32
+
33
+ Official Xiaomi MiMo TTS API reference: <https://mimo.mi.com/static/docs/api/audio/tts.md>
25
34
 
26
35
  ## Install
27
36
 
37
+ Install from npm:
38
+
28
39
  ```bash
29
40
  dsh plugin --profile web add dsh-xiaomi-tts
30
41
  ```
31
42
 
32
- Restart `dsh web`, then open **Settings → Plugins → Plugin configuration** and save a Xiaomi MiMo API key.
43
+ Install from a local directory:
44
+
45
+ ```bash
46
+ dsh plugin --profile web add ./dsh-plugin-xiaomi-mimo-tts
47
+ ```
48
+
49
+ Install from GitHub:
50
+
51
+ ```bash
52
+ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
53
+ ```
54
+
55
+ After installation, restart `dsh web`, then open **Settings → Plugins → Plugin configuration → Xiaomi MiMo Read Aloud**, enter the API key, and save.
33
56
 
34
57
  When updating or switching from the local development link to the npm package, stop DSH Web before changing the profile dependencies. This prevents a running Node process from holding the Windows Junction that pnpm needs to replace:
35
58
 
36
59
  ```powershell
37
- .\start\dsh-plugin-reinstall.bat 2.0.0
60
+ .\start\dsh-plugin-reinstall.bat 2.3.0
38
61
  ```
39
62
 
40
- The script stops DSH Web, removes the plugin from the `web` profile, installs the requested npm version, and starts DSH Web again. If you run the steps manually, keep the same order:
63
+ The script stops DSH Web, removes the current plugin from the profile, installs the requested npm version, and starts DSH Web again. If you run the steps manually, keep the same order:
41
64
 
42
65
  ```powershell
43
66
  .\start\dsh-web-stop.bat
44
67
  dsh plugin --profile web remove dsh-xiaomi-tts
45
- dsh plugin --profile web add dsh-xiaomi-tts@2.0.0
68
+ dsh plugin --profile web add dsh-xiaomi-tts@2.3.0
46
69
  .\start\dsh-web-start.bat
47
70
  ```
48
71
 
49
- When `mimo-v2.5-tts-voicedesign` is selected, the plugin omits `audio.voice`, sends the custom voice description as the upstream `user` message, and sends the reply text as the `assistant` message. Describe the voice itself in one or two sentences, including age/gender, texture, pace, and emotional baseline; avoid scenes or actions.
72
+ ## Configuration
50
73
 
51
- The settings card also provides common voice-description templates from the reference page; every template remains editable after selection.
74
+ Available built-in voices for `mimo-v2.5-tts`:
52
75
 
53
- The settings include the API key, read-aloud button, automatic read-aloud, model, voice, custom voice description, and audio format. Both switches are enabled by default; disabling the read-aloud button also disables automatic read-aloud, while enabling automatic read-aloud enables the button.
76
+ - Chinese female: `冰糖`, `茉莉`
77
+ - Chinese male: `苏打`, `白桦`
78
+ - English female: `Mia`, `Chloe`
79
+ - English male: `Milo`, `Dean`
54
80
 
55
- Browsers may block autoplay. If that happens, click the read-aloud button below a response.
81
+ Custom voice design with `mimo-v2.5-tts-voicedesign`
82
+
83
+ The plugin provides common voice-description templates. The selector defaults to **Custom**, so users can edit and save the description directly. After switching to another template and back to **Custom**, the previously saved custom content is restored.
84
+
85
+ ```text
86
+ Young adult woman, bright and approachable voice, clear articulation, moderate pace, gentle and restrained emotional tone.
87
+ ```
88
+
89
+ It is recommended to describe age and gender, vocal texture, speaking pace, and emotional baseline, while avoiding scenes or actions. Preset-voice mode still uses the built-in voice configuration.
90
+
91
+ Browsers may block autoplay. If that happens, click the read-aloud button first.
56
92
 
57
93
  ### Speech text preprocessing
58
94
 
59
- Read-aloud uses cleaned text and does not modify the assistant reply shown in the chat. Markdown links keep their readable labels while their targets are removed; URLs, file paths, complete code blocks, emoji, icons, zero-width characters, and control characters are not sent to Xiaomi MiMo. Inline code keeps its text without backticks, consecutive whitespace is collapsed, and common Chinese punctuation is converted to ASCII punctuation.
95
+ Read-aloud uses only the cleaned reply body and does not modify the assistant message shown in the chat. Markdown links keep their readable labels while their targets are removed; URLs, file paths, complete code blocks, emoji, icons, zero-width characters, and control characters are not sent to Xiaomi MiMo. Parentheses, brackets, book-title marks, quotation marks, and other non-boundary punctuation are removed; retained sentence-boundary punctuation is converted to ASCII. Streaming playback accumulates at least 20 speakable characters, then sends any remaining shorter text when the reply ends.
96
+
97
+ ## Privacy
98
+
99
+ - The API key stays on the DSH Host and is never sent to the browser.
100
+ - Reply text is sent to Xiaomi MiMo when speech is generated.
101
+ - Audio is played through a temporary Blob URL and is not persisted to disk.
102
+
103
+ ## Feedback and support
104
+
105
+ Please use [GitHub Issues](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts/issues) for bug reports, feature requests, or feedback.
60
106
 
61
107
  ## Development
62
108
 
@@ -67,12 +113,6 @@ pnpm test
67
113
  pnpm pack:check
68
114
  ```
69
115
 
70
- ## Privacy
71
-
72
- - The API key stays on the DSH Host and is never sent to the browser.
73
- - Response text is sent to Xiaomi MiMo when speech is generated.
74
- - Audio is played through a temporary Blob URL and is not persisted to disk.
75
-
76
116
  ## License
77
117
 
78
118
  MIT
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  为 DeepSeek Harness Web 的助手回复添加 Xiaomi MiMo TTS 语音朗读。
4
4
 
5
+ > 基于 Xiaomi MiMo TTS 大模型,将助手回复转为流畅、清晰的自然语音。MiMo TTS 当前为限时免费服务,具体政策以 Xiaomi MiMo 平台为准。
6
+
5
7
  <p><a href="README.en.md"><strong>English README →</strong></a></p>
6
8
 
7
9
  ## 预览
@@ -15,10 +17,11 @@
15
17
  ## 功能
16
18
 
17
19
  - 在每条已完成助手回复正文下方的操作栏中按需显示“朗读”按钮(默认开启)。
18
- - 调用 Xiaomi MiMo 官方 `mimo-v2.5-tts` 或 `mimo-v2.5-tts-voicedesign` 接口,把回复正文转成 MP3 或 WAV 并播放。
20
+ - 调用当前限时免费的 Xiaomi MiMo TTS 大模型:`mimo-v2.5-tts` 输出流畅、清晰的音频;预置音色自动播报使用 PCM16 流式播放,手动朗读使用 MP3 或 WAV。
21
+ - 使用 `mimo-v2.5-tts-voicedesign` 的 Voice Design,通过文字描述创造你想要的声音。
19
22
  - 在 **设置 → 插件 → 插件配置** 中切换预置音色/自定义音色模型,配置 API Key、自动播报、音色、音色描述和格式。
20
23
  - API Key 仅由 DSH Host 读取,浏览器只向同源 Host 路由提交回复正文。
21
- - 支持暂停、继续、重新生成,以及浏览器自动播放被拦截时的提示。
24
+ - 支持暂停、继续、重新生成,以及浏览器自动播放被拦截时的提示;自动播报仅触发当前运行中新完成的最后一条回复,从历史记录打开消息不会播放。
22
25
  - 发送给 TTS 前会积极清理朗读文本:移除网址、文件路径、代码块、表情符号、图标和控制字符,并将常规中文标点转换为英文标点。
23
26
 
24
27
  ## 环境要求
@@ -54,7 +57,7 @@ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
54
57
  更新或从本地开发版切换到 npm 版时,必须先停止 DSH Web,避免 Windows Junction 被运行中的 Node 进程占用:
55
58
 
56
59
  ```powershell
57
- .\start\dsh-plugin-reinstall.bat 2.0.0
60
+ .\start\dsh-plugin-reinstall.bat 2.3.0
58
61
  ```
59
62
 
60
63
  这个脚本会按顺序停止 DSH Web、卸载当前 profile 中的插件、从 npm 安装指定版本并重新启动 DSH Web。若手动操作,请保持相同顺序:
@@ -62,7 +65,7 @@ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
62
65
  ```powershell
63
66
  .\start\dsh-web-stop.bat
64
67
  dsh plugin --profile web remove dsh-xiaomi-tts
65
- dsh plugin --profile web add dsh-xiaomi-tts@2.0.0
68
+ dsh plugin --profile web add dsh-xiaomi-tts@2.3.0
66
69
  .\start\dsh-web-start.bat
67
70
  ```
68
71
 
@@ -75,9 +78,9 @@ dsh plugin --profile web add dsh-xiaomi-tts@2.0.0
75
78
  - 英文女声:`Mia`、`Chloe`
76
79
  - 英文男声:`Milo`、`Dean`
77
80
 
78
- 切换到 `mimo-v2.5-tts-voicedesign` 后,插件不会发送 `audio.voice`,而是把“自定义音色描述”作为上游 `user` 消息,把回复正文作为 `assistant` 消息发送。音色描述建议写成一到两句,只描述声音本身,例如:
81
+ 自定义音色(`mimo-v2.5-tts-voicedesign`)
79
82
 
80
- 设置卡提供参考页中的常用音色描述模板;下拉框默认选择“自定义”,用户可以直接修改并保存描述。切换到其他模板后再切回“自定义”时,会恢复之前保存的自定义内容。
83
+ 为你提供了常用音色描述模板;下拉框默认选择“自定义”,用户可以直接修改并保存描述。切换到其他模板后再切回“自定义”时,会恢复之前保存的自定义内容。
81
84
 
82
85
  ```text
83
86
  青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。
@@ -85,13 +88,11 @@ dsh plugin --profile web add dsh-xiaomi-tts@2.0.0
85
88
 
86
89
  建议包含年龄段与性别、声音质感、语速节奏和情绪底色,不写场景或动作。预置音色模式仍使用原来的内置音色配置。
87
90
 
88
- 配置项包括 API Key、朗读按钮、自动播报、模型、内置音色、音色描述和音频格式。两个开关默认开启;关闭朗读按钮会同步关闭自动播报,开启自动播报会自动开启朗读按钮。
89
-
90
- 浏览器可能阻止自动播放;遇到这种情况,请点击回复下方的朗读按钮。
91
+ 浏览器可能阻止自动播放;遇到这种情况,请先尝试点击朗读按钮。
91
92
 
92
93
  ### 朗读文本处理
93
94
 
94
- 朗读只使用清理后的正文,不会修改聊天记录中显示的助手回复。Markdown 链接会保留可读标题并删除链接地址;网址、文件路径、完整代码块、表情符号、图标、零宽字符和控制字符不会发送给 Xiaomi MiMo。行内代码保留文字内容但去除反引号,连续空白会合并,常规中文标点会转换为 ASCII 英文标点。
95
+ 朗读只使用清理后的正文,不会修改聊天记录中显示的助手回复。Markdown 链接会保留可读标题并删除链接地址;网址、文件路径、完整代码块、表情符号、图标、零宽字符和控制字符不会发送给 Xiaomi MiMo。括号、方括号、书名号、引号等非断句符号会删除;保留的断句标点会转换为 ASCII 英文标点。流式朗读会累计至少 20 个可朗读字符,回复结束时再发送不足 20 个字符的剩余内容。
95
96
 
96
97
  ## 隐私
97
98
 
@@ -99,6 +100,10 @@ dsh plugin --profile web add dsh-xiaomi-tts@2.0.0
99
100
  - 生成语音时,回复正文会发送给 Xiaomi MiMo 服务。
100
101
  - 音频只通过临时 Blob URL 播放,不会持久化到磁盘。
101
102
 
103
+ ## 反馈与支持
104
+
105
+ 欢迎通过 [GitHub Issues](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts/issues) 提交问题反馈、功能建议或使用体验。
106
+
102
107
  ## 开发
103
108
 
104
109
  ```bash
package/assets/preset.png CHANGED
Binary file
package/cordis.patch.yml CHANGED
@@ -11,8 +11,9 @@
11
11
  voice: '冰糖'
12
12
  voiceDesignPrompt: '青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。'
13
13
  voiceDesignCustomPrompt: '青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。'
14
+ presetStylePrompt: '使用清晰、自然、准确的声音朗读,语速适中,停顿自然,语气平和克制,避免夸张表达。'
14
15
  format: 'mp3'
15
16
  autoPlay: true
16
- instruction: '请用自然、清晰、语速适中的语气朗读。'
17
+ instruction: '请忠实朗读原文,根据文本语气自然表达,不添加或改写内容。'
17
18
  maxTextLength: 12000
18
19
  requestTimeoutMs: 120000
@@ -22,10 +22,14 @@ declare const zh: {
22
22
  readonly 'settings.autoPlay': "开启自动播报";
23
23
  readonly 'settings.autoPlayHint': "开启时会同步显示朗读按钮;浏览器也可能拒绝自动播放。";
24
24
  readonly 'settings.model': "TTS 模型";
25
- readonly 'settings.presetModel': "预置音色模型";
26
- readonly 'settings.voiceDesignModel': "自定义音色模型";
25
+ readonly 'settings.presetModel': "预置音色模型 (mimo-v2.5-tts)";
26
+ readonly 'settings.voiceDesignModel': "自定义音色模型 (mimo-v2.5-tts-voicedesign)";
27
+ readonly 'settings.modelAutoPlayHintPreset': "预置音色模型支持实时流式播放。";
28
+ readonly 'settings.modelAutoPlayHintVoiceDesign': "自定义音色仅支持在回复完成后自动播放。";
27
29
  readonly 'settings.voice': "内置音色";
28
30
  readonly 'settings.voiceDesignPrompt': "自定义音色描述";
31
+ readonly 'settings.customVoiceOption': "自定义";
32
+ readonly 'settings.customVoiceSummary': "手动编写音色描述";
29
33
  readonly 'settings.voiceDesignPromptHint': "按“年龄段 + 性别、声音质感、语速节奏、情绪底色”描述声音本身;不写场景或动作。";
30
34
  readonly 'settings.format': "音频格式";
31
35
  readonly 'settings.save': "保存";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAuC,MAAM,wCAAwC,CAAA;AAgBhH,+CAA+C;AAC/C,eAAO,MAAM,MAAM,UAMlB,CAAA;AAgBD,QAAA,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCE,CAAA;AA2CV,KAAK,SAAS,GAAG,MAAM,OAAO,EAAE,CAAA;AAIhC,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,iBAAiB,EAAE,SAAS,CAAA;KAC7B;CACF;AA0kBD,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA6C9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAuC,MAAM,wCAAwC,CAAA;AAuBhH,+CAA+C;AAC/C,eAAO,MAAM,MAAM,UAMlB,CAAA;AAiBD,QAAA,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CE,CAAA;AA+CV,KAAK,SAAS,GAAG,MAAM,OAAO,EAAE,CAAA;AAIhC,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,iBAAiB,EAAE,SAAS,CAAA;KAC7B;CACF;AAotCD,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAwD9C"}