refactor: tts node add warning

This commit is contained in:
wxg0103 2024-12-30 11:24:32 +08:00
parent c5b56dec38
commit c13427a0b1

View File

@ -214,6 +214,8 @@ def split_and_transcribe(file_path, model, max_segment_length_ms=59000, audio_fo
def _remove_empty_lines(text):
if not isinstance(text, str):
raise AppApiException(500, '文本转语音节点,文本内容必须是字符串类型')
if not text:
raise AppApiException(500, '文本转语音节点,文本内容不能为空')
result = '\n'.join(line for line in text.split('\n') if line.strip())
@ -248,4 +250,3 @@ def markdown_to_plain_text(md: str) -> str:
# 去除首尾空格
text = text.strip()
return text