|
|
@@ -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"] |
|
|
|