Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tts node add a prompt with empty text #1919

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/common/util/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 text:
raise AppApiException(500, '文本转语音节点,文本内容不能为空')
result = '\n'.join(line for line in text.split('\n') if line.strip())
return markdown_to_plain_text(result)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is correct and complete for removing empty lines from text. It includes a check to ensure that the input text is not empty before proceeding with the removal of empty lines. No other modifications are necessary, so no further optimizations are needed in this context. Here's the summary:

No issues detected: The current implementation meets all requirements without any errors or room for improvement.

Expand Down
Loading