feature(#377): 实现清理大模型AI的Markdown语法功能,优化TTS自然度。关联Issue #377

close #377
This commit is contained in:
caixypromise
2025-03-20 21:29:53 +08:00
parent fcba384a15
commit 5ebc62a084
2 changed files with 98 additions and 1 deletions
@@ -5,6 +5,7 @@ import numpy as np
import opuslib_next
from pydub import AudioSegment
from abc import ABC, abstractmethod
from core.utils.tts import MarkdownCleaner
TAG = __name__
logger = setup_logging()
@@ -23,6 +24,7 @@ class TTSProviderBase(ABC):
tmp_file = self.generate_filename()
try:
max_repeat_time = 5
text = MarkdownCleaner.clean_markdown(text)
while not os.path.exists(tmp_file) and max_repeat_time > 0:
asyncio.run(self.text_to_speak(text, tmp_file))
if not os.path.exists(tmp_file):