feat: 新增设备互相通讯功能

feat: 新增通讯录页面
This commit is contained in:
Sakura-RanChen
2026-05-26 16:37:39 +08:00
parent 7f73dae1bf
commit ce68c83eea
48 changed files with 2361 additions and 7 deletions
+3
View File
@@ -190,6 +190,9 @@ class ConnectionHandler:
# 初始化提示词管理器
self.prompt_manager = PromptManager(self.config, self.logger)
# 初始化通话状态
self.calling = False
async def handle_connection(self, ws: websockets.ServerConnection):
try:
# 获取运行中的事件循环(必须在异步上下文中)
@@ -47,7 +47,8 @@ async def sendAudioMessage(conn: "ConnectionHandler", sentenceType, audios, text
conn.logger.bind(tag=TAG).info(f"发送音频消息: {sentenceType}, {text}")
# 发送结束消息(如果是最后一个文本)
if sentenceType == SentenceType.LAST:
# 通话需要维持speaking状态
if not conn.calling and sentenceType == SentenceType.LAST:
await send_tts_message(conn, "stop", None)
if conn.close_after_chat:
await conn.close()