refactor: vad独立时间戳,相关残余状态处理

This commit is contained in:
Sakura-RanChen
2026-04-09 17:15:35 +08:00
parent e08eb48d9a
commit a6904f6ebd
5 changed files with 16 additions and 8 deletions
@@ -284,8 +284,10 @@ async def send_tts_message(conn: "ConnectionHandler", state, text=None):
# 停止音频发送循环(仅在流控器已初始化时调用)
if hasattr(conn, "audio_rate_controller") and conn.audio_rate_controller:
conn.audio_rate_controller.stop_sending()
# 清除服务端讲话状态,传入 sentence_id 用于判断是否是当前轮次
conn.clearSpeakStatus(current_sentence_id)
# 检查是否是当前轮次
if current_sentence_id != conn.sentence_id:
return
conn.clearSpeakStatus()
# 发送消息到客户端
await conn.websocket.send(json.dumps(message))