From 19526878b3299382da9a3f131eaaac3df85012c0 Mon Sep 17 00:00:00 2001 From: myifeng Date: Wed, 28 May 2025 11:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E6=94=B6hello=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=B8=AD=E7=9A=84features=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/connection.py | 2 ++ main/xiaozhi-server/core/handle/helloHandle.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 11ae6836..87c96ffe 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -142,6 +142,8 @@ class ConnectionHandler: ) # 在原来第一道关闭的基础上加60秒,进行二道关闭 self.audio_format = "opus" + # {"mcp":true} 表示启用MCP功能 + self.features = None async def handle_connection(self, ws): try: diff --git a/main/xiaozhi-server/core/handle/helloHandle.py b/main/xiaozhi-server/core/handle/helloHandle.py index 6fd40401..5dfc6b62 100644 --- a/main/xiaozhi-server/core/handle/helloHandle.py +++ b/main/xiaozhi-server/core/handle/helloHandle.py @@ -31,6 +31,10 @@ async def handleHelloMessage(conn, msg_json): if conn.asr is not None: conn.asr.set_audio_format(format) conn.welcome_msg["audio_params"] = audio_params + features = msg_json.get("features") + if features: + conn.logger.bind(tag=TAG).info(f"客户端特性: {features}") + conn.features = features await conn.websocket.send(json.dumps(conn.welcome_msg))