diff --git a/src/langbot/pkg/platform/sources/websocket_adapter.py b/src/langbot/pkg/platform/sources/websocket_adapter.py index de35df9e..01da9f10 100644 --- a/src/langbot/pkg/platform/sources/websocket_adapter.py +++ b/src/langbot/pkg/platform/sources/websocket_adapter.py @@ -97,7 +97,13 @@ class WebSocketAdapter(abstract_platform_adapter.AbstractMessagePlatformAdapter) target_id: str, message: platform_message.MessageChain, ) -> dict: - """发送消息 - 这里用于主动推送消息到前端""" + """发送消息 - 这里用于主动推送消息到前端 + + 对于 WebSocket 适配器,我们需要将消息广播到正确的 pipeline 连接。 + target_id 可能是 launcher_id(如 websocket_xxx)或 pipeline_uuid。 + 我们需要尝试两种方式来确保消息能够送达。 + """ + # 获取当前的 pipeline_uuid pipeline_uuid = self.ap.platform_mgr.websocket_proxy_bot.bot_entity.use_pipeline_uuid session_type = 'group' if target_type == 'group' else 'person' diff --git a/src/langbot/pkg/plugin/handler.py b/src/langbot/pkg/plugin/handler.py index 590911cf..30464312 100644 --- a/src/langbot/pkg/plugin/handler.py +++ b/src/langbot/pkg/plugin/handler.py @@ -344,10 +344,7 @@ class RuntimeConnectionHandler(handler.Handler): async def _placeholder_func(**kwargs): pass - funcs_obj = [ - resource_tool.LLMTool.model_validate({**func, 'func': _placeholder_func}) - for func in funcs - ] + funcs_obj = [resource_tool.LLMTool.model_validate({**func, 'func': _placeholder_func}) for func in funcs] result = await llm_model.provider.invoke_llm( query=None,