优化相关逻辑

This commit is contained in:
Sakura-RanChen
2026-06-03 16:13:03 +08:00
parent b903a88cd5
commit b9891bb795
18 changed files with 248 additions and 179 deletions
+2
View File
@@ -192,6 +192,8 @@ class ConnectionHandler:
# 初始化通话状态
self.calling = False
# 标记当前是否为来电接听模式
self.incoming_call = None
async def handle_connection(self, ws: websockets.ServerConnection):
try:
@@ -64,6 +64,9 @@ class ListenTextMessageHandler(TextMessageHandler):
call_text = original_text[len("[device_call]"):].strip()
conn.logger.bind(tag=TAG).info(f"收到设备呼叫指令: {call_text}")
# 标记为来电接听模式
conn.incoming_call = True
# 准备开始新会话
conn.sentence_id = uuid.uuid4().hex