From 3d1768100f46b1419a1b8e13ed2120ea24857939 Mon Sep 17 00:00:00 2001 From: CGD <3030332422@qq.com> Date: Sun, 8 Jun 2025 15:40:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BD=BF=E7=94=A8=E2=80=9Cclear=5Fmarkdown?= =?UTF-8?q?=E2=80=9D=E6=96=B9=E6=B3=95=E4=BF=AE=E5=A4=8D=E2=80=9C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=81=AB=E5=B1=B1=E6=B5=81=E5=BC=8FTTS=E4=B8=ADmarkdo?= =?UTF-8?q?wn=20=E8=AF=AD=E6=B3=95=E8=A2=AB=20TTS=20=E8=AF=BB=E5=87=BA?= =?UTF-8?q?=E2=80=9D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/providers/tts/huoshan_double_stream.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py index 83a2d83a..6e4b9eac 100644 --- a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py +++ b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py @@ -5,6 +5,7 @@ import queue import asyncio import traceback import websockets +from core.utils.tts import MarkdownCleaner from config.logger import setup_logging from core.utils import opus_encoder_utils from core.utils.util import check_model_key @@ -266,8 +267,12 @@ class TTSProvider(TTSProviderBase): await handleAbortMessage(self.conn) logger.bind(tag=TAG).error(f"WebSocket连接不存在,终止发送文本") 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 except Exception as e: logger.bind(tag=TAG).error(f"发送TTS文本失败: {str(e)}")