wangzhibo
10 天以前 220e4fab27b7f419b3e89e2f2d28ae789aac09d7
xiaozhi-esp32-server/main/xiaozhi-server/core/handle/sendAudioHandle.py
@@ -294,6 +294,9 @@
    message = {"type": "tts", "state": state, "session_id": conn.session_id}
    if text is not None:
        message["text"] = textUtils.check_emoji(text)
    # 再见/超时结束:设备收到 stop 后应直接 idle 等唤醒,不要先回 listening。
    if state == "stop" and getattr(conn, "close_after_chat", False):
        message["session_end"] = True
    # TTS播放结束
    if state == "stop":
@@ -321,6 +324,10 @@
    # 发送消息到客户端
    await conn.websocket.send(json.dumps(message))
    if state == "stop":
        from core.app_runtime.runtime import maybe_flush_pending_play_after_tts
        await maybe_flush_pending_play_after_tts(conn)
async def send_stt_message(conn: "ConnectionHandler", text):