diff --git a/app/core/websocket/adapter.py b/app/core/websocket/adapter.py index bd6416e..c526ec7 100644 --- a/app/core/websocket/adapter.py +++ b/app/core/websocket/adapter.py @@ -90,7 +90,10 @@ class WebSocketAdapter: if msg: # 将消息数据序列化为JSON字符串 import json - if isinstance(msg.data, dict): + if msg.data is None: + # 如果data为None,跳过发送 + logger.debug(f"适配器跳过空数据消息: {self.outbound_channel.name} -> {msg.type}") + elif isinstance(msg.data, dict): # 在发送时添加type字段 send_data = { "Type": msg.type,