Add voice history, default preset voice, and one-click tab
Keep synthesized wav files browsable with playback and download, default to preset steady male voice, show one-click pipeline as the first tab, and reduce post-synthesis UI flicker. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+16
-3
@@ -22,6 +22,8 @@ PRESETS_DIR = VOICES_DIR / "presets"
|
||||
MANIFEST_PATH = VOICES_DIR / "manifest.json"
|
||||
|
||||
CUSTOM_VOICE_ID = "custom"
|
||||
DEFAULT_PRESET_VOICE_ID = "preset_01"
|
||||
DEFAULT_PRESET_VOICE_LABEL = "预设·沉稳男声"
|
||||
|
||||
# 生成脚本写入的预设元数据(.pt 文件不入 Git)
|
||||
DEFAULT_MANIFEST = {
|
||||
@@ -85,13 +87,24 @@ def list_voice_choices() -> List[Tuple[str, str]]:
|
||||
def default_voice_id() -> str:
|
||||
choices = list_voice_choices()
|
||||
if not choices:
|
||||
return CUSTOM_VOICE_ID
|
||||
return DEFAULT_PRESET_VOICE_ID
|
||||
for _label, vid in choices:
|
||||
if vid == CUSTOM_VOICE_ID:
|
||||
return CUSTOM_VOICE_ID
|
||||
if vid == DEFAULT_PRESET_VOICE_ID:
|
||||
return vid
|
||||
for _label, vid in choices:
|
||||
if vid != CUSTOM_VOICE_ID:
|
||||
return vid
|
||||
return choices[0][1]
|
||||
|
||||
|
||||
def default_voice_label() -> str:
|
||||
for lbl, vid in list_voice_choices():
|
||||
if vid == DEFAULT_PRESET_VOICE_ID:
|
||||
return lbl
|
||||
labels = voice_choice_labels()
|
||||
return labels[0] if labels else DEFAULT_PRESET_VOICE_LABEL
|
||||
|
||||
|
||||
def voice_choice_labels() -> List[str]:
|
||||
return [c[0] for c in list_voice_choices()]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user