From 04faaf1b48d7f761ac72f31eaa76d29ce39a6d25 Mon Sep 17 00:00:00 2001 From: H Vs Date: Thu, 10 Apr 2025 16:49:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/endpoints/pipeline_endpoint.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/endpoints/pipeline_endpoint.py b/app/endpoints/pipeline_endpoint.py index 7835156..b72047c 100644 --- a/app/endpoints/pipeline_endpoint.py +++ b/app/endpoints/pipeline_endpoint.py @@ -49,7 +49,7 @@ async def get_messages(request: Request, body: Dict[str, Any]): wxids = list(config.keys()) meged_backlist_wxids=wxids+WX_BACKLIST # 公众号ID已gh_开头 - if from_wxid in meged_backlist_wxids or 'gh_' in from_wxid: + if (from_wxid in meged_backlist_wxids and from_wxid != wxid) or 'gh_' in from_wxid: logger.warning(f'来自微信ID {from_wxid} 在黑名单,发送给 {wxid} ,不处理') return {"message": "收到微信回调消息"} @@ -401,7 +401,7 @@ async def handle_text_async(request: Request,token_id,app_id, wxid,msg_data,from ''' 私聊文本消息 ''' - config=await request.aoo.state.gewe_service.get_wxchat_config_from_cache_async(wxid) + config=await request.app.state.gewe_service.get_wxchat_config_from_cache_async(wxid) validated_config = AgentConfig.model_validate(config) if not validated_config.privateGroupChatEnabled: logger.warning(f"微信号 {wxid} 关闭好友和群自动回复功能,{handle_text_async.__name__} 不回复消息") @@ -416,7 +416,7 @@ async def handle_text_async(request: Request,token_id,app_id, wxid,msg_data,from input_wx_content_dialogue_message=[{"type": "text", "text": msg_content}] input_message=dialogue_message(from_wxid,to_wxid,input_wx_content_dialogue_message) - await request.app.state.kafaka_service.send_message_async(input_message) + await request.app.state.kafka_service.send_message_async(input_message) logger.info("发送对话 %s",input_message) else: callback_to_user=msg_data["FromUserName"]["string"]