Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

feat(tts): improve MiniMax voice selection

harry07031f9f19c2021a
diff --git a/app/services/voice.py b/app/services/voice.py
index e7b1841d..05dc0d29 100644
--- a/app/services/voice.py
+++ b/app/services/voice.py
@@ -8,11 +8,13 @@ import os
import queue
import re
import subprocess
+import tempfile
import threading
import time
import unicodedata
from datetime import datetime
from typing import Union
+from urllib.parse import urlparse
from xml.sax.saxutils import escape, unescape
import edge_tts
@@ -37,6 +39,7 @@ MINIMAX_TTS_MODELS = (
"speech-2.8-hd", "speech-2.8-turbo", "speech-2.6-hd", "speech-2.6-turbo",
"speech-02-hd", "speech-02-turbo", "speech-01-hd", "speech-01-turbo",
)
+_MINIMAX_TTS_MAX_AUDIO_HEX_CHARS = 100 * 1024 * 1024
NO_VOICE_NAME = "no-voice"
# `none` 是 PR #981 里曾使用过的无配音标识。这里短期兼容这个值,避免
# 已经手动调用过该分支的 API 用户升级后立即失效;WebUI 和新代码统一使用
@@ -147,9 +150,13 @@ def get_mimo_voices() -> list[str]:
return [f"mimo:{voice}-{gender}" for voice, gender in voices_with_gender]
-def get_minimax_voices() -> list[str]:
- """Return the configured MiniMax voice for the TTS selector."""
- voice_id = str(config.minimax_tts.get("voice_id", MINIMAX_TTS_DEFAULT_VOICE) or MINIMAX_TTS_DEFAULT_VOICE).strip()
+def get_minimax_voices(voice_id: str | None = None) -> list[str]:
+ """返回当前配置的 MiniMax 音色,供统一的 TTS 调度格式使用。"""
+ voice_id = str(
+ voice_id
+ or config.minimax_tts.get("voice_id", MINIMAX_TTS_DEFAULT_VOICE)
+ or MINIMAX_TTS_DEFAULT_VOICE
+ ).strip()
return [f"minimax:{voice_id}"]
@@ -1322,6 +1329,160 @@ def _resolve_minimax_tts_url(configured_url: str) -> str:
return configured_url
+def get_minimax_tts_api_key() -> str:
+ """返回 MiniMax TTS 的有效密钥,专用配置优先于 LLM 共享配置。"""
+ return str(
+ config.minimax_tts.get("api_key", "")
+ or config.app.get("minimax_api_key", "")
+ or os.getenv("MINIMAX_API_KEY", "")
+ or ""
+ ).strip()
+
+
+def _infer_minimax_tts_url(base_url: str) -> str:
+ """根据 MiniMax LLM 地址推断同区域的 TTS 地址,无法识别时返回空值。"""
+ normalized_url = str(base_url or "").strip()
+ if not normalized_url:
+ return ""
+
+ parse_target = normalized_url if "://" in normalized_url else f"//{normalized_url}"
+ host = (urlparse(parse_target).hostname or "").lower()
+ if host == "minimaxi.com" or host.endswith(".minimaxi.com"):
+ return MINIMAX_TTS_CN_URL
+ if host == "minimax.io" or host.endswith(".minimax.io"):
+ return MINIMAX_TTS_GLOBAL_URL
+ return ""
+
+
+def get_minimax_tts_endpoint() -> str:
+ """
+ 返回与当前有效密钥匹配的 MiniMax TTS 地址。
+
+ 独立配置 TTS Key 时尊重用户选择的 TTS 地址;复用 MiniMax LLM Key 时,
+ 优先跟随 LLM Base URL 的区域,避免中国站 Key 被发送到国际站而返回 401。
+ """
+ dedicated_key = str(config.minimax_tts.get("api_key", "") or "").strip()
+ if not dedicated_key:
+ inferred_url = _infer_minimax_tts_url(config.app.get("minimax_base_url", ""))
+ if inferred_url:
+ return inferred_url
+ return _resolve_minimax_tts_url(config.minimax_tts.get("base_url", ""))
+
+
+def get_minimax_voice_catalog(
+ api_key: str = "",
+ endpoint: str = "",
+ voice_type: str = "all",
+) -> list[dict[str, str]]:
+ """
+ 查询当前 MiniMax 账号可用的系统、克隆和生成音色。
+
+ 返回值统一为 voice_id、voice_name、voice_type 三个字段,调用方无需了解
+ MiniMax 按音色来源拆分数组的响应结构。查询失败时抛出异常,让 WebUI、
+ API 或 CLI 可以按各自交互方式展示明确错误,而不是静默返回空列表。
+ """
+ if voice_type not in {"system", "voice_cloning", "voice_generation", "all"}:
+ raise ValueError(f"Unsupported MiniMax voice type: {voice_type}")
+
+ effective_api_key = str(api_key or get_minimax_tts_api_key()).strip()
+ if not effective_api_key:
+ raise ValueError("MiniMax TTS API key is not set")
+
+ tts_endpoint = (
+ _resolve_minimax_tts_url(endpoint)
+ if endpoint
+ else get_minimax_tts_endpoint()
+ )
+ voice_endpoint = (
+ f"{tts_endpoint[:-len('/t2a_v2')]}/get_voice"
+ if tts_endpoint.endswith("/t2a_v2")
+ else f"{tts_endpoint.rstrip('/')}/get_voice"
+ )
+ response = requests.post(
+ voice_endpoint,
+ json={"voice_type": voice_type},
+ headers={
+ "Authorization": f"Bearer {effective_api_key}",
+ "Content-Type": "application/json",
+ },
+ timeout=30,
+ )
+ if response.status_code != 200:
+ raise RuntimeError(
+ f"MiniMax get_voice failed with status {response.status_code}: "
+ f"{response.text[:200]}"
+ )
+
+ try:
+ body = response.json()
+ except ValueError as exc:
+ raise RuntimeError("MiniMax get_voice returned invalid JSON") from exc
+
+ base_resp = body.get("base_resp") or {}
+ if base_resp.get("status_code") not in {0, "0"}:
+ status_message = str(base_resp.get("status_msg") or "unknown error")
+ raise RuntimeError(f"MiniMax get_voice failed: {status_message}")
+
+ catalog = []
+ seen_voice_ids = set()
+ response_groups = (
+ ("system", "system_voice"),
+ ("voice_cloning", "voice_cloning"),
+ ("voice_generation", "voice_generation"),
+ )
+ for normalized_type, response_key in response_groups:
+ for item in body.get(response_key) or []:
+ voice_id = str(item.get("voice_id") or "").strip()
+ if not voice_id or voice_id in seen_voice_ids:
+ continue
+ seen_voice_ids.add(voice_id)
+ catalog.append(
+ {
+ "voice_id": voice_id,
+ "voice_name": str(item.get("voice_name") or voice_id).strip(),
+ "voice_type": normalized_type,
+ }
+ )
+
+ logger.info(f"loaded MiniMax voices: count={len(catalog)}, type={voice_type}")
+ return catalog
+
+
+def _write_validated_minimax_audio(audio_bytes: bytes, voice_file: str) -> float:
+ """
+ 将 MiniMax 音频原子写入目标路径,并返回时长。
+
+ 远端返回成功状态不代表音频一定完整。先在同目录临时文件中验证,再使用
+ os.replace 原子替换,可以避免解码失败或 MoviePy 无法读取时留下半成品。
+ """
+ ensure_file_path_exists(voice_file)
+ output_dir = os.path.dirname(os.path.abspath(voice_file))
+ output_suffix = os.path.splitext(voice_file)[1] or ".mp3"
+ temp_fd, temp_path = tempfile.mkstemp(
+ prefix=".minimax-tts-", suffix=output_suffix, dir=output_dir
+ )
+ os.close(temp_fd)
+
+ try:
+ with open(temp_path, "wb") as output:
+ output.write(audio_bytes)
+
+ audio_clip = AudioFileClip(temp_path)
+ try:
+ audio_duration = float(audio_clip.duration)
+ finally:
+ audio_clip.close()
+
+ if not math.isfinite(audio_duration) or audio_duration <= 0:
+ raise ValueError("MiniMax TTS returned audio with an invalid duration")
+
+ os.replace(temp_path, voice_file)
+ return audio_duration
+ finally:
+ if os.path.exists(temp_path):
+ os.remove(temp_path)
+
+
def minimax_tts(text: str, voice_id: str, voice_rate: float, voice_file: str, voice_volume: float = 1.0) -> Union[SubMaker, None]:
"""Generate speech with the synchronous MiniMax T2A HTTP API."""
text, voice_id = (text or "").strip(), (voice_id or "").strip()
@@ -1329,11 +1490,11 @@ def minimax_tts(text: str, voice_id: str, voice_rate: float, voice_file: str, vo
logger.error("MiniMax TTS requires text and a voice ID")
return None
settings = config.minimax_tts
- api_key = str(settings.get("api_key", "") or config.app.get("minimax_api_key", "") or "").strip()
+ api_key = get_minimax_tts_api_key()
if not api_key:
logger.error("MiniMax TTS API key is not set")
return None
- url = _resolve_minimax_tts_url(str(settings.get("base_url", "") or ""))
+ url = get_minimax_tts_endpoint()
model = str(settings.get("model_id", MINIMAX_TTS_DEFAULT_MODEL) or MINIMAX_TTS_DEFAULT_MODEL).strip()
if model not in MINIMAX_TTS_MODELS:
logger.error(f"Unsupported MiniMax TTS model: {model}")
@@ -1375,12 +1536,10 @@ def minimax_tts(text: str, voice_id: str, voice_rate: float, voice_file: str, vo
if not isinstance(audio_hex, str) or not audio_hex:
logger.error("MiniMax TTS returned empty audio data")
continue
- ensure_file_path_exists(voice_file)
- with open(voice_file, "wb") as output:
- output.write(bytes.fromhex(audio_hex))
- audio_clip = AudioFileClip(voice_file)
- audio_duration = audio_clip.duration
- audio_clip.close()
+ if len(audio_hex) > _MINIMAX_TTS_MAX_AUDIO_HEX_CHARS:
+ logger.error("MiniMax TTS returned audio data exceeding the supported size")
+ continue
+ audio_duration = _write_validated_minimax_audio(bytes.fromhex(audio_hex), voice_file)
logger.success(f"MiniMax TTS succeeded: {voice_file}")
return populate_legacy_submaker_with_full_text(
ensure_legacy_submaker_fields(SubMaker()), text, audio_duration
diff --git a/config.example.toml b/config.example.toml
index afac1962..9d452c40 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -318,9 +318,10 @@ api_key = ""
# API key: https://platform.minimax.io/user-center/basic-information/interface-key
# Global endpoint: https://api.minimax.io/v1/t2a_v2
# China endpoint: https://api.minimaxi.com/v1/t2a_v2
-# The MiniMax text-generation API key is used as a fallback when this is empty.
+# When api_key is empty, the MiniMax LLM key and its matching regional endpoint
+# are reused automatically. Set both fields only when TTS uses a separate key.
api_key = ""
-base_url = "https://api.minimax.io/v1/t2a_v2"
+base_url = ""
model_id = "speech-2.8-hd"
voice_id = "English_expressive_narrator"
sample_rate = 32000
diff --git a/test/services/test_voice.py b/test/services/test_voice.py
index 37c0a604..27bdf375 100644
--- a/test/services/test_voice.py
+++ b/test/services/test_voice.py
@@ -629,9 +629,153 @@ class TestVoiceService(unittest.TestCase):
self.assertEqual(captured["json"]["voice_setting"]["voice_id"], "male-qn-qingse")
self.assertEqual(captured["json"]["audio_setting"]["format"], "mp3")
+ def test_minimax_tts_reuses_cn_llm_key_and_endpoint(self):
+ """TTS 未单独配置时,应复用同区域的 MiniMax LLM 凭证和地址。"""
+ class _Response:
+ status_code, text = 200, ""
+
+ @staticmethod
+ def json():
+ return {"data": {"audio": b"audio".hex(), "status": 2}, "base_resp": {"status_code": 0}}
+
+ class _Clip:
+ duration = 1.25
+
+ def close(self):
+ pass
+
+ captured = {}
+
+ def _post(url, json=None, headers=None, timeout=None):
+ captured.update(url=url, headers=headers)
+ return _Response()
+
+ settings = {
+ "api_key": "", "base_url": vs.MINIMAX_TTS_GLOBAL_URL,
+ "model_id": vs.MINIMAX_TTS_DEFAULT_MODEL, "audio_format": "mp3",
+ }
+ app_settings = {
+ "minimax_api_key": "shared-cn-key",
+ "minimax_base_url": "https://api.minimaxi.com/v1",
+ }
+ with tempfile.TemporaryDirectory() as tmp_dir, patch.object(
+ vs.config, "minimax_tts", settings
+ ), patch.object(vs.config, "app", app_settings), patch.object(
+ vs.requests, "post", side_effect=_post
+ ), patch.object(vs, "AudioFileClip", return_value=_Clip()):
+ voice_file = str(Path(tmp_dir) / "minimax.mp3")
+ result = vs.minimax_tts("测试。", "male-qn-qingse", 1.0, voice_file)
+
+ self.assertIsNotNone(result)
+ self.assertEqual(captured["url"], vs.MINIMAX_TTS_CN_URL)
+ self.assertEqual(captured["headers"]["Authorization"], "Bearer shared-cn-key")
+
+ def test_get_minimax_voice_catalog_normalizes_all_voice_types(self):
+ """音色查询应统一不同来源的响应结构,并忽略重复或空 Voice ID。"""
+
+ class _Response:
+ status_code, text = 200, ""
+
+ @staticmethod
+ def json():
+ return {
+ "system_voice": [
+ {"voice_id": "system-1", "voice_name": "系统音色"},
+ {"voice_id": "", "voice_name": "无效音色"},
+ ],
+ "voice_cloning": [
+ {"voice_id": "clone-1", "voice_name": "我的克隆音色"},
+ {"voice_id": "system-1", "voice_name": "重复音色"},
+ ],
+ "voice_generation": [{"voice_id": "generated-1"}],
+ "base_resp": {"status_code": "0"},
+ }
+
+ with patch.object(vs.requests, "post", return_value=_Response()) as post:
+ catalog = vs.get_minimax_voice_catalog(
+ api_key="test-key",
+ endpoint=vs.MINIMAX_TTS_CN_URL,
+ )
+
+ post.assert_called_once_with(
+ "https://api.minimaxi.com/v1/get_voice",
+ json={"voice_type": "all"},
+ headers={
+ "Authorization": "Bearer test-key",
+ "Content-Type": "application/json",
+ },
+ timeout=30,
+ )
+ self.assertEqual(
+ catalog,
+ [
+ {
+ "voice_id": "system-1",
+ "voice_name": "系统音色",
+ "voice_type": "system",
+ },
+ {
+ "voice_id": "clone-1",
+ "voice_name": "我的克隆音色",
+ "voice_type": "voice_cloning",
+ },
+ {
+ "voice_id": "generated-1",
+ "voice_name": "generated-1",
+ "voice_type": "voice_generation",
+ },
+ ],
+ )
+
+ def test_get_minimax_voice_catalog_exposes_provider_error(self):
+ """远端业务错误应明确抛出,不能被伪装成账号没有可用音色。"""
+
+ class _Response:
+ status_code, text = 200, ""
+
+ @staticmethod
+ def json():
+ return {
+ "base_resp": {
+ "status_code": 1004,
+ "status_msg": "invalid api key",
+ }
+ }
+
+ with patch.object(vs.requests, "post", return_value=_Response()):
+ with self.assertRaisesRegex(RuntimeError, "invalid api key"):
+ vs.get_minimax_voice_catalog(api_key="invalid-key")
+
+ def test_minimax_tts_does_not_leave_invalid_audio_output(self):
+ """响应音频无法解析时,不应覆盖已有文件或留下临时文件。"""
+ class _Response:
+ status_code, text = 200, ""
+
+ @staticmethod
+ def json():
+ return {"data": {"audio": b"invalid-audio".hex(), "status": 2}, "base_resp": {"status_code": 0}}
+
+ settings = {
+ "api_key": "test-key", "base_url": vs.MINIMAX_TTS_GLOBAL_URL,
+ "model_id": vs.MINIMAX_TTS_DEFAULT_MODEL, "audio_format": "mp3",
+ }
+ with tempfile.TemporaryDirectory() as tmp_dir, patch.object(
+ vs.config, "minimax_tts", settings
+ ), patch.object(vs.requests, "post", return_value=_Response()), patch.object(
+ vs, "AudioFileClip", side_effect=OSError("invalid audio")
+ ):
+ voice_path = Path(tmp_dir) / "minimax.mp3"
+ voice_path.write_bytes(b"existing-audio")
+ result = vs.minimax_tts("Speech test.", "English_expressive_narrator", 1.0, str(voice_path))
+
+ self.assertIsNone(result)
+ self.assertEqual(voice_path.read_bytes(), b"existing-audio")
+ self.assertEqual([path.name for path in Path(tmp_dir).iterdir()], ["minimax.mp3"])
+
def test_minimax_voice_helpers_and_dispatch(self):
with patch.object(vs.config, "minimax_tts", {"voice_id": "narrator"}):
self.assertEqual(vs.get_minimax_voices(), ["minimax:narrator"])
+ self.assertEqual(vs.get_minimax_voices("custom-voice"), ["minimax:custom-voice"])
self.assertTrue(vs.is_minimax_voice("minimax:narrator"))
sentinel = object()
with patch.object(vs, "minimax_tts", return_value=sentinel) as implementation:
diff --git a/test/services/test_webui_tts_settings.py b/test/services/test_webui_tts_settings.py
index cce8d7ac..3c9de67f 100644
--- a/test/services/test_webui_tts_settings.py
+++ b/test/services/test_webui_tts_settings.py
@@ -21,6 +21,7 @@ TTS_API_KEY_LABELS = {
"SiliconFlow API Key": "cloud.siliconflow.cn/account/ak",
"Gemini API Key": "aistudio.google.com/app/apikey",
"MiMo API Key": "mimo.mi.com/docs/",
+ "MiniMax TTS API Key": "platform.minimaxi.com",
"ElevenLabs API Key": "elevenlabs.io/app/settings/api-keys",
"Chatterbox API Key": "github.com/travisvn/chatterbox-tts-api",
}
@@ -30,6 +31,7 @@ TTS_PROVIDER_WIDGETS = {
"siliconflow": ("siliconflow_api_key_input", "SiliconFlow API Key"),
"gemini-tts": ("gemini_tts_api_key_input", "Gemini API Key"),
"mimo-tts": ("mimo_tts_api_key_input", "MiMo API Key"),
+ "minimax-tts": ("minimax_tts_api_key_input", "MiniMax TTS API Key"),
"elevenlabs": ("elevenlabs_api_key_input", "ElevenLabs API Key"),
"chatterbox": ("chatterbox_api_key_input", "Chatterbox API Key"),
}
@@ -154,3 +156,155 @@ def test_elevenlabs_environment_key_is_used_without_persisting_it():
assert get_voices.call_count >= 1
assert all(call.args == ("env-key",) for call in get_voices.call_args_list)
assert [str(item.value) for item in app.exception] == []
+
+
+def test_minimax_reconnect_restores_saved_tts_key():
+ """浏览器重连后的空状态不能清除已经保存的 MiniMax TTS Key。"""
+ test_config = dict(config.minimax_tts, api_key="saved-tts-key", base_url=voice.MINIMAX_TTS_GLOBAL_URL)
+ test_ui = dict(config.ui, voice_mode="tts", tts_server="minimax-tts", voice_name="")
+
+ with (
+ patch.object(config, "minimax_tts", test_config),
+ patch.object(config, "ui", test_ui),
+ patch.object(config, "try_save_config", return_value=True),
+ ):
+ app = AppTest.from_file(str(WEBUI_MAIN), default_timeout=30)
+ app.session_state["ui_language"] = "en"
+ app.session_state["minimax_tts_api_key_input"] = ""
+ app.run()
+
+ assert test_config["api_key"] == "saved-tts-key"
+ assert app.session_state["minimax_tts_api_key_input"] == "saved-tts-key"
+ assert [str(item.value) for item in app.exception] == []
+
+
+def test_minimax_shared_llm_key_is_not_duplicated_in_tts_config():
+ """共享 LLM Key 应自动匹配区域,但不能被复制进 TTS 专用配置。"""
+ test_config = dict(config.minimax_tts, api_key="", base_url="")
+ test_app_config = dict(
+ config.app,
+ minimax_api_key="shared-cn-key",
+ minimax_base_url="https://api.minimaxi.com/v1",
+ )
+ test_ui = dict(config.ui, voice_mode="tts", tts_server="minimax-tts", voice_name="")
+
+ with (
+ patch.object(config, "minimax_tts", test_config),
+ patch.object(config, "app", test_app_config),
+ patch.object(config, "ui", test_ui),
+ patch.object(config, "try_save_config", return_value=True),
+ ):
+ app = AppTest.from_file(str(WEBUI_MAIN), default_timeout=30)
+ app.session_state["ui_language"] = "en"
+ app.run()
+
+ api_key_input = _widget_by_key(app.text_input, "minimax_tts_api_key_input")
+ endpoint_select = _widget_by_key(app.selectbox, "minimax_tts_endpoint_select")
+ assert api_key_input.value == "shared-cn-key"
+ assert test_config["api_key"] == ""
+ assert endpoint_select.value == voice.MINIMAX_TTS_CN_URL
+ assert endpoint_select.disabled
+ assert [str(item.value) for item in app.exception] == []
+
+
+def test_minimax_voice_selector_accepts_a_custom_voice_id():
+ """MiniMax 通用音色选择器应开启列表外 Voice ID 输入能力。"""
+ test_config = dict(
+ config.minimax_tts,
+ api_key="test-key",
+ base_url=voice.MINIMAX_TTS_GLOBAL_URL,
+ voice_id="old-voice",
+ )
+ test_ui = dict(
+ config.ui,
+ voice_mode="tts",
+ tts_server="minimax-tts",
+ voice_name="minimax:old-voice",
+ )
+
+ with (
+ patch.object(config, "minimax_tts", test_config),
+ patch.object(config, "ui", test_ui),
+ patch.object(config, "try_save_config", return_value=True),
+ ):
+ app = AppTest.from_file(str(WEBUI_MAIN), default_timeout=30)
+ app.session_state["ui_language"] = "en"
+ app.run()
+ voice_select = _widget_by_key(
+ app.selectbox,
+ "speech_synthesis_select_minimax-tts",
+ )
+
+ assert voice_select.proto.accept_new_options
+ assert voice_select.value == "minimax:old-voice"
+ assert [str(item.value) for item in app.exception] == []
+
+
+def test_minimax_voices_load_only_on_demand_and_sync_the_selected_voice():
+ """音色列表只在用户点击后加载,选择结果应同步到配置和通用音色控件。"""
+ test_config = dict(
+ config.minimax_tts,
+ api_key="test-key",
+ base_url=voice.MINIMAX_TTS_CN_URL,
+ voice_id="old-voice",
+ )
+ test_ui = dict(
+ config.ui,
+ voice_mode="tts",
+ tts_server="minimax-tts",
+ voice_name="minimax:old-voice",
+ )
+ catalog = [
+ {
+ "voice_id": "Chinese (Mandarin)_News_Anchor",
+ "voice_name": "新闻女声",
+ "voice_type": "system",
+ },
+ {
+ "voice_id": "English_expressive_narrator",
+ "voice_name": "Expressive Narrator",
+ "voice_type": "system",
+ },
+ ]
+
+ with (
+ patch.object(config, "minimax_tts", test_config),
+ patch.object(config, "ui", test_ui),
+ patch.object(config, "try_save_config", return_value=True),
+ patch.object(
+ voice,
+ "get_minimax_voice_catalog",
+ return_value=catalog,
+ ) as get_catalog,
+ ):
+ app = AppTest.from_file(str(WEBUI_MAIN), default_timeout=30)
+ app.session_state["ui_language"] = "zh"
+ app.run()
+
+ # 普通页面 rerun 不能主动消耗 MiniMax API;只有点击按钮才查询。
+ get_catalog.assert_not_called()
+ _widget_by_key(app.button, "load_minimax_voices_button").click().run()
+ get_catalog.assert_called_once_with(
+ api_key="test-key",
+ endpoint=voice.MINIMAX_TTS_CN_URL,
+ voice_type="all",
+ )
+
+ voice_select = _widget_by_key(
+ app.selectbox,
+ "speech_synthesis_select_minimax-tts",
+ )
+ voice_select.set_value("minimax:Chinese (Mandarin)_News_Anchor").run()
+
+ assert test_config["voice_id"] == "Chinese (Mandarin)_News_Anchor"
+ assert voice_select.value == "minimax:Chinese (Mandarin)_News_Anchor"
+
+ voice_select = _widget_by_key(app.selectbox, "speech_synthesis_select_minimax-tts")
+ assert voice_select.proto.accept_new_options
+ assert test_config["voice_id"] == "Chinese (Mandarin)_News_Anchor"
+ assert test_ui["voice_name"] == "minimax:Chinese (Mandarin)_News_Anchor"
+ assert voice_select.value == "minimax:Chinese (Mandarin)_News_Anchor"
+ assert get_catalog.call_count == 1
+ assert not any(item.label == "MiniMax TTS Voice ID" for item in app.text_input)
+ assert not any(item.label == "MiniMax Voice Catalog" for item in app.selectbox)
+ assert [str(item.value) for item in app.exception] == []
diff --git a/webui/Main.py b/webui/Main.py
index 3f20e75a..dd7bef8e 100644
--- a/webui/Main.py
+++ b/webui/Main.py
@@ -1634,7 +1634,13 @@ def stable_selectbox(label, options, default_value, key, format_func=None, **kwa
widget_key = localized_widget_key(key)
selected_value = st.session_state.get(widget_key)
- if selected_value not in options:
+ accepts_custom_value = bool(kwargs.get("accept_new_options"))
+ has_valid_custom_value = (
+ accepts_custom_value
+ and isinstance(selected_value, str)
+ and bool(selected_value.strip())
+ )
+ if selected_value not in options and not has_valid_custom_value:
# 如果上游选项发生变化(例如切换 TTS provider 后声音列表变了),
# 旧值已经不合法。控件创建前直接初始化 session_state,之后只让 key
# 管理状态,不再同时传入 index。这样可以避免 Streamlit 在 rerun 时
@@ -2668,13 +2674,10 @@ def _get_voice_preview_provider_signature(tts_server: str) -> dict:
return {"credential": _credential_signature(config.app.get("mimo_api_key", ""))}
if tts_server == "minimax-tts":
return {
- "base_url": config.minimax_tts.get("base_url", ""),
+ "base_url": voice.get_minimax_tts_endpoint(),
"model_id": config.minimax_tts.get("model_id", ""),
"voice_id": config.minimax_tts.get("voice_id", ""),
- "credential": _credential_signature(
- config.minimax_tts.get("api_key", "")
- or config.app.get("minimax_api_key", "")
- ),
+ "credential": _credential_signature(voice.get_minimax_tts_api_key()),
}
if tts_server == "elevenlabs":
return {
@@ -2948,6 +2951,147 @@ def _get_reusable_full_voice_preview(params, voice_mode: str) -> dict | None:
}
+def _sync_minimax_tts_api_key_input():
+ """
+ 同步 MiniMax TTS 密码控件,并返回当前有效 Key。
+
+ TTS 专用 Key 为空时允许复用 MiniMax LLM Key。共享 Key 只用于当前控件和
+ 请求,不自动复制到 [minimax_tts],避免同一凭证在配置文件中重复维护。
+ """
+ widget_key = "minimax_tts_api_key_input"
+ configured_key = str(config.minimax_tts.get("api_key", "") or "").strip()
+ shared_key = str(
+ config.app.get("minimax_api_key", "")
+ or os.getenv("MINIMAX_API_KEY", "")
+ or ""
+ ).strip()
+ effective_key = configured_key or shared_key
+ had_widget_state = widget_key in st.session_state
+ entered_key = str(st.session_state.get(widget_key, "") or "").strip()
+
+ if not entered_key and effective_key:
+ # 浏览器重连可能重放空密码状态。恢复已配置凭证,防止空值覆盖配置,
+ # 同时确保当前 rerun 的试听请求可以直接使用有效 Key。
+ st.session_state[widget_key] = effective_key
+ entered_key = effective_key
+ if had_widget_state:
+ logger.debug("restored MiniMax TTS API key after empty session replay")
+ elif not had_widget_state:
+ st.session_state[widget_key] = effective_key
+ entered_key = effective_key
+
+ if entered_key and entered_key != effective_key:
+ _set_runtime_config("minimax_tts", "api_key", entered_key)
+
+ return entered_key
+
+
+def _get_cached_minimax_voices(api_key: str, endpoint: str) -> list[dict[str, str]]:
+ """按站点和凭证摘要读取当前会话中的 MiniMax 音色查询结果。"""
+ cache = st.session_state.get("minimax_tts_voice_catalog_cache", {})
+ cache_key = f"{endpoint}|{_credential_signature(api_key)}"
+ cached_voices = cache.get(cache_key, [])
+ return cached_voices if isinstance(cached_voices, list) else []
+
+
+def _cache_minimax_voices(
+ api_key: str,
+ endpoint: str,
+ voices: list[dict[str, str]],
+):
+ """缓存主动查询到的音色,避免普通控件 rerun 后重复请求 MiniMax。"""
+ cache = st.session_state.setdefault("minimax_tts_voice_catalog_cache", {})
+ cache_key = f"{endpoint}|{_credential_signature(api_key)}"
+ cache[cache_key] = voices
+
+
+def _render_minimax_tts_settings() -> tuple[list[str], dict[str, str]]:
+ """渲染 MiniMax TTS 配置,并返回统一音色选择器使用的选项和文案。"""
+ effective_api_key = _sync_minimax_tts_api_key_input()
+ effective_api_key = st.text_input(
+ tr("MiniMax TTS API Key"),
+ type="password",
+ key="minimax_tts_api_key_input",
+ ).strip()
+
+ dedicated_key = str(config.minimax_tts.get("api_key", "") or "").strip()
+ minimax_tts_endpoints = [voice.MINIMAX_TTS_GLOBAL_URL, voice.MINIMAX_TTS_CN_URL]
+ effective_endpoint = voice.get_minimax_tts_endpoint()
+ if effective_endpoint not in minimax_tts_endpoints:
+ effective_endpoint = voice.MINIMAX_TTS_GLOBAL_URL
+ minimax_tts_base_url = stable_selectbox(
+ tr("MiniMax TTS Endpoint"),
+ options=minimax_tts_endpoints,
+ default_value=effective_endpoint,
+ key="minimax_tts_endpoint_select",
+ # 复用 LLM Key 时必须跟随 LLM 所在区域,避免界面允许选择一个实际
+ # 不会生效的地址;填写独立 TTS Key 后即可单独选择站点。
+ disabled=not dedicated_key,
+ )
+ if dedicated_key:
+ _set_runtime_config("minimax_tts", "base_url", minimax_tts_base_url)
+
+ configured_model = config.minimax_tts.get("model_id", voice.MINIMAX_TTS_DEFAULT_MODEL)
+ if configured_model not in voice.MINIMAX_TTS_MODELS:
+ configured_model = voice.MINIMAX_TTS_DEFAULT_MODEL
+ minimax_tts_model = stable_selectbox(
+ tr("MiniMax TTS Model"),
+ options=list(voice.MINIMAX_TTS_MODELS),
+ default_value=configured_model,
+ key="minimax_tts_model_select",
+ )
+ _set_runtime_config("minimax_tts", "model_id", minimax_tts_model)
+
+ if st.button(
+ tr("Load MiniMax Voices"),
+ key="load_minimax_voices_button",
+ icon=":material/refresh:",
+ use_container_width=True,
+ ):
+ try:
+ available_voices = voice.get_minimax_voice_catalog(
+ api_key=effective_api_key,
+ endpoint=minimax_tts_base_url,
+ voice_type="all",
+ )
+ except Exception as exc:
+ # 这里必须把异常暴露给用户并记录日志。账号区域不匹配、Key 权限不足
+ # 或网络失败都很常见,静默返回空列表会让用户误以为账号没有音色。
+ logger.warning(f"load MiniMax voices failed: {exc}")
+ st.error(tr("MiniMax Voices Load Failed").format(error=str(exc)))
+ else:
+ _cache_minimax_voices(
+ effective_api_key,
+ minimax_tts_base_url,
+ available_voices,
+ )
+ st.success(
+ tr("MiniMax Voices Loaded").format(count=len(available_voices))
+ )
+
+ available_voices = _get_cached_minimax_voices(
+ effective_api_key,
+ minimax_tts_base_url,
+ )
+ voice_labels = {
+ f"minimax:{item['voice_id']}": (
+ f"{item['voice_name']} ({item['voice_id']})"
+ if item["voice_name"] != item["voice_id"]
+ else item["voice_id"]
+ )
+ for item in available_voices
+ }
+ configured_voice_id = str(
+ config.minimax_tts.get("voice_id", voice.MINIMAX_TTS_DEFAULT_VOICE)
+ or voice.MINIMAX_TTS_DEFAULT_VOICE
+ ).strip()
+ configured_voice = f"minimax:{configured_voice_id}"
+ # 尚未点击获取音色、接口暂时不可用或配置使用列表外克隆音色时,仍保留
+ # 当前 Voice ID,确保原有生成流程不依赖远端音色查询结果。
+ voice_labels.setdefault(configured_voice, configured_voice_id)
+ return list(voice_labels), voice_labels
+
+
def _sync_elevenlabs_api_key_input():
"""
同步 ElevenLabs 密码控件、持久化配置和环境变量,并返回当前有效 Key。
@@ -3292,6 +3436,15 @@ def _render_audio_settings(panel, params):
if provider_tips:
st.info(provider_tips)
+ # MiniMax 只复用下方通用“配音声音”选择器。Provider 配置函数负责
+ # 刷新远端音色并返回友好文案,不再额外渲染 Voice ID 和音色下拉框。
+ minimax_voices = []
+ minimax_voice_labels = {}
+ if tts_mode_enabled and selected_tts_server == "minimax-tts":
+ minimax_voices, minimax_voice_labels = (
+ _render_minimax_tts_settings()
+ )
+
# 根据选择的TTS服务器获取声音列表
filtered_voices = []
saved_voice_name = config.ui.get("voice_name", "")
@@ -3310,7 +3463,7 @@ def _render_audio_settings(panel, params):
# 获取 Xiaomi MiMo TTS 的预置音色列表
filtered_voices = voice.get_mimo_voices()
elif selected_tts_server == "minimax-tts":
- filtered_voices = voice.get_minimax_voices()
+ filtered_voices = minimax_voices
elif selected_tts_server == "elevenlabs":
# 音色列表位于 Key 输入框之前渲染,必须先统一恢复重连状态并读取
# 配置/环境变量,否则页面会用空 Key 加载并缓存空音色列表。
@@ -3350,7 +3503,7 @@ def _render_audio_settings(panel, params):
name = v.split(":", 1)[1] if ":" in v else v
return name.replace("-Female", "").replace("-Male", "")
if voice.is_minimax_voice(v):
- return v.split(":", 1)[1]
+ return minimax_voice_labels.get(v, v.split(":", 1)[1])
return (
v.replace("Female", tr("Female"))
.replace("Male", tr("Male"))
@@ -3384,9 +3537,26 @@ def _render_audio_settings(panel, params):
options=list(friendly_names.keys()),
default_value=list(friendly_names.keys())[saved_voice_name_index],
key=f"speech_synthesis_select_{selected_tts_server}",
- format_func=lambda value: friendly_names[value],
+ format_func=lambda value: friendly_names.get(
+ value,
+ str(value).removeprefix("minimax:"),
+ ),
+ # MiniMax 支持用户直接输入列表外的克隆或生成音色 ID;其它
+ # Provider 维持原选择器行为,不扩大本次修改的影响范围。
+ accept_new_options=selected_tts_server == "minimax-tts",
)
+ if selected_tts_server == "minimax-tts":
+ custom_voice_id = str(voice_name or "").strip()
+ if custom_voice_id and not voice.is_minimax_voice(custom_voice_id):
+ voice_name = f"minimax:{custom_voice_id}"
+ if voice.is_minimax_voice(voice_name):
+ _set_runtime_config(
+ "minimax_tts",
+ "voice_id",
+ voice_name.split(":", 1)[1],
+ )
+
params.voice_name = voice_name
if not voice.is_no_voice(voice_name):
# 占位 sentinel 仅用于非自动模式的禁用展示,不覆盖用户上一次
@@ -3472,59 +3642,6 @@ def _render_audio_settings(panel, params):
_set_runtime_config("app", "mimo_api_key", mimo_api_key)
- if tts_mode_enabled and (
- selected_tts_server == "minimax-tts"
- or (voice_name and voice.is_minimax_voice(voice_name))
- ):
- minimax_tts_api_key = st.text_input(
- tr("MiniMax TTS API Key"),
- value=config.minimax_tts.get("api_key", ""),
- type="password",
- key="minimax_tts_api_key_input",
- )
- _set_runtime_config("minimax_tts", "api_key", minimax_tts_api_key)
-
- minimax_tts_endpoints = [
- voice.MINIMAX_TTS_GLOBAL_URL,
- voice.MINIMAX_TTS_CN_URL,
- ]
- configured_endpoint = config.minimax_tts.get(
- "base_url", voice.MINIMAX_TTS_GLOBAL_URL
- )
- if configured_endpoint not in minimax_tts_endpoints:
- configured_endpoint = voice.MINIMAX_TTS_GLOBAL_URL
- minimax_tts_base_url = stable_selectbox(
- tr("MiniMax TTS Endpoint"),
- options=minimax_tts_endpoints,
- default_value=configured_endpoint,
- key="minimax_tts_endpoint_select",
- )
- _set_runtime_config("minimax_tts", "base_url", minimax_tts_base_url)
-
- configured_model = config.minimax_tts.get(
- "model_id", voice.MINIMAX_TTS_DEFAULT_MODEL
- )
- if configured_model not in voice.MINIMAX_TTS_MODELS:
- configured_model = voice.MINIMAX_TTS_DEFAULT_MODEL
- minimax_tts_model = stable_selectbox(
- tr("MiniMax TTS Model"),
- options=list(voice.MINIMAX_TTS_MODELS),
- default_value=configured_model,
- key="minimax_tts_model_select",
- )
- _set_runtime_config("minimax_tts", "model_id", minimax_tts_model)
-
- minimax_tts_voice_id = st.text_input(
- tr("MiniMax TTS Voice ID"),
- value=config.minimax_tts.get(
- "voice_id", voice.MINIMAX_TTS_DEFAULT_VOICE
- ),
- key="minimax_tts_voice_id_input",
- )
- _set_runtime_config(
- "minimax_tts", "voice_id", minimax_tts_voice_id.strip()
- )
-
# ElevenLabs API key section
if tts_mode_enabled and (
selected_tts_server == "elevenlabs"
diff --git a/webui/i18n/de.json b/webui/i18n/de.json
index 7a895c18..d15ff339 100644
--- a/webui/i18n/de.json
+++ b/webui/i18n/de.json
@@ -217,10 +217,12 @@
"SiliconFlow API Key": "SiliconFlow API-Schlüssel ([Schlüssel abrufen](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Google Gemini API-Schlüssel ([Schlüssel abrufen](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "Xiaomi MiMo API-Schlüssel ([Schlüssel abrufen](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Stimmen laden",
+ "MiniMax Voices Loaded": "{count} Stimmen geladen.",
+ "MiniMax Voices Load Failed": "Stimmen konnten nicht geladen werden: {error}",
"ElevenLabs API Key": "ElevenLabs API-Schlüssel ([Schlüssel abrufen](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "ElevenLabs-Modell",
"Chatterbox Base URL": "Chatterbox-Basis-URL",
diff --git a/webui/i18n/en.json b/webui/i18n/en.json
index 1da48967..e1b492d5 100644
--- a/webui/i18n/en.json
+++ b/webui/i18n/en.json
@@ -214,10 +214,12 @@
"SiliconFlow API Key": "SiliconFlow API Key ([Get API Key](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Google Gemini API Key ([Get API Key](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "Xiaomi MiMo API Key ([Get API Key](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Load Voices",
+ "MiniMax Voices Loaded": "Loaded {count} available voices.",
+ "MiniMax Voices Load Failed": "Failed to load voices: {error}",
"ElevenLabs API Key": "ElevenLabs API Key ([Get API Key](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "ElevenLabs Model",
"Chatterbox Base URL": "Chatterbox Base URL",
@@ -230,6 +232,7 @@
"tts_provider_tips.siliconflow": "Requires a SiliconFlow API key from the [console](https://cloud.siliconflow.cn/account/ak). Numeric speed and volume gain are supported.",
"tts_provider_tips.gemini-tts": "Requires a Gemini API key from [Google AI Studio](https://aistudio.google.com/app/apikey). Pace and style are controlled through natural-language instructions.",
"tts_provider_tips.mimo-tts": "Requires a Xiaomi MiMo API key; see the [first API call](https://mimo.mi.com/docs/quick-start/first-api-call). MiMo V2.5 controls pace and style through natural-language instructions.",
+ "tts_provider_tips.minimax-tts": "Use a MiniMax TTS API key from the [China platform](https://platform.minimaxi.com/user-center/basic-information/interface-key) or [global platform](https://platform.minimax.io/user-center/basic-information/interface-key). The key and endpoint must belong to the same platform. If left empty, the MiniMax LLM key and its matching endpoint are reused.",
"tts_provider_tips.elevenlabs": "Requires an [API key](https://elevenlabs.io/app/settings/api-keys). Add voices to your favorites in the [Voice Library](https://elevenlabs.io/app/voice-library) first.",
"tts_provider_tips.chatterbox": "Self-hosted. Run a compatible [Chatterbox TTS API](https://github.com/travisvn/chatterbox-tts-api), then enter a Base URL ending in `/v1`; the API key is usually optional.",
"Hide Log": "Hide Log",
diff --git a/webui/i18n/es.json b/webui/i18n/es.json
index 549fb6ba..ed5260c0 100644
--- a/webui/i18n/es.json
+++ b/webui/i18n/es.json
@@ -214,10 +214,12 @@
"SiliconFlow API Key": "Clave API de SiliconFlow ([Obtener clave](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Clave API de Google Gemini ([Obtener clave](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "Clave API de Xiaomi MiMo ([Obtener clave](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Cargar voces",
+ "MiniMax Voices Loaded": "Se cargaron {count} voces.",
+ "MiniMax Voices Load Failed": "No se pudieron cargar las voces: {error}",
"ElevenLabs API Key": "Clave API de ElevenLabs ([Obtener clave](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "Modelo de ElevenLabs",
"Chatterbox API Key": "Clave API de Chatterbox (Opcional; [Ver configuración](https://github.com/travisvn/chatterbox-tts-api))",
diff --git a/webui/i18n/id.json b/webui/i18n/id.json
index 2450ff17..804e7b99 100644
--- a/webui/i18n/id.json
+++ b/webui/i18n/id.json
@@ -214,10 +214,12 @@
"SiliconFlow API Key": "Kunci API SiliconFlow ([Dapatkan kunci](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Kunci API Google Gemini ([Dapatkan kunci](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "Kunci API Xiaomi MiMo ([Dapatkan kunci](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Muat suara",
+ "MiniMax Voices Loaded": "Berhasil memuat {count} suara.",
+ "MiniMax Voices Load Failed": "Gagal memuat suara: {error}",
"ElevenLabs API Key": "Kunci API ElevenLabs ([Dapatkan kunci](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "Model ElevenLabs",
"Chatterbox Base URL": "URL Dasar Chatterbox",
diff --git a/webui/i18n/pt.json b/webui/i18n/pt.json
index ada6015e..96315886 100644
--- a/webui/i18n/pt.json
+++ b/webui/i18n/pt.json
@@ -214,10 +214,12 @@
"SiliconFlow API Key": "Chave API do SiliconFlow ([Obter chave](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Chave API do Google Gemini ([Obter chave](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "Chave API do Xiaomi MiMo ([Obter chave](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Carregar vozes",
+ "MiniMax Voices Loaded": "{count} vozes carregadas.",
+ "MiniMax Voices Load Failed": "Falha ao carregar vozes: {error}",
"ElevenLabs API Key": "Chave API do ElevenLabs ([Obter chave](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "Modelo ElevenLabs",
"Chatterbox Base URL": "URL base do Chatterbox",
diff --git a/webui/i18n/ru.json b/webui/i18n/ru.json
index 14a762a2..2f88a7e9 100644
--- a/webui/i18n/ru.json
+++ b/webui/i18n/ru.json
@@ -210,10 +210,12 @@
"SiliconFlow API Key": "API-ключ SiliconFlow ([получить ключ](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "API-ключ Google Gemini ([получить ключ](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "API-ключ Xiaomi MiMo ([получить ключ](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Загрузить голоса",
+ "MiniMax Voices Loaded": "Загружено голосов: {count}.",
+ "MiniMax Voices Load Failed": "Не удалось загрузить голоса: {error}",
"ElevenLabs API Key": "API-ключ ElevenLabs ([получить ключ](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "Модель ElevenLabs",
"Chatterbox Base URL": "Базовый URL Chatterbox",
diff --git a/webui/i18n/tr.json b/webui/i18n/tr.json
index 42828ffe..dabd3aeb 100644
--- a/webui/i18n/tr.json
+++ b/webui/i18n/tr.json
@@ -212,10 +212,12 @@
"SiliconFlow API Key": "SiliconFlow API Anahtarı ([Anahtar al](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Google Gemini API Anahtarı ([Anahtar al](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "Xiaomi MiMo API Anahtarı ([Anahtar al](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Sesleri yükle",
+ "MiniMax Voices Loaded": "{count} ses yüklendi.",
+ "MiniMax Voices Load Failed": "Sesler yüklenemedi: {error}",
"ElevenLabs API Key": "ElevenLabs API Anahtarı ([Anahtar al](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "ElevenLabs Modeli",
"Chatterbox Base URL": "Chatterbox Temel URL'si",
diff --git a/webui/i18n/vi.json b/webui/i18n/vi.json
index cae9e396..e4769781 100644
--- a/webui/i18n/vi.json
+++ b/webui/i18n/vi.json
@@ -214,10 +214,12 @@
"SiliconFlow API Key": "Khóa API SiliconFlow ([Lấy khóa](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Khóa API Google Gemini ([Lấy khóa](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "Khóa API Xiaomi MiMo ([Lấy khóa](https://mimo.mi.com/docs/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API Key ([China](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [Global](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "Tải giọng nói",
+ "MiniMax Voices Loaded": "Đã tải {count} giọng nói.",
+ "MiniMax Voices Load Failed": "Không thể tải giọng nói: {error}",
"ElevenLabs API Key": "Khóa API ElevenLabs ([Lấy khóa](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "Mô Hình ElevenLabs",
"Chatterbox Base URL": "URL cơ sở Chatterbox",
diff --git a/webui/i18n/zh.json b/webui/i18n/zh.json
index d50cf6ff..bd601797 100644
--- a/webui/i18n/zh.json
+++ b/webui/i18n/zh.json
@@ -214,10 +214,12 @@
"SiliconFlow API Key": "硅基流动 API 密钥([点击获取](https://cloud.siliconflow.cn/account/ak))",
"Gemini API Key": "Google Gemini API 密钥([点击获取](https://aistudio.google.com/app/apikey))",
"MiMo API Key": "小米 MiMo API 密钥([点击获取](https://mimo.mi.com/docs/zh-CN/quick-start/first-api-call))",
- "MiniMax TTS API Key": "MiniMax TTS API Key",
+ "MiniMax TTS API Key": "MiniMax TTS API 密钥([中国站](https://platform.minimaxi.com/user-center/basic-information/interface-key) / [国际站](https://platform.minimax.io/user-center/basic-information/interface-key))",
"MiniMax TTS Endpoint": "MiniMax TTS Endpoint",
"MiniMax TTS Model": "MiniMax TTS Model",
- "MiniMax TTS Voice ID": "MiniMax TTS Voice ID",
+ "Load MiniMax Voices": "获取音色",
+ "MiniMax Voices Loaded": "已获取 {count} 个可用音色。",
+ "MiniMax Voices Load Failed": "获取音色失败:{error}",
"ElevenLabs API Key": "ElevenLabs API 密钥([点击获取](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "ElevenLabs 模型",
"Chatterbox Base URL": "Chatterbox Base URL",
@@ -230,6 +232,7 @@
"tts_provider_tips.siliconflow": "需要硅基流动 API Key,可在[控制台](https://cloud.siliconflow.cn/account/ak)创建;支持数值语速和音量增益。",
"tts_provider_tips.gemini-tts": "需要 Gemini API Key,可在 [Google AI Studio](https://aistudio.google.com/app/apikey) 创建;语速和风格由模型根据自然语言提示控制。",
"tts_provider_tips.mimo-tts": "需要小米 MiMo API Key,参考[首次调用](https://mimo.mi.com/docs/zh-CN/quick-start/first-api-call);V2.5 TTS 通过自然语言指令控制语速和风格。",
+ "tts_provider_tips.minimax-tts": "使用 [MiniMax 中国站](https://platform.minimaxi.com/user-center/basic-information/interface-key)或[国际站](https://platform.minimax.io/user-center/basic-information/interface-key)的 TTS API Key,Key 与服务地址必须属于同一站点。留空时会复用 MiniMax 大模型 Key,并自动匹配对应站点。",
"tts_provider_tips.elevenlabs": "需要 [API Key](https://elevenlabs.io/app/settings/api-keys);请先在 [Voice Library](https://elevenlabs.io/app/voice-library) 将音色加入收藏。",
"tts_provider_tips.chatterbox": "自托管服务。运行兼容的 [Chatterbox TTS API](https://github.com/travisvn/chatterbox-tts-api),并填写以 `/v1` 结尾的 Base URL;API Key 通常可选。",
"Hide Log": "隐藏日志",