[Bugfix] Invalidate stale ref_audio cache on local file modification (#4873) (#5670)

Signed-off-by: pranavthakur0-0 <pranavthakurdew@gmail.com>
Co-authored-by: Zhou Taichang <tzhouam@connect.ust.hk>
This commit is contained in:
Pranav ThakurandZhou Taichang authored and GitHub committed 2026-08-25 10:06:32 +08:00
1 parent 50b8a150f9
commit 53b60bd9bc
10 files changed
+675 -103

No files matched your search

@@ -108,6 +108,8 @@ def indextts2_conditioning_cache_salt(
"use_random",
"lang",
"text_normalization",
"ref_audio_cache_key",
"emo_audio_cache_key",
):
h.update(b"\x00")
h.update(key.encode("utf-8"))
@@ -260,8 +262,9 @@ class IndexTTS2Adapter(ARTTSAdapter):
ref_audio_source = server._get_uploaded_audio_data(voice_lower)
using_uploaded_voice = ref_audio_source is not None
if ref_audio_source is not None and isinstance(ref_audio_source, str):
wav_list, sr = await server._resolve_ref_audio(ref_audio_source)
wav_list, sr, cache_key = await server._resolve_ref_audio(ref_audio_source)
params["voice"] = [[wav_list, sr]]
params["ref_audio_cache_key"] = [cache_key]
if using_uploaded_voice and voice_lower:
params["voice_name"] = [voice_lower]
params["voice_created_at"] = [server._voice_created_at(voice_lower)]
@@ -271,8 +274,9 @@ class IndexTTS2Adapter(ARTTSAdapter):
if key not in extras:
continue
if key == "emo_audio":
wav_list, sr = await server._resolve_ref_audio(extras[key])
wav_list, sr, emo_key = await server._resolve_ref_audio(extras[key])
params[key] = [[wav_list, sr]]
params["emo_audio_cache_key"] = [emo_key]
else:
params[key] = [extras[key]]
return params