Files
xiaozhi-esp32-server/main/xiaozhi-server/core/handle/abortHandle.py
T

17 lines
489 B
Python
Raw Normal View History

2025-02-04 12:20:10 +08:00
import json
2025-02-18 00:07:19 +08:00
TAG = __name__
2025-02-04 12:20:10 +08:00
async def handleAbortMessage(conn):
2025-05-07 18:06:13 +08:00
conn.logger.bind(tag=TAG).info("Abort message received")
2025-02-04 12:20:10 +08:00
# 设置成打断状态,会自动打断llm、tts任务
conn.client_abort = True
2025-04-25 09:34:22 +08:00
conn.clear_queues()
2025-02-04 12:20:10 +08:00
# 打断客户端说话状态
2025-05-07 18:06:13 +08:00
await conn.websocket.send(
json.dumps({"type": "tts", "state": "stop", "session_id": conn.session_id})
)
2025-02-04 12:20:10 +08:00
conn.clearSpeakStatus()
2025-05-07 18:06:13 +08:00
conn.logger.bind(tag=TAG).info("Abort message received-end")