From 39d959eb9b2dfc7cf6663b2744884d11e68d7ae6 Mon Sep 17 00:00:00 2001 From: H Vs Date: Mon, 21 Apr 2025 17:07:24 +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 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/endpoints/pipeline_endpoint.py b/app/endpoints/pipeline_endpoint.py index 1566922..f0cadf1 100644 --- a/app/endpoints/pipeline_endpoint.py +++ b/app/endpoints/pipeline_endpoint.py @@ -75,16 +75,16 @@ async def get_messages(request: Request, body: Dict[str, Any]): async def handle_self_cmd_async(request: Request,wxid,msg): ''' 个人微信命令处理 - 如果是个人微信的指令,wxid == from_wxid + 如果是个人微信的指令,wxid == to_wxid commands = { '启用托管': True, '关闭托管': False } ''' msg_data=msg.get("Data") - from_wxid=msg_data["FromUserName"]["string"] + to_wxid=msg_data["ToUserName"]["string"] msg_content=msg_data["Content"]["string"] - if wxid == from_wxid: + if wxid == to_wxid: commands = { '启用托管': True, '关闭托管': False @@ -98,19 +98,13 @@ async def handle_self_cmd_async(request: Request,wxid,msg): await request.app.state.gewe_service.wxchat.save_wxchat_config_async(wxid, agent_config.model_dump()) logger.info(f'{wxid} {"启动" if commands[msg_content] else "关闭"}托管') -# async def handle_kf_assistant_async(request: Request,wxid,msg): -# msg_data=msg.get("Data") -# from_wxid=msg_data["FromUserName"]["string"] -# msg_content=msg_data["Content"]["string"] + async def handle_messages_async(request: Request,token_id,msg): #msg_data=msg.get("Data") type_name =msg.get("TypeName") - # app_id = msg.get("Appid") - # from_wxid=msg_data["FromUserName"]["string"] - # msg_content=msg_data["Content"]["string"] wxid = msg.get("Wxid",'') match type_name: @@ -387,7 +381,7 @@ async def handle_text_async(request: Request,token_id,app_id, wxid,msg_data,from msg_content=msg_data["Content"]["string"] - if wxid == from_wxid: #手动发送消息 + if wxid == to_wxid: #手动发送消息 logger.info("Active message sending detected") await request.app.state.gewe_service.save_contacts_brief_to_cache_async(token_id,app_id,wxid,[to_wxid]) @@ -684,7 +678,7 @@ async def handle_text_group_async(request: Request,token_id,app_id, wxid,msg_dat logger.warning(f"微信号 {wxid} 关闭好友和群自动回复功能,{handle_text_group_async.__name__} 不回复消息") return - if wxid == from_wxid: #手动发送消息 + if wxid == to_wxid: #手动发送消息 logger.info("Active message sending detected") await request.app.state.gewe_service.save_contacts_brief_to_cache_async(token_id,app_id,wxid,[to_wxid])