dsh-xiaomi-tts 3.0.3 → 3.0.5

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.
Files changed (64) hide show
  1. package/README.en.md +109 -85
  2. package/README.md +104 -77
  3. package/assets/audio/auto-off03.mp3 +0 -0
  4. package/assets/plugin-icons/avatar.png +0 -0
  5. package/assets/setting.png +0 -0
  6. package/assets/ui/sound-effects-whale.webp +0 -0
  7. package/cordis.patch.yml +4 -1
  8. package/lib/client/conversation/read-aloud.d.ts +3 -3
  9. package/lib/client/conversation/read-aloud.d.ts.map +1 -1
  10. package/lib/client/index.d.ts.map +1 -1
  11. package/lib/client/localization.d.ts +44 -28
  12. package/lib/client/localization.d.ts.map +1 -1
  13. package/lib/client/playback/pcm-play-service.d.ts +2 -2
  14. package/lib/client/playback/pcm-play-service.d.ts.map +1 -1
  15. package/lib/client/playback/preview-player.d.ts +12 -3
  16. package/lib/client/playback/preview-player.d.ts.map +1 -1
  17. package/lib/client/settings/api-key-module.d.ts +5 -3
  18. package/lib/client/settings/api-key-module.d.ts.map +1 -1
  19. package/lib/client/settings/api-key-state.d.ts +5 -0
  20. package/lib/client/settings/api-key-state.d.ts.map +1 -0
  21. package/lib/client/settings/card.d.ts +4 -7
  22. package/lib/client/settings/card.d.ts.map +1 -1
  23. package/lib/client/settings/collapsible-module.d.ts.map +1 -1
  24. package/lib/client/settings/controls/built-in-voice-picker.d.ts +2 -1
  25. package/lib/client/settings/controls/built-in-voice-picker.d.ts.map +1 -1
  26. package/lib/client/settings/controls/local-voice-picker.d.ts +3 -1
  27. package/lib/client/settings/controls/local-voice-picker.d.ts.map +1 -1
  28. package/lib/client/settings/controls/voice-design-picker.d.ts +2 -1
  29. package/lib/client/settings/controls/voice-design-picker.d.ts.map +1 -1
  30. package/lib/client/settings/details-module.d.ts +5 -11
  31. package/lib/client/settings/details-module.d.ts.map +1 -1
  32. package/lib/client/settings/field-heading.d.ts +2 -2
  33. package/lib/client/settings/field-heading.d.ts.map +1 -1
  34. package/lib/client/settings/minimal-mode.d.ts +4 -0
  35. package/lib/client/settings/minimal-mode.d.ts.map +1 -0
  36. package/lib/client/settings/module-shell.d.ts +17 -0
  37. package/lib/client/settings/module-shell.d.ts.map +1 -0
  38. package/lib/client/settings/preview-module.d.ts +5 -2
  39. package/lib/client/settings/preview-module.d.ts.map +1 -1
  40. package/lib/client/settings/scope.d.ts +2 -4
  41. package/lib/client/settings/scope.d.ts.map +1 -1
  42. package/lib/client/settings/sound-effects-module.d.ts +3 -2
  43. package/lib/client/settings/sound-effects-module.d.ts.map +1 -1
  44. package/lib/client/settings/switch-module.d.ts +2 -1
  45. package/lib/client/settings/switch-module.d.ts.map +1 -1
  46. package/lib/client/settings/types.d.ts +0 -1
  47. package/lib/client/settings/types.d.ts.map +1 -1
  48. package/lib/client/sound-effects/task-watcher.d.ts.map +1 -1
  49. package/lib/client/sound-effects/toggle-sound-player.d.ts +2 -0
  50. package/lib/client/sound-effects/toggle-sound-player.d.ts.map +1 -1
  51. package/lib/client/style/index.d.ts.map +1 -1
  52. package/lib/client.js +663 -528
  53. package/lib/client.js.map +1 -1
  54. package/lib/index.d.ts +57 -57
  55. package/lib/index.d.ts.map +1 -1
  56. package/lib/index.js +46 -391
  57. package/lib/pcm-stream.js +1 -1
  58. package/lib/{shared-DJtQ85KH.js → shared--SkaEjRj.js} +51 -12
  59. package/lib/shared.d.ts +17 -13
  60. package/lib/shared.d.ts.map +1 -1
  61. package/lib/shared.js +2 -2
  62. package/locale/en.json +6 -0
  63. package/locale/zh.json +6 -0
  64. package/package.json +52 -55
package/README.en.md CHANGED
@@ -1,132 +1,150 @@
1
- ![social](assets/social.png)
1
+ ![social](assets/social.webp)
2
2
 
3
3
  # dsh-xiaomi-tts
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/dsh-xiaomi-tts.svg)](https://www.npmjs.com/package/dsh-xiaomi-tts)
6
- [![GitHub stars](https://img.shields.io/github/stars/ppy-web/dsh-plugin-xiaomi-mimo-tts.svg)](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts)
6
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-xiaomi-tts.svg)](https://www.npmjs.com/package/dsh-xiaomi-tts)
7
+ ![dsh version](https://img.shields.io/badge/dsh-v0.1.7alpha2-blue?link=https%3A%2F%2Fgithub.com%2Fdeepseek-ai%2Fdeepseek-harness%2Freleases)
8
+ ![Xiaomi MiMo](https://img.shields.io/badge/Xiaomi-MiMo-ff6900?logo=xiaomi&logoColor=white)
7
9
 
8
- Add Xiaomi MiMo TTS read-aloud playback to DeepSeek Harness Web.
10
+ Add Xiaomi MiMo TTS read-aloud, browser-local fallback speech, and optional UI sounds to DSH Web.
9
11
 
10
- > Powered by Xiaomi MiMo TTS to turn text into smooth, clear natural speech. MiMo TTS is currently free for a limited time; see the official platform for the latest policy.
12
+ > MiMo TTS availability and pricing may change. Check the official Xiaomi MiMo platform for the current policy.
11
13
 
12
14
  <p><a href="README.md"><strong>中文说明 →</strong></a></p>
13
15
 
14
16
  ## 🎨 Preview
15
17
 
16
- | Preset voices | Custom voices |
18
+ - [Open the interactive Preview Pages](https://ppy-web.github.io/dsh-plugin-xiaomi-mimo-tts)
19
+
20
+ | Settings | Message action |
17
21
  |:---:|:---:|
18
- | ![Xiaomi MiMo settings menu](assets/menu.png) | ![Custom voice](assets/preset.png) |
19
- | Settings | UI example |
20
- | ![UI](assets/setting.png) | ![UI](assets/image.png) |
22
+ | ![Plugin settings](assets/setting.png) | ![Read-aloud action in a conversation](assets/image.png) |
21
23
 
22
24
  ## ✨ Features
23
25
 
24
- - One-click read-aloud: adds a **Read aloud** button to the conversation action bar (enabled by default).
25
- - Built-in voices: uses `mimo-v2.5-tts` for smooth, clear audio with streaming playback.
26
- - Playback speed: adjustable from 0.5× to 2.0× for both MiMo and browser-local speech.
27
- - Custom voices: uses `mimo-v2.5-tts-voicedesign` to create a voice from a text description.
28
- - Browser-local voices: uses offline or online voices provided by the browser host.
29
- - Automatic text cleaning: removes URLs, file paths, code blocks, emoji, icons, and control characters before synthesis.
30
- - Sound Effects: semantic click sounds plus start, success, failure, and pending sounds for the current task.
26
+ - One-click read-aloud action on assistant messages.
27
+ - Low-latency PCM streaming for `mimo-v2.5-tts`, with complete-audio or browser-speech fallback when appropriate.
28
+ - Official built-in voices and text-described custom voices through `mimo-v2.5-tts-voicedesign`.
29
+ - MiMo-first, local-first, or MiMo-only speech strategies.
30
+ - Smart, full, and first-segment read-aloud ranges.
31
+ - 0.5×–2.0× playback speed, voice volume, pause, resume, and stop controls.
32
+ - Text preparation that removes URLs, paths, code blocks, emoji, and control characters before synthesis.
33
+ - Broadcast Studio previews that identify MiMo versus browser-local playback and explain common failures.
34
+ - Optional task and semantic click sounds, disabled by default.
35
+ - An optional PCM playback service for other DSH Web plugins.
31
36
 
32
37
  ## 📋 Requirements
33
38
 
34
- - `@deepseek-ai/dsh` `0.1.5-rc.1` (the plugin currently supports this version only)
39
+ - `@deepseek-ai/dsh` `0.1.7-rc.1` (the current compatibility target)
35
40
  - Node.js 22+
36
- - Xiaomi MiMo API Key
41
+ - A Xiaomi MiMo API key for MiMo speech
37
42
  - [Official TTS API documentation](https://mimo.mi.com/models/zh-CN/mimo-v2.5-tts)
38
43
 
39
- ## 🚀 Install and use
44
+ ## 🚀 Installation
40
45
 
41
- - Install from npm **(recommended)**:
46
+ ### Install from npm (recommended)
42
47
 
43
48
  ```bash
44
- dsh plugin --profile web add dsh-xiaomi-tts
49
+ dsh plugin --profile web add dsh-xiaomi-tts@latest
45
50
  ```
46
51
 
47
- - Install from the [DSH plugin marketplace](https://github.com/dsh-market/dsh-market) **(recommended)**:
48
-
49
- Open **Settings → Plugin marketplace**, search for `xiaomi-mimo-tts`, and click **Install**.
52
+ ### Install from the plugin marketplace
50
53
 
51
- - Ask DSH or any AI agent to install it for you:
52
-
53
- ```text
54
- Install the dsh-xiaomi-tts plugin on this computer's DSH.
55
- 1. Prefer: dsh plugin --profile web add dsh-xiaomi-tts@latest
56
- 2. If that fails, try the source repository: https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts
57
- ```
54
+ If the plugin is available in the current DSH marketplace catalog, search for `xiaomi-mimo-tts` under **Settings → Plugin marketplace**.
58
55
 
59
- - Install from GitHub:
56
+ ### Install from GitHub
60
57
 
61
58
  ```bash
62
59
  dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
63
60
  ```
64
61
 
65
- - Install a `.tgz` downloaded from GitHub Releases:
62
+ You can also download a `.tgz` from GitHub Releases:
66
63
 
67
64
  ```powershell
68
- dsh plugin --profile web add "<download-path>/dsh-xiaomi-tts-<version>.tgz"
65
+ dsh plugin --profile web add "<download-path>\dsh-xiaomi-tts-<version>.tgz"
69
66
  ```
70
67
 
71
- Release tarballs already contain the built files and do not require `pnpm approve-builds`.
68
+ Release tarballs include the build output and do not require `pnpm approve-builds`.
72
69
 
73
- After installation, restart `dsh web`, then open **Settings → Plugins → Plugin configuration → Xiaomi MiMo Read Aloud** and [get and enter your API Key](https://platform.xiaomimimo.com/console/api-keys). Standard API Keys and Token Plan-specific API Keys are supported.
70
+ After installation, restart the running DSH Web `web` profile, then open:
74
71
 
75
- Click **Save** after changing any setting.
72
+ **Sidebar → Plugins → dsh-xiaomi-tts → Text To Speech (Xiaomi MiMo)**
76
73
 
77
- ### Sound Effects
74
+ ## 🐋 First use
78
75
 
79
- Below **Broadcast Studio** in the voice settings card, control the master switch, volume, sound pack, click sounds, and task sounds, and preview common cues. Sounds are synthesized with browser Web Audio; no network request or audio file persistence is used.
76
+ New installations start with:
80
77
 
81
- When switching from a local development version to the npm package on Windows, stop DSH Web first and run:
78
+ - the manual Read aloud action available;
79
+ - **automatic playback disabled**;
80
+ - **UI sound effects disabled**;
81
+ - browser-local fallback available under the default MiMo-first strategy, even before a MiMo key is saved.
82
82
 
83
- ```powershell
84
- .\start\dsh-plugin-reinstall.bat 3.0.3
85
- ```
83
+ Recommended setup order:
84
+
85
+ 1. [Create a Xiaomi MiMo API key](https://platform.xiaomimimo.com/console/api-keys).
86
+ 2. Enter it in the plugin settings and click **Save**.
87
+ 3. Open Mixing Console and choose a model and voice.
88
+ 4. Test it in Broadcast Studio; the status bubble identifies MiMo or browser-local speech.
89
+ 5. Enable automatic playback and UI sounds only if wanted, then save again.
90
+
91
+ > A newly entered API key is used by MiMo only after it is saved to the DSH Host. Recognizing an `sk-` or `tp-` prefix is a format check, not server-side validation.
92
+
93
+ ### Replace or clear an API key
94
+
95
+ - Entering and saving a new key replaces the key in the personal settings layer.
96
+ - **Clear** removes that personal override after Save.
97
+ - If a DSH base configuration still provides a key, clearing the personal override restores the inherited key. It does not revoke a key on Xiaomi's platform.
98
+ - Revoke the key in the Xiaomi MiMo console when it must be made unusable everywhere.
86
99
 
87
100
  ## ⚙️ Configuration
88
101
 
89
- **Official built-in voices (`mimo-v2.5-tts`):**
102
+ ### Official built-in voices
103
+
104
+ `mimo-v2.5-tts` currently provides:
90
105
 
91
106
  - Chinese female: `冰糖`, `茉莉`
92
107
  - Chinese male: `苏打`, `白桦`
93
108
  - English female: `Mia`, `Chloe`
94
109
  - English male: `Milo`, `Dean`
95
110
 
96
- Preset voices use streaming playback to reduce the wait before speech starts.
111
+ ### Custom voices
97
112
 
98
- **Custom voices (`mimo-v2.5-tts-voicedesign`)**
99
-
100
-
101
- Common voice-description templates are provided, and you can edit and save the description directly:
113
+ `mimo-v2.5-tts-voicedesign` generates a voice from a description. The settings panel includes presets and an editable custom description:
102
114
 
103
115
  ```text
104
- Young adult woman, bright and approachable voice, clear articulation, moderate pace, gentle and restrained emotional tone.
116
+ Young adult woman with a bright, approachable voice, clear articulation, moderate pace, and a gentle, restrained emotional tone.
105
117
  ```
106
118
 
107
- **Browser-local fallback speech**
119
+ Voice descriptions support preset templates and direct manual editing; save the settings after changing one.
120
+
121
+ ### Browser-local speech
122
+
123
+ - **MiMo first**: tries browser speech if MiMo fails before audio starts.
124
+ - **Local first**: uses browser speech first, then tries MiMo if local speech fails.
125
+ - **Disable local speech**: uses MiMo only.
108
126
 
109
- Three strategies are available: **MiMo first** falls back to browser speech when MiMo fails; **Local first** prefers browser speech; **Disable local speech** uses MiMo only. Voices come from the browser Web Speech API. Offline availability and the actual voice list depend on the browser, operating system, and network speech services.
110
-
111
- **Read-aloud range**
112
-
113
- - **Smart selection**: automatic playback prefers the opening semantic segment, while manual playback reads the full reply. Short replies without a separable segment are read in full.
114
- - **Full mode**: both automatic and manual playback read the full reply.
115
- - **First-segment mode**: both automatic and manual playback read only the opening semantic segment.
116
-
117
- Keyboard support is available in the settings panel: press `Tab` to move between controls, use the arrow keys to adjust sliders or switch options, and press `Space` to confirm the focused control.
127
+ Browser voices come from the Web Speech API. Offline availability, language coverage, and actual voice output depend on the browser, operating system, and their speech services.
128
+
129
+ ### Read-aloud range
130
+
131
+ - **Smart mode**: automatic playback prefers the opening semantic segment and may add a short closing cue when substantial text remains. Manual playback reads the full reply.
132
+ - **Full mode**: automatic and manual playback both read the full reply.
133
+ - **First-segment mode**: automatic and manual playback both read only the opening segment.
134
+
135
+ The settings panel supports keyboard navigation: use `Tab` to move focus, arrow keys to adjust sliders and options, and `Space` to activate buttons and switches.
118
136
 
119
137
  ## 🔌 Third-party plugin integration
120
138
 
121
- This plugin exposes PCM streaming playback for Web plugins. At the point where speech is needed, call:
139
+ The plugin exposes an optional PCM streaming service to Web plugins:
122
140
 
123
141
  ```ts
124
142
  ctx.get('xiaomiMimoTts')?.play('Welcome back')
125
143
  ```
126
144
 
127
- Use `ctx.get()` dynamically rather than declaring a required `inject` service. If this plugin is not installed or not ready, the call safely does nothing. `play()` uses the saved MiMo settings for PCM playback, and `stop()` stops it explicitly. New playback interrupts the current read-aloud session.
145
+ Use `ctx.get()` dynamically instead of declaring a required injection. The call safely does nothing when the plugin is missing, unavailable, or disabled. New playback interrupts the current read-aloud session, and `stop()` stops it explicitly.
128
146
 
129
- For TypeScript hints, import the type only:
147
+ For TypeScript types:
130
148
 
131
149
  ```ts
132
150
  import type { XiaomiMimoTtsService } from 'dsh-xiaomi-tts/client-api'
@@ -135,18 +153,20 @@ const tts = ctx.get('xiaomiMimoTts') as XiaomiMimoTtsService | undefined
135
153
  tts?.play('Welcome back')
136
154
  ```
137
155
 
138
- ## 🔒 Privacy
156
+ ## 🔒 Privacy and network access
139
157
 
140
- - The API Key is stored on the DSH Host and is not sent to the browser.
141
- - The reply body is sent to Xiaomi MiMo when speech is generated.
142
- - Audio is played in browser memory through Web Audio or a temporary Blob URL and is not persisted to disk.
158
+ - The DSH Host stores the API key. The browser reads only whether a key is configured and whether its prefix is recognized, not the secret itself.
159
+ - MiMo synthesis sends the spoken text and relevant voice instructions to Xiaomi MiMo.
160
+ - Browser-local speech uses the Web Speech API. Voices marked online may send text to browser, operating-system, or network speech services.
161
+ - Opening the settings card makes the DSH Host query the npm Registry for a newer plugin version.
162
+ - Audio plays from browser memory through Web Audio or temporary Blob URLs; the plugin does not intentionally persist generated audio.
143
163
  - The sound core is migrated from [uisfx 0.4.0](https://github.com/romainsimon/uisfx) under the MIT License; see `NOTICE`.
144
164
 
145
165
  ## 🏗️ Architecture
146
166
 
147
- - **Shared layer**: common configuration, text cleaning, segmentation, and SSE contract.
148
- - **Host plugin**: manages settings and static assets, and proxies complete-audio and PCM streaming requests to MiMo.
149
- - **Web Client**: provides settings and read-aloud entry points, playback state, browser-speech fallback, and the third-party playback service.
167
+ - **Shared layer**: defaults, text processing, segmentation, SSE, and playback contracts.
168
+ - **Host plugin**: settings and static assets, plus complete-audio and PCM streaming proxies for MiMo.
169
+ - **Web Client**: settings, message actions, browser-speech fallback, previews, and the optional third-party playback service.
150
170
 
151
171
  ```mermaid
152
172
  flowchart LR
@@ -154,40 +174,44 @@ flowchart LR
154
174
  THIRD["Third-party Web plugin"] -. "ctx.get('xiaomiMimoTts')" .-> CLIENT
155
175
  CLIENT -->|"Complete audio / PCM stream"| HOST["Host plugin<br/>Settings and API proxy"]
156
176
  HOST --> MIMO["Xiaomi MiMo API"]
157
- CLIENT -->|"Browser-local fallback"| SPEECH["Browser Web Speech API"]
158
- SHARED["Shared layer<br/>Configuration, text processing, SSE"] -.-> CLIENT
177
+ CLIENT -->|"Web Speech API"| SPEECH["Browser / system speech service"]
178
+ SHARED["Shared layer<br/>Configuration, text, SSE"] -.-> CLIENT
159
179
  SHARED -.-> HOST
160
180
  ```
161
181
 
162
182
  ## 🛠️ Development
163
183
 
164
- When editing the settings panel, run:
165
-
166
184
  ```bash
185
+ pnpm install
167
186
  pnpm dev
168
187
  ```
169
188
 
170
- This opens a local UI preview shell that renders `src/client/settings-card.tsx` directly with hot updates. It uses in-memory settings and local mock APIs, so it does not call MiMo or uninstall the plugin. Run `pnpm dev:build` to check that the preview shell builds independently.
171
-
172
- Run the settings UI lab while editing the panel:
173
-
174
- ```bash
175
- pnpm dev
176
- ```
189
+ `pnpm dev` starts the local UI Lab and renders `src/client/settings/card.tsx` directly. Saving, remote speech, and update checks are mocked locally; the preview does not call the real MiMo service.
177
190
 
178
- It opens a local Vite shell that renders `src/client/settings-card.tsx` directly with hot updates, so reinstalling the plugin or restarting DSH is unnecessary. The shell uses in-memory settings and local mock endpoints; it does not call the MiMo API or uninstall the plugin. Use `pnpm dev:build` to verify that the shell also builds on its own.
191
+ Common checks:
179
192
 
180
193
  ```bash
181
- pnpm install
182
194
  pnpm typecheck
183
195
  pnpm test
196
+ pnpm dev:build
184
197
  pnpm pack:check
185
198
  ```
186
199
 
187
- Use `pnpm build` for normal builds and `pnpm build:debug` when diagnosing the PCM streaming path.
200
+ - `pnpm build`: normal build.
201
+ - `pnpm build:debug`: build with PCM-path debug logging enabled.
202
+ - `pnpm profile:check`: verify the installation in the local DSH Web profile.
203
+
204
+ On Windows, stop DSH Web before replacing a local development link with the npm package so the running Node process does not hold the Junction:
205
+
206
+ ```powershell
207
+ .\start\dsh-plugin-reinstall.bat 3.0.5
208
+ ```
209
+
210
+ ## 🤝 Recommended plugins
188
211
 
189
- ## 🤝 Recommended companion plugins
212
+ ![whale-girls](assets/whale-girls.webp)
190
213
 
191
- - [dsh-whale-musume](https://github.com/Sutera-Diffusus/dsh-whale-musume#readme): energetic whale-girl desktop pet.
214
+ - [dsh-deep-whale](https://github.com/Small-tailqwq/dsh-deep-whale#readme): Whale Maid theme and skin series.
215
+ - [dsh-whale-musume](https://github.com/Sutera-Diffusus/dsh-whale-musume#readme): energetic Whale Maid desktop companion.
192
216
  - [dsh-plugin-uisfx](https://github.com/XanthanL/dsh-plugin-uisfx#readme): semantic UI sound effects.
193
217
  - [dsh-dream-skin](https://github.com/RevolutionLA/dsh-dream-skin#readme): native skins, wallpapers, accent colors, and theme packs.
package/README.md CHANGED
@@ -3,127 +3,148 @@
3
3
  # dsh-xiaomi-tts
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/dsh-xiaomi-tts.svg)](https://www.npmjs.com/package/dsh-xiaomi-tts)
6
- [![GitHub stars](https://img.shields.io/github/stars/ppy-web/dsh-plugin-xiaomi-mimo-tts.svg)](https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts)
7
6
  [![npm downloads](https://img.shields.io/npm/dm/dsh-xiaomi-tts.svg)](https://www.npmjs.com/package/dsh-xiaomi-tts)
8
- [![dsh](https://img.shields.io/badge/dsh-0.1.5--rc.1-2563eb)](https://github.com/deepseek-ai)
9
- ![Xiaomi MiMo](https://img.shields.io/badge/Xiaomi-Mimo?logo=xiaomi&logoColor=%23ff6900&label=power%20by&color=%23ff6900&link=https%3A%2F%2Fmimo.mi.com%2F)
7
+ ![dsh version](https://img.shields.io/badge/dsh-v0.1.7alpha2-blue?link=https%3A%2F%2Fgithub.com%2Fdeepseek-ai%2Fdeepseek-harness%2Freleases)
8
+ ![Xiaomi MiMo](https://img.shields.io/badge/Xiaomi-MiMo-ff6900?logo=xiaomi&logoColor=white)
10
9
 
11
- 为 DSH Web 添加 Xiaomi MiMo TTS 语音朗读。
10
+ 为 DSH Web 添加 Xiaomi MiMo TTS 语音朗读、浏览器本地语音兜底和可选 UI 音效。
12
11
 
13
- > 基于 Xiaomi MiMo TTS,将文字转为流畅、清晰的自然语音。MiMo TTS 当前为限时免费服务,具体政策请关注官方平台。
12
+ > MiMo TTS 当前可能处于限时免费或调整计费阶段,请以 Xiaomi MiMo 官方平台的最新政策为准。
14
13
 
15
14
  <p><a href="README.en.md"><strong>English README →</strong></a></p>
16
15
 
17
16
  ## 🎨 预览
18
17
 
19
- > [🧐 Preview Pages 预览本插件](https://ppy-web.github.io/dsh-plugin-xiaomi-mimo-tts)
18
+ - [在线打开 Preview Pages](https://ppy-web.github.io/dsh-plugin-xiaomi-mimo-tts)
20
19
 
21
- | 设置界面 | UI示例 |
20
+ | 设置界面 | 对话朗读入口 |
22
21
  |:---:|:---:|
23
- | ![UI](assets/setting.png) | ![UI](assets/image.png) |
22
+ | ![插件设置界面](assets/setting.png) | ![对话中的朗读按钮](assets/image.png) |
24
23
 
25
24
  ## ✨ 功能
26
25
 
27
- - 一键播报:在对话操作栏中显示“朗读”按钮(默认开启)。
28
- - 内置音色:使用 `mimo-v2.5-tts` 输出流畅、清晰的音频,并支持流式播放。
29
- - 倍速播放:支持 0.5×–2.0× 调整播放语速,设置会作用于 MiMo 和浏览器本地语音。
30
- - 自定义音色:使用 `mimo-v2.5-tts-voicedesign` 通过文字描述创造你想要的声音。
31
- - 浏览器本地音色:使用浏览器宿主提供的离线或在线音色。
32
- - 自动清洗文本:移除网址、文件路径、代码块、表情符号、图标和控制字符等。
33
- - 音效库:提供全局语义点击音效,以及当前任务开始、成功、失败和待处理提醒音效。
26
+ - 一键朗读:在助手消息操作栏中提供“朗读”按钮。
27
+ - 低延迟播放:`mimo-v2.5-tts` 支持 PCM 流式播放,并在必要时回退到完整音频或浏览器语音。
28
+ - 内置与自定义音色:支持官方内置音色,以及 `mimo-v2.5-tts-voicedesign` 音色描述。
29
+ - 浏览器本地语音:可选择 MiMo 优先、本地优先或仅使用 MiMo。
30
+ - 朗读范围:支持智能、全文和首段模式。
31
+ - 播放控制:支持 0.5×–2.0× 语速、语音音量、暂停、继续和停止。
32
+ - 文本清洗:朗读前移除网址、路径、代码块、表情符号和控制字符等不适合播报的内容。
33
+ - 演播厅:试听时明确显示正在使用 MiMo 还是浏览器本地语音,并区分常见失败原因。
34
+ - 可选音效:提供任务状态和语义化点击音效,默认关闭。
35
+ - 插件联动:向其他 DSH Web 插件暴露可选的 PCM 播放服务。
34
36
 
35
37
  ## 📋 环境要求
36
38
 
37
- - `@deepseek-ai/dsh` `0.1.5-rc.1`(当前插件仅适配此版本)
39
+ - `@deepseek-ai/dsh` `0.1.7-rc.1`(当前兼容目标版本)
38
40
  - Node.js 22+
39
- - Xiaomi MiMo API Key
41
+ - 使用 MiMo 语音时需要 Xiaomi MiMo API Key
40
42
  - [官方 TTS API 文档](https://mimo.mi.com/models/zh-CN/mimo-v2.5-tts)
41
43
 
42
- ## 🚀 安装与使用
44
+ ## 🚀 安装
43
45
 
44
- - 从 npm 安装 **(推荐)**:
46
+ ### 从 npm 安装(推荐)
45
47
 
46
48
  ```bash
47
- dsh plugin --profile web add dsh-xiaomi-tts
49
+ dsh plugin --profile web add dsh-xiaomi-tts@latest
48
50
  ```
49
51
 
50
- - 从 [DSH 插件市场](https://github.com/dsh-market/dsh-market) 安装 **(推荐)**:
52
+ ### 从插件市场安装
51
53
 
52
- 打开 **设置 → 插件市场**,搜索 `xiaomi-mimo-tts` 并点击安装。
54
+ 当前 DSH 插件市场已收录本插件,可在 **设置 → 插件市场** 中搜索 `xiaomi-mimo-tts`。
53
55
 
54
- - 让 DSH 或 任意AI Agent 帮你装——把下面这段提示词发给AI
55
-
56
- ```text
57
- 帮我给此电脑上的dsh安装 dsh-xiaomi-tts 插件。
58
- 1. 优先通过命令安装 dsh plugin --profile web add dsh-xiaomi-tts@latest
59
- 2. 如果失败,请尝试源码 https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts
60
- ```
61
-
62
- - 从 GitHub 安装:
56
+ ### 从 GitHub 安装
63
57
 
64
58
  ```bash
65
59
  dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
66
60
  ```
67
61
 
68
- - 从 GitHub Release 下载 `.tgz` 后安装:
62
+ 也可以下载 GitHub Release 中的 `.tgz`:
69
63
 
70
64
  ```powershell
71
65
  dsh plugin --profile web add "<下载路径>\dsh-xiaomi-tts-<版本>.tgz"
72
66
  ```
73
67
 
74
- Release tgz 已包含构建产物,无需执行 `pnpm approve-builds`。
68
+ Release 压缩包已包含构建产物,无需执行 `pnpm approve-builds`。
69
+
70
+ 安装完成后,重启正在运行的 DSH Web `web` profile,然后打开:
71
+
72
+ **侧边栏 → 插件 → dsh-xiaomi-tts → 语音朗读 (Xiaomi MiMo)**
75
73
 
76
- 安装后重启 `dsh web`,打开 **设置 → 插件 → 插件配置 → 语音朗读(Xiaomi MiMo)**
77
- [获取并填写 API Key](https://platform.xiaomimimo.com/console/api-keys) 。支持标准API Key / Token Plan 专属 API key
74
+ ## 🐋 首次使用
78
75
 
79
- 修改任意设置后需要点击 **保存** 生效。
76
+ 新安装的默认行为:
80
77
 
81
- ### 音效库
78
+ - 朗读按钮可用;
79
+ - **自动播报默认关闭**;
80
+ - **UI 音效默认关闭**;
81
+ - 未保存 API Key 时,“MiMo 优先”策略可能回退到浏览器本地语音。
82
82
 
83
- 在语音设置卡的 **演播厅** 下方,可以控制音效开关、音量、音色包、点击音效和任务音效,并试听常用提示音。音效由浏览器 Web Audio 合成,不会请求网络或保存音频文件。
83
+ 推荐配置顺序:
84
84
 
85
- ## ⚙️ 配置
85
+ 1. [获取 Xiaomi MiMo API Key](https://platform.xiaomimimo.com/console/api-keys)。
86
+ 2. 在插件设置中输入 Key,并点击底部 **保存**。
87
+ 3. 打开“调音台”,选择模型和音色。
88
+ 4. 在“演播厅”试听;状态气泡会显示实际使用的是 MiMo 还是浏览器本地语音。
89
+ 5. 按需开启自动播报和 UI 音效,再次保存。
86
90
 
87
- **官方内置音色(`mimo-v2.5-tts`)**:
91
+ > 新输入的 API Key 只有保存到 DSH Host 后才会用于 MiMo 试听。界面中的 `sk-` / `tp-` 检查只是格式识别,不代表服务端已经验证密钥有效。
92
+
93
+ ### 更换或清除 API Key
94
+
95
+ - 输入新 Key 并保存,会替换当前个人设置层的密钥。
96
+ - 点击 **清除** 并保存,会移除当前用户层覆盖。
97
+ - 如果 DSH 基础配置仍提供密钥,清除个人覆盖后会恢复继承该密钥;因此该操作不等同于撤销 Xiaomi 平台上的密钥。
98
+ - 如需彻底失效,请同时前往 Xiaomi MiMo 控制台撤销对应 Key。
99
+
100
+ ## ⚙️ 配置说明
101
+
102
+ ### 官方内置音色
103
+
104
+ `mimo-v2.5-tts` 当前提供:
88
105
 
89
106
  - 中文女声:`冰糖`、`茉莉`
90
107
  - 中文男声:`苏打`、`白桦`
91
108
  - 英文女声:`Mia`、`Chloe`
92
109
  - 英文男声:`Milo`、`Dean`
93
110
 
94
- **自定义音色(`mimo-v2.5-tts-voicedesign`)**
95
-
96
- 提供了常用音色描述模板;用户可以直接修改并保存描述。
111
+ ### 自定义音色
112
+
113
+ `mimo-v2.5-tts-voicedesign` 支持从音色描述生成声音。设置面板包含预设模板,也可以手动编辑:
114
+
97
115
  ```text
98
116
  青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。
99
117
  ```
100
118
 
101
- **浏览器本地兜底语音**
119
+ 音色描述支持预设模板,也可以直接手动编辑;修改后需要保存设置。
120
+
121
+ ### 浏览器本地语音
122
+
123
+ - **MiMo 优先**:MiMo 在首段音频开始前失败时,尝试浏览器语音。
124
+ - **本地优先**:先使用浏览器语音,失败后尝试 MiMo。
125
+ - **关闭本地语音**:只使用 MiMo,不进行本地兜底。
126
+
127
+ 浏览器音色来自 Web Speech API。是否离线、可用语言和实际声音取决于浏览器、操作系统及其语音服务。
128
+
129
+ ### 朗读范围
130
+
131
+ - **智能模式**:自动播报优先朗读首个语义段;未读内容较多时可能补一句收尾提示。手动朗读播放全文。
132
+ - **全文模式**:自动播报和手动朗读都播放全文。
133
+ - **首段模式**:自动播报和手动朗读都只播放首个语义段。
102
134
 
103
- 支持三种策略:“MiMo 优先”在 MiMo 失败时改用浏览器语音;“本地优先”优先使用浏览器语音;“关闭本地语音”仅使用 MiMo。
104
- 可选音色来自浏览器 Web Speech API,是否离线及实际可用范围取决于浏览器、操作系统和网络服务。
105
-
106
- **朗读范围**
107
-
108
- - **智能选择**:自动播报优先朗读回复的首个语义段;手动点击“朗读”时播放全文。短回复没有可拆分的段落时会完整播放。
109
- - **全文模式**:自动播报和手动朗读都播放全文。
110
- - **首段模式**:自动播报和手动朗读都只播放首个语义段。
111
-
112
- 设置面板支持键盘操作:按 `Tab` 在控件间移动,使用方向键调整滑块或切换选项,按空格确认当前操作。
135
+ 设置面板支持键盘操作:使用 `Tab` 移动焦点,方向键调整滑块或选项,空格键确认按钮和开关。
113
136
 
114
137
  ## 🔌 三方插件联动
115
- ![whale-girls](assets/whale-girls.webp)
116
138
 
117
- > 我们对外暴露了PCM流式播放能力。
118
- Web 插件可以直接调用本插件的服务进行流式播放。可直接在需要播放的位置写一行:
139
+ 本插件向 Web 插件提供可选 PCM 流式播放能力:
119
140
 
120
141
  ```ts
121
142
  ctx.get('xiaomiMimoTts')?.play('欢迎回来')
122
143
  ```
123
144
 
124
- 建议通过 `ctx.get()` 动态获取这项能力,不必声明为必需的 `inject` 服务。插件未安装或未就绪时调用会安全跳过;`play()` 使用用户已保存的 MiMo 设置播放 PCM 流,`stop()` 可主动停止。新播放会自动打断当前朗读。
145
+ 建议通过 `ctx.get()` 动态获取,不要声明为必需注入。插件未安装、未就绪或已关闭时,调用会安全跳过;新播放会中断当前朗读,`stop()` 可主动停止。
125
146
 
126
- 需要 TypeScript 类型提示时可仅导入类型:
147
+ 需要 TypeScript 类型时:
127
148
 
128
149
  ```ts
129
150
  import type { XiaomiMimoTtsService } from 'dsh-xiaomi-tts/client-api'
@@ -132,18 +153,20 @@ const tts = ctx.get('xiaomiMimoTts') as XiaomiMimoTtsService | undefined
132
153
  tts?.play('欢迎回来')
133
154
  ```
134
155
 
135
- ## 🔒 隐私
156
+ ## 🔒 隐私与网络访问
136
157
 
137
- - API Key 保存在 DSH Host,不会发送给浏览器。
138
- - 生成语音时,正文会被发送给 Xiaomi MiMo 服务。
139
- - 音频在浏览器内存中通过 Web Audio 或临时 Blob URL 播放,不会持久化到磁盘。
158
+ - API Key 由 DSH Host 保存,浏览器只读取“是否已配置/格式是否识别”的状态,不读取密钥正文。
159
+ - 生成 MiMo 语音时,待朗读正文和相关音色指令会发送至 Xiaomi MiMo 服务。
160
+ - 浏览器本地语音由 Web Speech API 提供;标记为在线的音色可能把文本交给浏览器、操作系统或其网络语音服务。
161
+ - 展开设置卡片时,DSH Host 会访问 npm Registry 检查是否存在新版本。
162
+ - 音频在浏览器内存中通过 Web Audio 或临时 Blob URL 播放,插件不会主动持久化音频文件。
140
163
  - 音效核心移植自 [uisfx 0.4.0](https://github.com/romainsimon/uisfx),遵循 MIT License,详见 `NOTICE`。
141
164
 
142
165
  ## 🏗️ 架构
143
166
 
144
- - **共享层**:统一配置、文本清理、分段和 SSE 契约。
145
- - **Host 插件**:管理设置与静态资源,并代理 MiMo 完整音频和 PCM 流式请求。
146
- - **Web Client**:提供设置与朗读入口,负责播放状态、浏览器语音兜底和第三方播放服务。
167
+ - **共享层**:配置默认值、文本处理、分段、SSE 和播放契约。
168
+ - **Host 插件**:注册设置与静态资源,并代理 MiMo 完整音频和 PCM 流式请求。
169
+ - **Web Client**:提供设置、消息朗读、浏览器语音兜底、试听和第三方播放服务。
147
170
 
148
171
  ```mermaid
149
172
  flowchart LR
@@ -151,40 +174,44 @@ flowchart LR
151
174
  THIRD["第三方 Web 插件"] -. "ctx.get('xiaomiMimoTts')" .-> CLIENT
152
175
  CLIENT -->|"完整音频 / PCM 流"| HOST["Host 插件<br/>设置与 API 代理"]
153
176
  HOST --> MIMO["Xiaomi MiMo API"]
154
- CLIENT -->|"本地语音兜底"| SPEECH["浏览器 Web Speech API"]
177
+ CLIENT -->|"Web Speech API"| SPEECH["浏览器 / 系统语音服务"]
155
178
  SHARED["共享层<br/>配置、文本处理、SSE"] -.-> CLIENT
156
179
  SHARED -.-> HOST
157
180
  ```
158
181
 
159
182
  ## 🛠️ 开发
160
183
 
161
- 修改设置面板时运行:
162
-
163
184
  ```bash
185
+ pnpm install
164
186
  pnpm dev
165
187
  ```
166
- 命令会打开本地 UI 预览壳,直接渲染 `src/client/settings-card.tsx` 并热更新。
188
+
189
+ `pnpm dev` 会启动本地 UI Lab,直接渲染 `src/client/settings/card.tsx`。设置保存、远程语音和版本检查使用本地 mock,不会调用真实 MiMo 服务。
190
+
191
+ 常用检查:
167
192
 
168
193
  ```bash
169
- pnpm install
170
194
  pnpm typecheck
171
195
  pnpm test
196
+ pnpm dev:build
172
197
  pnpm pack:check
173
198
  ```
174
199
 
175
- 日常构建使用 `pnpm build`。
176
- 排查 PCM 流式链路时使用 `pnpm build:debug`。
200
+ - `pnpm build`:正常构建。
201
+ - `pnpm build:debug`:启用 PCM 链路调试日志的构建。
202
+ - `pnpm profile:check`:验证本机 DSH Web profile 中的安装状态。
177
203
 
178
- > windows用户从本地开发版切换到 npm 版时,请先停止 DSH Web,避免 Windows Junction 被运行中的 Node 进程占用:
204
+ Windows 从本地开发链接切换到 npm 包前,请先停止 DSH Web,避免运行中的 Node 进程占用 Junction:
179
205
 
180
206
  ```powershell
181
- .\start\dsh-plugin-reinstall.bat 3.0.3
207
+ .\start\dsh-plugin-reinstall.bat 3.0.5
182
208
  ```
183
209
 
184
- ## 🤝 推荐
210
+ ## 🤝 推荐插件
211
+
185
212
  > 本插件的鲸鱼娘形象参考 `dsh-deep-whale` `dsh-whale-musume`由GPT生成。本插件的uisfx音效参考 `dsh-plugin-uisfx`实现
186
213
 
187
214
  - [dsh-deep-whale](https://github.com/Small-tailqwq/dsh-deep-whale#readme):鲸鱼娘主题皮肤系列。
188
215
  - [dsh-whale-musume](https://github.com/Sutera-Diffusus/dsh-whale-musume#readme):元气鲸鱼娘桌宠。
189
216
  - [dsh-plugin-uisfx](https://github.com/XanthanL/dsh-plugin-uisfx#readme):语义化 UI 音效。
190
- - [dsh-dream-skin](https://github.com/RevolutionLA/dsh-dream-skin#readme):原生换肤、背景壁纸、强调色、主题包 。
217
+ - [dsh-dream-skin](https://github.com/RevolutionLA/dsh-dream-skin#readme):原生换肤、背景壁纸、强调色和主题包。
Binary file
Binary file
Binary file
Binary file
package/cordis.patch.yml CHANGED
@@ -13,7 +13,10 @@
13
13
  voiceDesignCustomPrompt: '青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。'
14
14
  presetStylePrompt: '使用清晰、自然、准确的声音朗读,语速适中,停顿自然,语气平和克制,避免夸张表达。'
15
15
  format: 'pcm'
16
- autoPlay: true
16
+ autoPlay: false
17
+ soundEnabled: false
18
+ taskSounds: false
19
+ clickSounds: false
17
20
  instruction: '请忠实朗读原文,根据文本语气自然表达,不添加或改写内容。'
18
21
  maxTextLength: 12000
19
22
  requestTimeoutMs: 120000