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