mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
fix:使用“clear_markdown”方法修复“使用火山流式TTS中markdown 语法被 TTS 读出”的问题
This commit is contained in:
parent
3fbfbeaf0f
commit
3d1768100f
1 changed files with 6 additions and 1 deletions
|
|
@ -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)}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue