dsh-xiaomi-tts 1.1.1 → 2.0.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
@@ -8,15 +8,15 @@ Xiaomi MiMo text-to-speech controls for finalized assistant messages in DeepSeek
8
8
 
9
9
  ![Xiaomi MiMo settings menu](assets/menu.png)
10
10
 
11
- ![Read aloud button](assets/play.png)
11
+ ![Preset](assets/preset.png)
12
12
 
13
- ![Pause button](assets/pause.png)
13
+ ![Button](assets/image.png)
14
14
 
15
15
  ## Features
16
16
 
17
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` Chat Completions-compatible API.
19
- - 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**.
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
20
  - Keeps the API key on the DSH Host. The browser sends only the response text to a same-origin plugin route.
21
21
  - Supports pause, resume, regeneration, request errors, and browser autoplay rejection.
22
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.
@@ -31,7 +31,26 @@ dsh plugin --profile web add dsh-xiaomi-tts
31
31
 
32
32
  Restart `dsh web`, then open **Settings → Plugins → Plugin configuration** and save a Xiaomi MiMo API key.
33
33
 
34
- 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.
34
+ 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
+
36
+ ```powershell
37
+ .\start\dsh-plugin-reinstall.bat 2.0.0
38
+ ```
39
+
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:
41
+
42
+ ```powershell
43
+ .\start\dsh-web-stop.bat
44
+ dsh plugin --profile web remove dsh-xiaomi-tts
45
+ dsh plugin --profile web add dsh-xiaomi-tts@2.0.0
46
+ .\start\dsh-web-start.bat
47
+ ```
48
+
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.
50
+
51
+ The settings card also provides common voice-description templates from the reference page; every template remains editable after selection.
52
+
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.
35
54
 
36
55
  Browsers may block autoplay. If that happens, click the read-aloud button below a response.
37
56
 
package/README.md CHANGED
@@ -8,15 +8,15 @@
8
8
 
9
9
  ![Xiaomi MiMo 设置菜单](assets/menu.png)
10
10
 
11
- ![朗读按钮](assets/play.png)
11
+ ![自定义音色](assets/preset.png)
12
12
 
13
- ![暂停按钮](assets/pause.png)
13
+ ![图标示例](assets/image.png)
14
14
 
15
15
  ## 功能
16
16
 
17
17
  - 在每条已完成助手回复正文下方的操作栏中按需显示“朗读”按钮(默认开启)。
18
- - 调用 Xiaomi MiMo 官方 `mimo-v2.5-tts` 接口,把回复正文转成 MP3 或 WAV 并播放。
19
- - 在 **设置 → 插件 → 插件配置** 中配置是否显示朗读按钮、API Key、自动播报、音色、格式和朗读指令。
18
+ - 调用 Xiaomi MiMo 官方 `mimo-v2.5-tts` 或 `mimo-v2.5-tts-voicedesign` 接口,把回复正文转成 MP3 或 WAV 并播放。
19
+ - 在 **设置 → 插件 → 插件配置** 中切换预置音色/自定义音色模型,配置 API Key、自动播报、音色、音色描述和格式。
20
20
  - API Key 仅由 DSH Host 读取,浏览器只向同源 Host 路由提交回复正文。
21
21
  - 支持暂停、继续、重新生成,以及浏览器自动播放被拦截时的提示。
22
22
  - 发送给 TTS 前会积极清理朗读文本:移除网址、文件路径、代码块、表情符号、图标和控制字符,并将常规中文标点转换为英文标点。
@@ -51,16 +51,41 @@ dsh plugin --profile web add github:ppy-web/dsh-plugin-xiaomi-mimo-tts
51
51
 
52
52
  安装后重启 `dsh web`,打开 **设置 → 插件 → 插件配置 → Xiaomi MiMo 语音朗读**,填写 API Key 并保存。
53
53
 
54
+ 更新或从本地开发版切换到 npm 版时,必须先停止 DSH Web,避免 Windows Junction 被运行中的 Node 进程占用:
55
+
56
+ ```powershell
57
+ .\start\dsh-plugin-reinstall.bat 2.0.0
58
+ ```
59
+
60
+ 这个脚本会按顺序停止 DSH Web、卸载当前 profile 中的插件、从 npm 安装指定版本并重新启动 DSH Web。若手动操作,请保持相同顺序:
61
+
62
+ ```powershell
63
+ .\start\dsh-web-stop.bat
64
+ dsh plugin --profile web remove dsh-xiaomi-tts
65
+ dsh plugin --profile web add dsh-xiaomi-tts@2.0.0
66
+ .\start\dsh-web-start.bat
67
+ ```
68
+
54
69
  ## 配置
55
70
 
56
- 可用内置音色:
71
+ 可用内置音色(`mimo-v2.5-tts`):
57
72
 
58
73
  - 中文女声:`冰糖`、`茉莉`
59
74
  - 中文男声:`苏打`、`白桦`
60
75
  - 英文女声:`Mia`、`Chloe`
61
76
  - 英文男声:`Milo`、`Dean`
62
77
 
63
- 配置项包括 API Key、朗读按钮、自动播报、音色、音频格式和朗读风格指令。两个开关默认开启;关闭朗读按钮会同步关闭自动播报,开启自动播报会自动开启朗读按钮。
78
+ 切换到 `mimo-v2.5-tts-voicedesign` 后,插件不会发送 `audio.voice`,而是把“自定义音色描述”作为上游 `user` 消息,把回复正文作为 `assistant` 消息发送。音色描述建议写成一到两句,只描述声音本身,例如:
79
+
80
+ 设置卡提供参考页中的常用音色描述模板;下拉框默认选择“自定义”,用户可以直接修改并保存描述。切换到其他模板后再切回“自定义”时,会恢复之前保存的自定义内容。
81
+
82
+ ```text
83
+ 青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。
84
+ ```
85
+
86
+ 建议包含年龄段与性别、声音质感、语速节奏和情绪底色,不写场景或动作。预置音色模式仍使用原来的内置音色配置。
87
+
88
+ 配置项包括 API Key、朗读按钮、自动播报、模型、内置音色、音色描述和音频格式。两个开关默认开启;关闭朗读按钮会同步关闭自动播报,开启自动播报会自动开启朗读按钮。
64
89
 
65
90
  浏览器可能阻止自动播放;遇到这种情况,请点击回复下方的朗读按钮。
66
91
 
Binary file
package/assets/menu.png CHANGED
Binary file
Binary file
package/cordis.patch.yml CHANGED
@@ -9,6 +9,8 @@
9
9
  baseURL: 'https://api.xiaomimimo.com/v1'
10
10
  model: 'mimo-v2.5-tts'
11
11
  voice: '冰糖'
12
+ voiceDesignPrompt: '青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。'
13
+ voiceDesignCustomPrompt: '青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。'
12
14
  format: 'mp3'
13
15
  autoPlay: true
14
16
  instruction: '请用自然、清晰、语速适中的语气朗读。'
@@ -21,9 +21,13 @@ declare const zh: {
21
21
  readonly 'settings.getApiKey': "获取 API Key";
22
22
  readonly 'settings.autoPlay': "开启自动播报";
23
23
  readonly 'settings.autoPlayHint': "开启时会同步显示朗读按钮;浏览器也可能拒绝自动播放。";
24
+ readonly 'settings.model': "TTS 模型";
25
+ readonly 'settings.presetModel': "预置音色模型";
26
+ readonly 'settings.voiceDesignModel': "自定义音色模型";
24
27
  readonly 'settings.voice': "内置音色";
28
+ readonly 'settings.voiceDesignPrompt': "自定义音色描述";
29
+ readonly 'settings.voiceDesignPromptHint': "按“年龄段 + 性别、声音质感、语速节奏、情绪底色”描述声音本身;不写场景或动作。";
25
30
  readonly 'settings.format': "音频格式";
26
- readonly 'settings.instruction': "朗读风格指令";
27
31
  readonly 'settings.save': "保存";
28
32
  readonly 'settings.saving': "保存中…";
29
33
  readonly 'settings.saved': "已保存";
@@ -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;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"}
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;AA8kBD,+EAA+E;AAC/E,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA6C9C"}
package/lib/client.js CHANGED
@@ -46,6 +46,59 @@ const TTS_VOICES = [
46
46
  "Milo",
47
47
  "Dean"
48
48
  ];
49
+ /** TTS models supported by this plugin. */
50
+ const TTS_MODELS = ["mimo-v2.5-tts", "mimo-v2.5-tts-voicedesign"];
51
+ /** Voice-design descriptions adapted from the reference voice-definition page. */
52
+ const TTS_VOICE_DESIGN_PRESETS = [
53
+ {
54
+ label: "元气少女",
55
+ prompt: "元气少女音色,明亮、轻快、笑意明显,语速偏快,句尾灵动,适合轻松内容和年轻化短视频。"
56
+ },
57
+ {
58
+ label: "邻家女孩",
59
+ prompt: "年轻女性,声音甜美、软萌、亲近,语速轻快,带一点黏人感和撒娇气质,但保持清晰可懂,适合轻松日常、聊天向内容。"
60
+ },
61
+ {
62
+ label: "新闻播报",
63
+ prompt: "专业新闻播报音色,中性偏成熟,吐字标准,节奏平稳,情绪克制,适合公告、新闻和正式说明。"
64
+ },
65
+ {
66
+ label: "温柔客服",
67
+ prompt: "温柔客服女声,亲切、耐心、清晰,语速适中,句尾轻微上扬,听起来可靠且不机械。"
68
+ },
69
+ {
70
+ label: "温柔女友",
71
+ prompt: "年轻女性,声音温柔、柔软、低饱和,语速偏慢,带轻微耳语感和亲密感,适合情感、治愈和晚间陪伴内容。"
72
+ },
73
+ {
74
+ label: "ASMR低语",
75
+ prompt: "年轻女性,声音极度轻柔,像在耳边说话,呼吸感明显,语速慢,适合哄睡、放松和沉浸式内容。"
76
+ },
77
+ {
78
+ label: "少年感男声",
79
+ prompt: "年轻男性,声音干净明亮,有少年感,语速略快,语气轻松自然,适合短视频口播和产品介绍。"
80
+ },
81
+ {
82
+ label: "纪录片男声",
83
+ prompt: "成熟男性,低沉稳重,气息稳定,语速中等偏慢,像纪录片旁白,带一点故事感但不过分夸张。"
84
+ },
85
+ {
86
+ label: "古风说书男声",
87
+ prompt: "古风说书人音色,成熟、有韵味,语速从容,语调起伏带叙事感,适合历史、武侠和传统故事。"
88
+ },
89
+ {
90
+ label: "科技解说男声",
91
+ prompt: "清晰、理性、现代,语速中等偏快,语气专业但不生硬,适合产品演示和技术说明。"
92
+ },
93
+ {
94
+ label: "电台夜谈男声",
95
+ prompt: "电台夜谈男声,温暖、低缓、松弛,带轻微气声,语速偏慢,适合情感电台、睡前故事和长篇陪伴内容。"
96
+ },
97
+ {
98
+ label: "悬疑旁白男声",
99
+ prompt: "悬疑故事旁白,声线偏低,语速克制,停顿明显,带一点紧张感和神秘感,适合悬疑、案件和氛围叙述。"
100
+ }
101
+ ];
49
102
  const TTS_PUNCTUATION = {
50
103
  ",": ",",
51
104
  "。": ".",
@@ -115,6 +168,8 @@ const DEFAULT_TTS_SETTINGS = {
115
168
  baseURL: "https://api.xiaomimimo.com/v1",
116
169
  model: "mimo-v2.5-tts",
117
170
  voice: "冰糖",
171
+ voiceDesignPrompt: "青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。",
172
+ voiceDesignCustomPrompt: "青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。",
118
173
  format: "mp3",
119
174
  autoPlay: true,
120
175
  instruction: "请用自然、清晰、语速适中的语气朗读。",
@@ -127,8 +182,10 @@ function resolveTtsSettings(value) {
127
182
  ...DEFAULT_TTS_SETTINGS,
128
183
  ...value
129
184
  };
185
+ const voiceDesignCustomPrompt = typeof value?.voiceDesignCustomPrompt === "string" ? value.voiceDesignCustomPrompt : TTS_VOICE_DESIGN_PRESETS.some((item) => item.prompt === resolved.voiceDesignPrompt) ? DEFAULT_TTS_SETTINGS.voiceDesignCustomPrompt : resolved.voiceDesignPrompt;
130
186
  return {
131
187
  ...resolved,
188
+ voiceDesignCustomPrompt,
132
189
  autoPlay: resolved.enabled ? resolved.autoPlay : false
133
190
  };
134
191
  }
@@ -164,9 +221,13 @@ const zh = {
164
221
  "settings.getApiKey": "获取 API Key",
165
222
  "settings.autoPlay": "开启自动播报",
166
223
  "settings.autoPlayHint": "开启时会同步显示朗读按钮;浏览器也可能拒绝自动播放。",
224
+ "settings.model": "TTS 模型",
225
+ "settings.presetModel": "预置音色模型",
226
+ "settings.voiceDesignModel": "自定义音色模型",
167
227
  "settings.voice": "内置音色",
228
+ "settings.voiceDesignPrompt": "自定义音色描述",
229
+ "settings.voiceDesignPromptHint": "按“年龄段 + 性别、声音质感、语速节奏、情绪底色”描述声音本身;不写场景或动作。",
168
230
  "settings.format": "音频格式",
169
- "settings.instruction": "朗读风格指令",
170
231
  "settings.save": "保存",
171
232
  "settings.saving": "保存中…",
172
233
  "settings.saved": "已保存",
@@ -200,9 +261,13 @@ const en = {
200
261
  "settings.getApiKey": "Get API Key",
201
262
  "settings.autoPlay": "Enable automatic read-aloud",
202
263
  "settings.autoPlayHint": "Enabling it also shows the read-aloud button; the browser may reject autoplay.",
264
+ "settings.model": "TTS model",
265
+ "settings.presetModel": "Preset voices",
266
+ "settings.voiceDesignModel": "Custom voice design",
203
267
  "settings.voice": "Built-in voice",
268
+ "settings.voiceDesignPrompt": "Custom voice description",
269
+ "settings.voiceDesignPromptHint": "Describe the voice itself with age/gender, texture, pace, and emotional baseline; avoid scenes or actions.",
204
270
  "settings.format": "Audio format",
205
- "settings.instruction": "Reading style instruction",
206
271
  "settings.save": "Save",
207
272
  "settings.saving": "Saving…",
208
273
  "settings.saved": "Saved",
@@ -225,11 +290,12 @@ function decodeSettings(value) {
225
290
  if (typeof value.enabled === "boolean") decoded.enabled = value.enabled;
226
291
  if (typeof value.apiKey === "string") decoded.apiKey = value.apiKey;
227
292
  if (typeof value.baseURL === "string") decoded.baseURL = value.baseURL;
228
- if (typeof value.model === "string") decoded.model = value.model;
293
+ if (TTS_MODELS.includes(value.model)) decoded.model = value.model;
229
294
  if (typeof value.voice === "string") decoded.voice = value.voice;
295
+ if (typeof value.voiceDesignPrompt === "string") decoded.voiceDesignPrompt = value.voiceDesignPrompt;
296
+ if (typeof value.voiceDesignCustomPrompt === "string") decoded.voiceDesignCustomPrompt = value.voiceDesignCustomPrompt;
230
297
  if (value.format === "mp3" || value.format === "wav") decoded.format = value.format;
231
298
  if (typeof value.autoPlay === "boolean") decoded.autoPlay = value.autoPlay;
232
- if (typeof value.instruction === "string") decoded.instruction = value.instruction;
233
299
  if (typeof value.maxTextLength === "number") decoded.maxTextLength = value.maxTextLength;
234
300
  if (typeof value.requestTimeoutMs === "number") decoded.requestTimeoutMs = value.requestTimeoutMs;
235
301
  return decoded;
@@ -466,10 +532,16 @@ function ReadAloudAction({ messageId, useSession, playback, settings, t }) {
466
532
  const EDITABLE_SETTING_FIELDS = [
467
533
  "enabled",
468
534
  "autoPlay",
535
+ "model",
469
536
  "voice",
470
- "format",
471
- "instruction"
537
+ "voiceDesignPrompt",
538
+ "voiceDesignCustomPrompt",
539
+ "format"
472
540
  ];
541
+ const CUSTOM_VOICE_DESIGN_OPTION = "__custom__";
542
+ function isPresetVoiceDesignPrompt(value) {
543
+ return TTS_VOICE_DESIGN_PRESETS.some((item) => item.prompt === value);
544
+ }
473
545
  function layerSettings(value) {
474
546
  return isRecord(value) ? value : void 0;
475
547
  }
@@ -508,9 +580,11 @@ function SettingsCard({ scope, t }) {
508
580
  const [apiKey, setApiKey] = (0, react.useState)("");
509
581
  const [enabled, setEnabled] = (0, react.useState)(initial.enabled);
510
582
  const [autoPlay, setAutoPlay] = (0, react.useState)(initial.autoPlay);
583
+ const [model, setModel] = (0, react.useState)(initial.model);
511
584
  const [voice, setVoice] = (0, react.useState)(initial.voice);
585
+ const [voiceDesignPrompt, setVoiceDesignPrompt] = (0, react.useState)(initial.voiceDesignPrompt);
586
+ const [voiceDesignCustomPrompt, setVoiceDesignCustomPrompt] = (0, react.useState)(initial.voiceDesignCustomPrompt);
512
587
  const [format, setFormat] = (0, react.useState)(initial.format);
513
- const [instruction, setInstruction] = (0, react.useState)(initial.instruction);
514
588
  const [changes, setChanges] = (0, react.useState)({});
515
589
  const [state, setState] = (0, react.useState)("idle");
516
590
  const [open, setOpen] = (0, react.useState)(false);
@@ -519,9 +593,11 @@ function SettingsCard({ scope, t }) {
519
593
  const draft = {
520
594
  enabled,
521
595
  autoPlay: enabled && autoPlay,
596
+ model,
522
597
  voice,
523
- format,
524
- instruction
598
+ voiceDesignPrompt,
599
+ voiceDesignCustomPrompt,
600
+ format
525
601
  };
526
602
  const acceptedValue = (field) => {
527
603
  const raw = value?.[field];
@@ -547,9 +623,11 @@ function SettingsCard({ scope, t }) {
547
623
  const next = resolveTtsSettings(value);
548
624
  setEnabled(next.enabled);
549
625
  setAutoPlay(next.autoPlay);
626
+ setModel(next.model);
550
627
  setVoice(next.voice);
628
+ setVoiceDesignPrompt(next.voiceDesignPrompt);
629
+ setVoiceDesignCustomPrompt(next.voiceDesignCustomPrompt);
551
630
  setFormat(next.format);
552
- setInstruction(next.instruction);
553
631
  setChanges({});
554
632
  }, [dirty, value]);
555
633
  if (snapshot.status === "unavailable") return null;
@@ -564,17 +642,21 @@ function SettingsCard({ scope, t }) {
564
642
  markChange(field, "clear");
565
643
  if (field === "enabled") setEnabled(base.enabled);
566
644
  if (field === "autoPlay") setAutoPlay(base.autoPlay);
645
+ if (field === "model") setModel(base.model);
567
646
  if (field === "voice") setVoice(base.voice);
647
+ if (field === "voiceDesignPrompt") setVoiceDesignPrompt(base.voiceDesignPrompt);
648
+ if (field === "voiceDesignCustomPrompt") setVoiceDesignCustomPrompt(base.voiceDesignCustomPrompt);
568
649
  if (field === "format") setFormat(base.format);
569
- if (field === "instruction") setInstruction(base.instruction);
570
650
  };
571
651
  const discard = () => {
572
652
  const next = resolveTtsSettings(scope.getSnapshot().value);
573
653
  setEnabled(next.enabled);
574
654
  setAutoPlay(next.autoPlay);
655
+ setModel(next.model);
575
656
  setVoice(next.voice);
657
+ setVoiceDesignPrompt(next.voiceDesignPrompt);
658
+ setVoiceDesignCustomPrompt(next.voiceDesignCustomPrompt);
576
659
  setFormat(next.format);
577
- setInstruction(next.instruction);
578
660
  setApiKey("");
579
661
  setChanges({});
580
662
  setState("idle");
@@ -739,30 +821,86 @@ function SettingsCard({ scope, t }) {
739
821
  })]
740
822
  }),
741
823
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
742
- className: "xmimo-tts-instruction",
824
+ className: "xmimo-tts-model xmimo-tts-wide",
743
825
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
744
- label: t("settings.instruction"),
826
+ label: t("settings.model"),
745
827
  overriddenLabel: t("settings.overridden"),
746
828
  resetLabel: t("settings.reset"),
747
- overridden: fieldOverridden("instruction"),
829
+ overridden: fieldOverridden("model"),
748
830
  resettable: true,
749
831
  disabled: !snapshot.writable,
750
832
  onReset: () => {
751
- resetField("instruction");
833
+ resetField("model");
752
834
  }
753
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
754
- value: instruction,
755
- rows: 6,
835
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
836
+ value: model,
756
837
  disabled: !snapshot.writable,
757
838
  onChange: (event) => {
758
- setInstruction(event.target.value);
759
- markChange("instruction");
760
- }
839
+ setModel(event.target.value);
840
+ markChange("model");
841
+ },
842
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
843
+ value: "mimo-v2.5-tts",
844
+ children: t("settings.presetModel")
845
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
846
+ value: "mimo-v2.5-tts-voicedesign",
847
+ children: t("settings.voiceDesignModel")
848
+ })]
761
849
  })]
762
850
  }),
851
+ model === "mimo-v2.5-tts-voicedesign" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
852
+ className: "xmimo-tts-voice-design-prompt xmimo-tts-wide",
853
+ children: [
854
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
855
+ label: t("settings.voiceDesignPrompt"),
856
+ overriddenLabel: t("settings.overridden"),
857
+ resetLabel: t("settings.reset"),
858
+ overridden: fieldOverridden("voiceDesignPrompt"),
859
+ resettable: true,
860
+ disabled: !snapshot.writable,
861
+ onReset: () => {
862
+ resetField("voiceDesignPrompt");
863
+ }
864
+ }),
865
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
866
+ value: isPresetVoiceDesignPrompt(voiceDesignPrompt) ? voiceDesignPrompt : CUSTOM_VOICE_DESIGN_OPTION,
867
+ disabled: !snapshot.writable,
868
+ "aria-label": t("settings.voiceDesignPrompt"),
869
+ onChange: (event) => {
870
+ setVoiceDesignPrompt(event.target.value === CUSTOM_VOICE_DESIGN_OPTION ? voiceDesignCustomPrompt : event.target.value);
871
+ markChange("voiceDesignPrompt");
872
+ },
873
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
874
+ value: CUSTOM_VOICE_DESIGN_OPTION,
875
+ children: "自定义"
876
+ }), TTS_VOICE_DESIGN_PRESETS.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
877
+ value: item.prompt,
878
+ children: item.label
879
+ }, item.label))]
880
+ }),
881
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
882
+ value: voiceDesignPrompt,
883
+ rows: 4,
884
+ disabled: !snapshot.writable,
885
+ placeholder: t("settings.voiceDesignPromptHint"),
886
+ onChange: (event) => {
887
+ const next = event.target.value;
888
+ setVoiceDesignPrompt(next);
889
+ setVoiceDesignCustomPrompt(next);
890
+ setChanges((current) => ({
891
+ ...current,
892
+ voiceDesignPrompt: { kind: "set" },
893
+ voiceDesignCustomPrompt: { kind: "set" }
894
+ }));
895
+ setState("idle");
896
+ }
897
+ }),
898
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("settings.voiceDesignPromptHint") })
899
+ ]
900
+ }) : null,
763
901
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
764
- className: "xmimo-tts-select-column",
765
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
902
+ className: model === "mimo-v2.5-tts" ? "xmimo-tts-select-column xmimo-tts-wide" : "xmimo-tts-select-column",
903
+ children: [model === "mimo-v2.5-tts" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
766
904
  label: t("settings.voice"),
767
905
  overriddenLabel: t("settings.overridden"),
768
906
  resetLabel: t("settings.reset"),
@@ -783,7 +921,7 @@ function SettingsCard({ scope, t }) {
783
921
  value: item,
784
922
  children: item
785
923
  }, item))
786
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
924
+ })] }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingFieldHeading, {
787
925
  label: t("settings.format"),
788
926
  overriddenLabel: t("settings.overridden"),
789
927
  resetLabel: t("settings.reset"),
@@ -864,9 +1002,9 @@ function apply(ctx) {
864
1002
  .xmimo-tts-action{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:transparent;border:none;border-radius:28px;justify-content:center;align-items:center;padding:6px;display:inline-flex}.xmimo-tts-action:hover{background:var(--dsw-alias-interactive-bg-hover,#f3f4f6);color:var(--dsw-alias-label-secondary,#5f6875)}.xmimo-tts-action[aria-pressed=true]{background:var(--dsw-alias-interactive-bg-hover,#f3f4f6);color:var(--dsw-alias-label-secondary,#5f6875)}.xmimo-tts-action:disabled{cursor:default;opacity:.45}.xmimo-tts-spin{animation:xmimo-spin 1s linear infinite}@keyframes xmimo-spin{to{transform:rotate(360deg)}}
865
1003
  .xmimo-tts-inline-error{max-width:220px;color:var(--dsw-alias-state-error-primary,#dc2626);font-size:12px}
866
1004
  .xmimo-tts-card{list-style:none;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:12px;color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-3,#fff);overflow:hidden;transition:border-color 160ms ease,background 160ms ease}.xmimo-tts-card:hover{border-color:var(--dsw-alias-label-dimmed,#c8ccd4)}.xmimo-tts-card-open{background:var(--dsw-alias-bg-layer-2,#f7f8fa);border-color:var(--dsw-alias-label-dimmed,#c8ccd4)}.xmimo-tts-card-header{appearance:none;display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border:0;border-radius:12px;color:inherit;text-align:left;background:transparent;font:inherit;cursor:pointer}.xmimo-tts-card-header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:-2px}.xmimo-tts-card-head-text{display:flex;min-width:0;flex:1;flex-direction:column;gap:4px}.xmimo-tts-card-title{font-size:15px;font-weight:600}.xmimo-tts-card-description{color:var(--dsw-alias-label-tertiary,#8b93a1);font-size:13px;line-height:18px}.xmimo-tts-chevron{flex:none;color:var(--dsw-alias-label-tertiary,#8b93a1);transition:transform 160ms ease}.xmimo-tts-chevron-open{transform:rotate(180deg)}.xmimo-tts-pending{flex:none;border-radius:999px;padding:1px 8px;color:var(--dsw-alias-label-secondary,#5f6875);background:var(--dsw-alias-bg-module-platform,#eef0f3);font-size:11px;font-weight:500;line-height:17px}.xmimo-tts-card-body{border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);margin:0 16px;padding:0 0 16px}
867
- .xmimo-tts-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px 14px;margin-top:16px;align-items:start}.xmimo-tts-grid label,.xmimo-tts-api-key,.xmimo-tts-instruction,.xmimo-tts-select-column>div{display:flex;min-width:0;flex-direction:column;gap:6px;font-size:13px}.xmimo-tts-grid input,.xmimo-tts-grid select,.xmimo-tts-grid textarea{box-sizing:border-box;width:100%;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:8px;padding:8px 10px;color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-2,#f3f4f6);font:inherit}.xmimo-tts-grid select{color-scheme:light dark}.xmimo-tts-grid select option{color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-1,#fff)}.xmimo-tts-grid select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}.xmimo-tts-grid small{color:var(--dsw-alias-label-tertiary,#8b93a1);line-height:17px}.xmimo-tts-field-heading{display:flex;min-width:0;min-height:20px;flex-direction:row!important;align-items:center;justify-content:space-between;gap:8px}.xmimo-tts-field-label{display:inline-flex;min-width:0;align-items:center;gap:8px}.xmimo-tts-api-key-link{color:var(--dsw-alias-brand-primary,#4f6ef7);font-size:12px;text-decoration:none}.xmimo-tts-api-key-link:hover{text-decoration:underline}.xmimo-tts-field-badges{display:flex!important;flex:none;flex-direction:row!important;align-items:center;gap:8px}.xmimo-tts-overridden{border-radius:999px;padding:1px 7px;color:var(--dsw-alias-label-secondary,#5f6875);background:var(--dsw-alias-bg-module-platform,#eef0f3);font-size:11px;line-height:17px}.xmimo-tts-reset{padding:0;border:0;color:var(--dsw-alias-label-secondary,#5f6875);background:transparent;font:inherit;font-size:12px;cursor:pointer}.xmimo-tts-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2328)}.xmimo-tts-reset:disabled{cursor:not-allowed;opacity:.45}.xmimo-tts-api-key-hints{display:flex;min-width:0;gap:8px;align-items:center}.xmimo-tts-api-key-hints small{min-width:0;white-space:nowrap}.xmimo-tts-wide{grid-column:1/-1}.xmimo-tts-switch-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px}.xmimo-tts-checkbox-row{flex-direction:row!important;align-items:flex-start!important}.xmimo-tts-checkbox-row input{width:auto!important;flex:none;margin-top:3px}.xmimo-tts-checkbox-row span{display:flex;min-width:0;flex-direction:column;gap:4px}.xmimo-tts-select-column{display:flex;min-width:0;flex-direction:column;gap:16px}
1005
+ .xmimo-tts-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px 14px;margin-top:16px;align-items:start}.xmimo-tts-grid label,.xmimo-tts-api-key,.xmimo-tts-model,.xmimo-tts-voice-design-prompt,.xmimo-tts-select-column>div{display:flex;min-width:0;flex-direction:column;gap:6px;font-size:13px}.xmimo-tts-grid input,.xmimo-tts-grid select,.xmimo-tts-grid textarea{box-sizing:border-box;width:100%;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:8px;padding:8px 10px;color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-2,#f3f4f6);font:inherit}.xmimo-tts-grid select{color-scheme:light dark}.xmimo-tts-grid select option{color:var(--dsw-alias-label-primary,#1f2328);background:var(--dsw-alias-bg-layer-1,#fff)}.xmimo-tts-grid select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}.xmimo-tts-grid small{color:var(--dsw-alias-label-tertiary,#8b93a1);line-height:17px}.xmimo-tts-field-heading{display:flex;min-width:0;min-height:20px;flex-direction:row!important;align-items:center;justify-content:space-between;gap:8px}.xmimo-tts-field-label{display:inline-flex;min-width:0;align-items:center;gap:8px}.xmimo-tts-api-key-link{color:var(--dsw-alias-brand-primary,#4f6ef7);font-size:12px;text-decoration:none}.xmimo-tts-api-key-link:hover{text-decoration:underline}.xmimo-tts-field-badges{display:flex!important;flex:none;flex-direction:row!important;align-items:center;gap:8px}.xmimo-tts-overridden{border-radius:999px;padding:1px 7px;color:var(--dsw-alias-label-secondary,#5f6875);background:var(--dsw-alias-bg-module-platform,#eef0f3);font-size:11px;line-height:17px}.xmimo-tts-reset{padding:0;border:0;color:var(--dsw-alias-label-secondary,#5f6875);background:transparent;font:inherit;font-size:12px;cursor:pointer}.xmimo-tts-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2328)}.xmimo-tts-reset:disabled{cursor:not-allowed;opacity:.45}.xmimo-tts-api-key-hints{display:flex;min-width:0;gap:8px;align-items:center}.xmimo-tts-api-key-hints small{min-width:0;white-space:nowrap}.xmimo-tts-wide{grid-column:1/-1}.xmimo-tts-switch-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px}.xmimo-tts-checkbox-row{flex-direction:row!important;align-items:flex-start!important}.xmimo-tts-checkbox-row input{width:auto!important;flex:none;margin-top:3px}.xmimo-tts-checkbox-row span{display:flex;min-width:0;flex-direction:column;gap:4px}.xmimo-tts-select-column{display:flex;min-width:0;flex-direction:row;gap:16px}.xmimo-tts-select-column>div{flex:1}
868
1006
  .xmimo-tts-card-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:16px;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l2,#e5e7eb);font-size:12px;color:var(--dsw-alias-label-tertiary,#8b93a1)}.xmimo-tts-card-actions button{border:1px solid var(--dsw-alias-brand-primary,#4f6ef7);border-radius:8px;padding:5px 14px;color:var(--dsw-alias-bg-layer-1,#fff);background:var(--dsw-alias-brand-primary,#4f6ef7);cursor:pointer;font:inherit}.xmimo-tts-card-actions button:hover:not(:disabled){filter:brightness(1.08)}.xmimo-tts-card-actions button:disabled{cursor:not-allowed;color:var(--dsw-alias-label-dimmed,#9ca3af);background:var(--dsw-alias-bg-layer-2,#f3f4f6);border-color:var(--dsw-alias-border-l2,#e5e7eb);opacity:1}.xmimo-tts-card-actions .xmimo-tts-discard{border-color:var(--dsw-alias-border-l2,#e5e7eb);color:var(--dsw-alias-label-secondary,#5f6875);background:transparent}.xmimo-tts-card-actions .xmimo-tts-discard:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2328);border-color:var(--dsw-alias-label-dimmed,#c8ccd4)}.xmimo-tts-failed{color:var(--dsw-alias-state-error-primary,#dc2626)}
869
- @media(max-width:720px){.xmimo-tts-grid{grid-template-columns:1fr}.xmimo-tts-wide{grid-column:auto}.xmimo-tts-switch-row{grid-template-columns:1fr}.xmimo-tts-instruction,.xmimo-tts-select-column{grid-column:auto}.xmimo-tts-api-key-hints{flex-wrap:wrap}.xmimo-tts-api-key-hints small{white-space:normal}}
1007
+ @media(max-width:720px){.xmimo-tts-grid{grid-template-columns:1fr}.xmimo-tts-wide{grid-column:auto}.xmimo-tts-switch-row{grid-template-columns:1fr}.xmimo-tts-select-column{grid-column:auto;flex-direction:column}.xmimo-tts-api-key-hints{flex-wrap:wrap}.xmimo-tts-api-key-hints small{white-space:normal}}
870
1008
  `;
871
1009
  document.head.appendChild(style);
872
1010
  return () => style.remove();