mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 01:53:53 +08:00
Merge pull request #1510 from xinnan-tech/py_HuoshanDoubleStreamTTS_markdown_fix
fix:使用“clear_markdown”方法修复“使用火山流式TTS中markdown 语法被 TTS 读出”的问题
This commit is contained in:
@@ -5,6 +5,7 @@ import queue
|
|||||||
import asyncio
|
import asyncio
|
||||||
import traceback
|
import traceback
|
||||||
import websockets
|
import websockets
|
||||||
|
from core.utils.tts import MarkdownCleaner
|
||||||
from config.logger import setup_logging
|
from config.logger import setup_logging
|
||||||
from core.utils import opus_encoder_utils
|
from core.utils import opus_encoder_utils
|
||||||
from core.utils.util import check_model_key
|
from core.utils.util import check_model_key
|
||||||
@@ -266,8 +267,12 @@ class TTSProvider(TTSProviderBase):
|
|||||||
await handleAbortMessage(self.conn)
|
await handleAbortMessage(self.conn)
|
||||||
logger.bind(tag=TAG).error(f"WebSocket连接不存在,终止发送文本")
|
logger.bind(tag=TAG).error(f"WebSocket连接不存在,终止发送文本")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# 过滤Markdown
|
||||||
|
filtered_text = MarkdownCleaner.clean_markdown(text)
|
||||||
|
|
||||||
# 发送文本
|
# 发送文本
|
||||||
await self.send_text(self.voice, text, self.conn.sentence_id)
|
await self.send_text(self.voice, filtered_text, self.conn.sentence_id)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.bind(tag=TAG).error(f"发送TTS文本失败: {str(e)}")
|
logger.bind(tag=TAG).error(f"发送TTS文本失败: {str(e)}")
|
||||||
|
|||||||
Reference in New Issue
Block a user