Merge pull request #229 from kuishou68/fix/issue-228-validate-text-type-order

fix: correct isinstance/strip order in _generate() to prevent AttributeError on non-string input
This commit is contained in:
xliucs
2026-04-10 10:30:15 +08:00
committed by GitHub
+1 -1
View File
@@ -200,7 +200,7 @@ class VoxCPM:
Yields audio chunks for each generation step if ``streaming=True``, Yields audio chunks for each generation step if ``streaming=True``,
otherwise yields a single array containing the final audio. otherwise yields a single array containing the final audio.
""" """
if not text.strip() or not isinstance(text, str): if not isinstance(text, str) or not text.strip():
raise ValueError("target text must be a non-empty string") raise ValueError("target text must be a non-empty string")
if prompt_wav_path is not None: if prompt_wav_path is not None: