Skip to content

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

feat(webui): add Fish Audio API key input and default Female/Male voice options

Hariom paswan0cab4dd5bfda
diff --git a/app/services/voice.py b/app/services/voice.py
index 7266fa14..a7461c11 100644
--- a/app/services/voice.py
+++ b/app/services/voice.py
@@ -230,7 +230,10 @@ def get_fish_audio_voices() -> list[str]:
additional public or cloned voices via ``[fish_audio] voices`` in the
config file.
"""
- result = ["fish_audio:default:Default Voice"]
+ result = [
+ "fish_audio:default:Default-Female",
+ "fish_audio:default:Default-Male",
+ ]
voices = config.fish_audio.get("voices", []) or []
if isinstance(voices, str):
voices = [v.strip() for v in voices.split(",") if v.strip()]
diff --git a/test/services/test_fish_audio.py b/test/services/test_fish_audio.py
index 22e4d42b..76d551c1 100644
--- a/test/services/test_fish_audio.py
+++ b/test/services/test_fish_audio.py
@@ -43,13 +43,19 @@ class TestFishAudioVoiceHelpers(unittest.TestCase):
self.assertFalse(vs.is_fish_audio_voice(None))
def test_get_fish_audio_voices_default(self):
- """With no voices configured, returns the default voice entry."""
+ """With no voices configured, returns default female and male voice entries."""
with patch.object(vs.config, "fish_audio", {"voices": []}):
voices = vs.get_fish_audio_voices()
- self.assertEqual(voices, ["fish_audio:default:Default Voice"])
+ self.assertEqual(
+ voices,
+ [
+ "fish_audio:default:Default-Female",
+ "fish_audio:default:Default-Male",
+ ],
+ )
def test_get_fish_audio_voices_with_configured_entries(self):
- """User-configured voices are appended after the default."""
+ """User-configured voices are appended after the defaults."""
with patch.object(
vs.config,
"fish_audio",
@@ -59,7 +65,8 @@ class TestFishAudioVoiceHelpers(unittest.TestCase):
self.assertEqual(
voices,
[
- "fish_audio:default:Default Voice",
+ "fish_audio:default:Default-Female",
+ "fish_audio:default:Default-Male",
"fish_audio:abc123:My Narrator",
"fish_audio:def456:def456",
],
diff --git a/webui/Main.py b/webui/Main.py
index 9f4aaaf5..4e56db10 100644
--- a/webui/Main.py
+++ b/webui/Main.py
@@ -4876,7 +4876,11 @@ def _render_audio_settings(panel, params):
return minimax_voice_labels.get(v, v.split(":", 1)[1])
if voice.is_fish_audio_voice(v):
parts = v.split(":", 2)
- return parts[2] if len(parts) >= 3 else v
+ display_name = parts[2] if len(parts) >= 3 else v
+ return (
+ display_name.replace("Female", tr("Female"))
+ .replace("Male", tr("Male"))
+ )
return (
v.replace("Female", tr("Female"))
.replace("Male", tr("Male"))
@@ -5060,11 +5064,24 @@ def _render_audio_settings(panel, params):
)
_set_runtime_config("elevenlabs", "model_id", elevenlabs_model)
- # Fish Audio API settings section (API key is read securely server-side from config.toml, never rendered in the UI)
+ # Fish Audio API settings section
if tts_mode_enabled and (
selected_tts_server == "fish_audio"
or (voice_name and voice.is_fish_audio_voice(voice_name))
):
+ saved_fish_api_key = (
+ config.fish_audio.get("api_key", "")
+ if hasattr(config, "fish_audio") and isinstance(config.fish_audio, dict)
+ else ""
+ )
+ fish_audio_api_key = st.text_input(
+ tr("Fish Audio API Key"),
+ value=saved_fish_api_key,
+ type="password",
+ key="fish_audio_api_key_input",
+ )
+ _set_runtime_config("fish_audio", "api_key", fish_audio_api_key)
+
_fish_audio_models = [
"s2.1-pro-free",
"s2.1-pro",
@@ -5078,7 +5095,7 @@ def _render_audio_settings(panel, params):
if saved_fish_model not in _fish_audio_models:
saved_fish_model = "s2.1-pro-free"
fish_model = stable_selectbox(
- "Fish Audio Model",
+ tr("Fish Audio Model"),
options=_fish_audio_models,
default_value=saved_fish_model,
key="fish_audio_model_select",
diff --git a/webui/i18n/de.json b/webui/i18n/de.json
index e3a1bc6b..f94f71bf 100644
--- a/webui/i18n/de.json
+++ b/webui/i18n/de.json
@@ -239,7 +239,9 @@
"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",
+ "ElevenLabs Model": "ElevenLabs Modell",
+ "Fish Audio API Key": "Fish Audio API-Schlüssel ([Schlüssel abrufen](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Fish Audio Modell",
"Chatterbox Base URL": "Chatterbox-Basis-URL",
"Chatterbox API Key": "Chatterbox API-Schlüssel (Optional; [Konfiguration ansehen](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Chatterbox-Modell",
diff --git a/webui/i18n/en.json b/webui/i18n/en.json
index 90bffdd4..ecd77669 100644
--- a/webui/i18n/en.json
+++ b/webui/i18n/en.json
@@ -248,6 +248,8 @@
"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",
+ "Fish Audio API Key": "Fish Audio API Key ([Get API Key](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Fish Audio Model",
"Chatterbox Base URL": "Chatterbox Base URL",
"Chatterbox API Key": "Chatterbox API Key (Optional; [View Setup](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Chatterbox Model",
@@ -261,6 +263,7 @@
"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.",
+ "tts_provider_tips.fish_audio": "Requires a Fish Audio API key from the [developer portal](https://fish.audio/app/developers). Free developer model `s2.1-pro-free` is included. [Browse public voices](https://fish.audio) or configure custom voices in `config.toml`.",
"Hide Log": "Hide Log",
"Hide Basic Settings": "Hide Basic Settings\n\nHidden, the basic settings panel will not be displayed on the page.\n\nIf you need to display it again, please set `hide_config = false` in `config.toml`",
"LLM Settings": "**LLM Settings**",
diff --git a/webui/i18n/es.json b/webui/i18n/es.json
index fe1debf0..56fa9c64 100644
--- a/webui/i18n/es.json
+++ b/webui/i18n/es.json
@@ -237,6 +237,8 @@
"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",
+ "Fish Audio API Key": "Clave API de Fish Audio ([Obtener clave](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Modelo Fish Audio",
"Chatterbox API Key": "Clave API de Chatterbox (Opcional; [Ver configuración](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Base URL": "URL base de Chatterbox",
"Chatterbox Model": "Modelo de Chatterbox",
diff --git a/webui/i18n/id.json b/webui/i18n/id.json
index 903c36b0..4fa29c24 100644
--- a/webui/i18n/id.json
+++ b/webui/i18n/id.json
@@ -237,6 +237,8 @@
"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",
+ "Fish Audio API Key": "Kunci API Fish Audio ([Dapatkan kunci](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Model Fish Audio",
"Chatterbox Base URL": "URL Dasar Chatterbox",
"Chatterbox API Key": "Kunci API Chatterbox (Opsional; [Lihat konfigurasi](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Model Chatterbox",
diff --git a/webui/i18n/it.json b/webui/i18n/it.json
index 06381887..a8a2cc88 100644
--- a/webui/i18n/it.json
+++ b/webui/i18n/it.json
@@ -237,6 +237,8 @@
"MiniMax Voices Load Failed": "Impossibile caricare le voci: {error}",
"ElevenLabs API Key": "Chiave API ElevenLabs ([Ottieni chiave API](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "Modello ElevenLabs",
+ "Fish Audio API Key": "Chiave API Fish Audio ([Ottieni chiave API](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Modello Fish Audio",
"Chatterbox Base URL": "Base URL di Chatterbox",
"Chatterbox API Key": "Chiave API Chatterbox (facoltativa; [Visualizza configurazione](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Modello Chatterbox",
diff --git a/webui/i18n/pt.json b/webui/i18n/pt.json
index cc93ce92..ec853403 100644
--- a/webui/i18n/pt.json
+++ b/webui/i18n/pt.json
@@ -236,7 +236,9 @@
"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",
+ "ElevenLabs Model": "Modelo do ElevenLabs",
+ "Fish Audio API Key": "Chave API do Fish Audio ([Obter chave](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Modelo Fish Audio",
"Chatterbox Base URL": "URL base do Chatterbox",
"Chatterbox API Key": "Chave API do Chatterbox (Opcional; [Ver configuração](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Modelo Chatterbox",
diff --git a/webui/i18n/ru.json b/webui/i18n/ru.json
index 12f0f0ed..924a84e8 100644
--- a/webui/i18n/ru.json
+++ b/webui/i18n/ru.json
@@ -233,6 +233,8 @@
"MiniMax Voices Load Failed": "Не удалось загрузить голоса: {error}",
"ElevenLabs API Key": "API-ключ ElevenLabs ([получить ключ](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "Модель ElevenLabs",
+ "Fish Audio API Key": "API-ключ Fish Audio ([получить ключ](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Модель Fish Audio",
"Chatterbox Base URL": "Базовый URL Chatterbox",
"Chatterbox API Key": "API-ключ Chatterbox (необязательно; [настройка](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Модель Chatterbox",
diff --git a/webui/i18n/tr.json b/webui/i18n/tr.json
index fbd94c4e..c1225b8c 100644
--- a/webui/i18n/tr.json
+++ b/webui/i18n/tr.json
@@ -235,6 +235,8 @@
"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",
+ "Fish Audio API Key": "Fish Audio API Anahtarı ([Anahtar al](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Fish Audio Modeli",
"Chatterbox Base URL": "Chatterbox Temel URL'si",
"Chatterbox API Key": "Chatterbox API Anahtarı (İsteğe bağlı; [Yapılandırmayı görüntüle](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Chatterbox Modeli",
diff --git a/webui/i18n/vi.json b/webui/i18n/vi.json
index 786b29ca..0e50b905 100644
--- a/webui/i18n/vi.json
+++ b/webui/i18n/vi.json
@@ -236,7 +236,9 @@
"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",
+ "ElevenLabs Model": "Mô hình ElevenLabs",
+ "Fish Audio API Key": "Khóa API Fish Audio ([Lấy khóa](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Mô hình Fish Audio",
"Chatterbox Base URL": "URL cơ sở Chatterbox",
"Chatterbox API Key": "Khóa API Chatterbox (Không bắt buộc; [Xem cấu hình](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Mô hình Chatterbox",
diff --git a/webui/i18n/zh.json b/webui/i18n/zh.json
index 805ca6c3..7683f660 100644
--- a/webui/i18n/zh.json
+++ b/webui/i18n/zh.json
@@ -248,6 +248,8 @@
"MiniMax Voices Load Failed": "获取音色失败:{error}",
"ElevenLabs API Key": "ElevenLabs API 密钥([点击获取](https://elevenlabs.io/app/settings/api-keys))",
"ElevenLabs Model": "ElevenLabs 模型",
+ "Fish Audio API Key": "Fish Audio API 密钥([点击获取](https://fish.audio/app/developers))",
+ "Fish Audio Model": "Fish Audio 模型",
"Chatterbox Base URL": "Chatterbox Base URL",
"Chatterbox API Key": "Chatterbox API 密钥(可选,[查看配置](https://github.com/travisvn/chatterbox-tts-api))",
"Chatterbox Model": "Chatterbox 模型",
@@ -261,6 +263,7 @@
"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 通常可选。",
+ "tts_provider_tips.fish_audio": "需要 Fish Audio API Key,可在[开发者控制台](https://fish.audio/app/developers)获取;包含免费的 `s2.1-pro-free` 开发者模型;可在 [Fish Audio](https://fish.audio) 浏览更多音色或在 `config.toml` 中配置自定义音色。",
"Hide Log": "隐藏日志",
"Hide Basic Settings": "隐藏基础设置\n\n隐藏后,基础设置面板将不会显示在页面中。\n\n如需要再次显示,请在 `config.toml` 中设置 `hide_config = false`",
"LLM Settings": "**大模型设置**",