修复日志

This commit is contained in:
xiehao.0527 2025-07-14 12:15:12 +08:00
parent b443c547dd
commit 419b0fbbec
2 changed files with 3 additions and 2 deletions

View file

@ -13,6 +13,7 @@ TAG = __name__
async def handleAudioMessage(conn, audio):
# 当前片段是否有人说话
have_voice = conn.vad.is_vad(conn, audio)
conn.logger.bind(tag=TAG).info(f"收到音频数据,have_voice: {have_voice},len: {len(audio)}")
# 如果设备刚刚被唤醒,短暂忽略VAD检测
if have_voice and hasattr(conn, "just_woken_up") and conn.just_woken_up:
have_voice = False

View file

@ -308,7 +308,7 @@ class TTSProvider(TTSProviderBase):
# 检查连接是否存在且处于 open 状态
# websockets 库的自动 ping/pong 机制会处理连接健康检查
if self.ws:
logger.bind(tag=TAG).debug("WebSocket connection is active.")
logger.bind(tag=TAG).info("WebSocket connection is active.")
return
# 如果连接不存在或已关闭,则重新连接
@ -350,8 +350,8 @@ class TTSProvider(TTSProviderBase):
try:
# 建立新连接
if self.ws is None:
await handleAbortMessage(self.conn)
logger.bind(tag=TAG).error("WebSocket连接不存在,终止发送文本")
await handleAbortMessage(self.conn)
return
# 过滤Markdown