dsh-xiaomi-tts 0.1.0 → 1.1.2

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
@@ -1,25 +1,23 @@
1
1
  # dsh-xiaomi-tts
2
2
 
3
- [中文说明](README.md)
3
+ <p><a href="README.md"><strong>中文说明 →</strong></a></p>
4
4
 
5
5
  Xiaomi MiMo text-to-speech controls for finalized assistant messages in DeepSeek Harness Web.
6
6
 
7
- ## Screenshots
7
+ ## Preview
8
8
 
9
9
  ![Xiaomi MiMo settings menu](assets/menu.png)
10
10
 
11
- ![Read aloud button](assets/play.png)
12
-
13
- ![Pause button](assets/pause.png)
11
+ ![Button](assets/image.png)
14
12
 
15
13
  ## Features
16
14
 
17
- - Adds a read-aloud button to the assistant message action strip.
15
+ - Adds an optional read-aloud button to the assistant message action strip; it is enabled by default.
18
16
  - Uses Xiaomi MiMo's official `mimo-v2.5-tts` Chat Completions-compatible API.
19
- - Configures the API key, autoplay, built-in voice, MP3/WAV format, and reading instruction under **Settings → Plugins → Plugin configuration**.
17
+ - Configures whether to show the read-aloud button, the API key, autoplay, built-in voice, MP3/WAV format, and reading instruction under **Settings → Plugins → Plugin configuration**.
20
18
  - Keeps the API key on the DSH Host. The browser sends only the response text to a same-origin plugin route.
21
19
  - Supports pause, resume, regeneration, request errors, and browser autoplay rejection.
22
- - The settings card is collapsed by default and expands on click.
20
+ - 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.
23
21
 
24
22
  Official Xiaomi MiMo TTS reference: <https://mimo.mi.com/static/docs/api/audio/tts.md>
25
23
 
@@ -31,6 +29,29 @@ dsh plugin --profile web add dsh-xiaomi-tts
31
29
 
32
30
  Restart `dsh web`, then open **Settings → Plugins → Plugin configuration** and save a Xiaomi MiMo API key.
33
31
 
32
+ 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:
33
+
34
+ ```powershell
35
+ .\start\dsh-plugin-reinstall.bat 1.1.2
36
+ ```
37
+
38
+ 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:
39
+
40
+ ```powershell
41
+ .\start\dsh-web-stop.bat
42
+ dsh plugin --profile web remove dsh-xiaomi-tts
43
+ dsh plugin --profile web add dsh-xiaomi-tts@1.1.2
44
+ .\start\dsh-web-start.bat
45
+ ```
46
+
47
+ The settings include the API key, read-aloud button, automatic read-aloud, voice, audio format, and reading instruction. Both switches are enabled by default; disabling the read-aloud button also disables automatic read-aloud, while enabling automatic read-aloud enables the button.
48
+
49
+ Browsers may block autoplay. If that happens, click the read-aloud button below a response.
50
+
51
+ ### Speech text preprocessing
52
+
53
+ 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.
54
+
34
55
  ## Development
35
56
 
36
57
  ```bash
@@ -40,7 +61,11 @@ pnpm test
40
61
  pnpm pack:check
41
62
  ```
42
63
 
43
- The response text is sent to Xiaomi MiMo when speech is generated. Review Xiaomi's privacy and data-handling terms before using the plugin with sensitive content.
64
+ ## Privacy
65
+
66
+ - The API key stays on the DSH Host and is never sent to the browser.
67
+ - Response text is sent to Xiaomi MiMo when speech is generated.
68
+ - Audio is played through a temporary Blob URL and is not persisted to disk.
44
69
 
45
70
  ## License
46
71
 
package/README.md CHANGED
@@ -2,26 +2,22 @@
2
2
 
3
3
  为 DeepSeek Harness Web 的助手回复添加 Xiaomi MiMo TTS 语音朗读。
4
4
 
5
- ## 界面预览
5
+ <p><a href="README.en.md"><strong>English README →</strong></a></p>
6
6
 
7
- 设置菜单中的插件配置默认收起,点击标题即可展开;助手回复操作栏会显示朗读、暂停和继续按钮。
7
+ ## 预览
8
8
 
9
9
  ![Xiaomi MiMo 设置菜单](assets/menu.png)
10
10
 
11
- ![朗读按钮](assets/play.png)
12
-
13
- ![暂停按钮](assets/pause.png)
11
+ ![图标示例](assets/image.png)
14
12
 
15
13
  ## 功能
16
14
 
17
- - 在每条已完成助手回复正文下方的操作栏中添加“朗读”按钮。
15
+ - 在每条已完成助手回复正文下方的操作栏中按需显示“朗读”按钮(默认开启)。
18
16
  - 调用 Xiaomi MiMo 官方 `mimo-v2.5-tts` 接口,把回复正文转成 MP3 或 WAV 并播放。
19
- - 在 **设置 → 插件 → 插件配置** 中配置 API Key、自动播报、音色、格式和朗读指令。
17
+ - 在 **设置 → 插件 → 插件配置** 中配置是否显示朗读按钮、API Key、自动播报、音色、格式和朗读指令。
20
18
  - API Key 仅由 DSH Host 读取,浏览器只向同源 Host 路由提交回复正文。
21
19
  - 支持暂停、继续、重新生成,以及浏览器自动播放被拦截时的提示。
22
- - 设置卡片默认折叠,减少插件配置占用的页面空间。
23
-
24
- > 当前版本聚焦官方内置音色模型 `mimo-v2.5-tts`,暂不提供 Voice Design 与 Voice Clone 配置。
20
+ - 发送给 TTS 前会积极清理朗读文本:移除网址、文件路径、代码块、表情符号、图标和控制字符,并将常规中文标点转换为英文标点。
25
21
 
26
22
  ## 环境要求
27
23
 
@@ -53,6 +49,21 @@ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
53
49
 
54
50
  安装后重启 `dsh web`,打开 **设置 → 插件 → 插件配置 → Xiaomi MiMo 语音朗读**,填写 API Key 并保存。
55
51
 
52
+ 更新或从本地开发版切换到 npm 版时,必须先停止 DSH Web,避免 Windows Junction 被运行中的 Node 进程占用:
53
+
54
+ ```powershell
55
+ .\start\dsh-plugin-reinstall.bat 1.1.2
56
+ ```
57
+
58
+ 这个脚本会按顺序停止 DSH Web、卸载当前 profile 中的插件、从 npm 安装指定版本并重新启动 DSH Web。若手动操作,请保持相同顺序:
59
+
60
+ ```powershell
61
+ .\start\dsh-web-stop.bat
62
+ dsh plugin --profile web remove dsh-xiaomi-tts
63
+ dsh plugin --profile web add dsh-xiaomi-tts@1.1.2
64
+ .\start\dsh-web-start.bat
65
+ ```
66
+
56
67
  ## 配置
57
68
 
58
69
  可用内置音色:
@@ -62,31 +73,19 @@ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
62
73
  - 英文女声:`Mia`、`Chloe`
63
74
  - 英文男声:`Milo`、`Dean`
64
75
 
65
- 设置卡片默认收起。点击“Xiaomi MiMo 语音朗读”标题后,可配置:
66
-
67
- - API Key
68
- - 是否自动播报新回复
69
- - 内置音色
70
- - MP3/WAV 输出格式
71
- - 朗读风格指令
72
-
73
- 默认配置位于 `cordis.patch.yml`,用户设置会覆盖 composition 默认值。
74
-
75
- ## 自动播报说明
76
+ 配置项包括 API Key、朗读按钮、自动播报、音色、音频格式和朗读风格指令。两个开关默认开启;关闭朗读按钮会同步关闭自动播报,开启自动播报会自动开启朗读按钮。
76
77
 
77
- 浏览器通常要求页面先发生一次用户交互,才允许带声音的自动播放。如果浏览器拒绝 `audio.play()`,插件不会绕过浏览器策略,点击回复下方的朗读按钮即可播放。
78
+ 浏览器可能阻止自动播放;遇到这种情况,请点击回复下方的朗读按钮。
78
79
 
79
- 为避免刚启用插件或打开历史会话时批量朗读旧消息,自动播报只处理插件加载后短时间内新挂载的回复操作项。
80
+ ### 朗读文本处理
80
81
 
81
- ## 安全设计
82
+ 朗读只使用清理后的正文,不会修改聊天记录中显示的助手回复。Markdown 链接会保留可读标题并删除链接地址;网址、文件路径、完整代码块、表情符号、图标、零宽字符和控制字符不会发送给 Xiaomi MiMo。行内代码保留文字内容但去除反引号,连续空白会合并,常规中文标点会转换为 ASCII 英文标点。
82
83
 
83
- - `apiKey` 的 Schemastery schema 标记为 `role('secret')`。
84
- - 设置描述通过 DSH wire 传到浏览器时会脱敏。
85
- - Host 使用 API Key 请求 `https://api.xiaomimimo.com/v1/chat/completions`。
86
- - 音频响应不会持久化到磁盘,浏览器使用临时 Blob URL 播放并在切换时释放。
87
- - Host 路由限制请求体大小、正文长度和请求超时。
84
+ ## 隐私
88
85
 
89
- 请注意:回复正文会发送给 Xiaomi MiMo 服务,请在使用前确认内容符合你的隐私与合规要求。
86
+ - API Key 仅保存在 DSH Host,不会发送给浏览器。
87
+ - 生成语音时,回复正文会发送给 Xiaomi MiMo 服务。
88
+ - 音频只通过临时 Blob URL 播放,不会持久化到磁盘。
90
89
 
91
90
  ## 开发
92
91
 
Binary file
package/assets/menu.png CHANGED
Binary file
package/cordis.patch.yml CHANGED
@@ -4,12 +4,13 @@
4
4
  - id: xiaomi-mimo-tts
5
5
  name: 'dsh-xiaomi-tts'
6
6
  config:
7
+ enabled: true
7
8
  apiKey: ''
8
9
  baseURL: 'https://api.xiaomimimo.com/v1'
9
10
  model: 'mimo-v2.5-tts'
10
11
  voice: '冰糖'
11
12
  format: 'mp3'
12
- autoPlay: false
13
+ autoPlay: true
13
14
  instruction: '请用自然、清晰、语速适中的语气朗读。'
14
15
  maxTextLength: 12000
15
16
  requestTimeoutMs: 120000
@@ -1,4 +1,5 @@
1
1
  import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
2
+ /** Client services required by this plugin. */
2
3
  export declare const inject: string[];
3
4
  declare const zh: {
4
5
  readonly 'action.play': "朗读回复";
@@ -9,19 +10,27 @@ declare const zh: {
9
10
  readonly 'error.noText': "这条回复没有可朗读的正文。";
10
11
  readonly 'error.request': "语音生成失败。";
11
12
  readonly 'error.play': "浏览器阻止了自动播放,请点击朗读按钮。";
12
- readonly 'settings.title': "Xiaomi MiMo 语音朗读";
13
+ readonly 'settings.title': "语音朗读 (Xiaomi MiMo)";
13
14
  readonly 'settings.description': "在助手回复操作栏中使用 Xiaomi MiMo TTS 生成并播放语音。";
15
+ readonly 'settings.enabled': "显示朗读按钮";
16
+ readonly 'settings.enabledHint': "关闭后不会在助手回复操作栏显示朗读按钮,也不会自动播报。";
14
17
  readonly 'settings.apiKey': "API Key";
15
18
  readonly 'settings.apiKeyHint': "密钥保存在 DSH 设置文件中,传到浏览器前会被脱敏。";
16
19
  readonly 'settings.apiKeyStatus': "只有输入新值并保存时才会替换现有密钥。";
17
- readonly 'settings.autoPlay': "自动播报新回复";
18
- readonly 'settings.autoPlayHint': "浏览器可能因为自动播放策略而拒绝;拒绝后可手动点击朗读。";
20
+ readonly 'settings.apiKeyConfigured': "已配置";
21
+ readonly 'settings.getApiKey': "获取 API Key";
22
+ readonly 'settings.autoPlay': "开启自动播报";
23
+ readonly 'settings.autoPlayHint': "开启时会同步显示朗读按钮;浏览器也可能拒绝自动播放。";
19
24
  readonly 'settings.voice': "内置音色";
20
25
  readonly 'settings.format': "音频格式";
21
26
  readonly 'settings.instruction': "朗读风格指令";
22
27
  readonly 'settings.save': "保存";
23
28
  readonly 'settings.saving': "保存中…";
24
29
  readonly 'settings.saved': "已保存";
30
+ readonly 'settings.unsaved': "未保存";
31
+ readonly 'settings.overridden': "已覆盖";
32
+ readonly 'settings.reset': "恢复默认";
33
+ readonly 'settings.discard': "放弃修改";
25
34
  readonly 'settings.failed': "保存失败,请重试。";
26
35
  readonly 'settings.readOnly': "当前 DSH 设置为只读。";
27
36
  readonly 'settings.secretPlaceholder': "输入新的 Xiaomi MiMo API Key";
@@ -34,6 +43,7 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
34
43
  'xiaomi-mimo-tts': LocaleKey;
35
44
  }
36
45
  }
46
+ /** Register the Web action, settings card, locale dictionaries, and styles. */
37
47
  export declare function apply(ctx: ClientContext): void;
38
48
  export {};
39
49
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAMhH,eAAO,MAAM,MAAM,UAMlB,CAAA;AA+BD,QAAA,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BE,CAAA;AA+BV,KAAK,SAAS,GAAG,MAAM,OAAO,EAAE,CAAA;AAIhC,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,iBAAiB,EAAE,SAAS,CAAA;KAC7B;CACF;AAkXD,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAgD9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAuC,MAAM,wCAAwC,CAAA;AAchH,+CAA+C;AAC/C,eAAO,MAAM,MAAM,UAMlB,CAAA;AAgBD,QAAA,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCE,CAAA;AAuCV,KAAK,SAAS,GAAG,MAAM,OAAO,EAAE,CAAA;AAIhC,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,iBAAiB,EAAE,SAAS,CAAA;KAC7B;CACF;AA8hBD,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA6C9C"}