H Vs преди 1 ден
родител
ревизия
dcff84d710
променени са 1 файла, в които са добавени 19 реда и са изтрити 0 реда
  1. +19
    -0
      app/endpoints/pipeline_endpoint.py

+ 19
- 0
app/endpoints/pipeline_endpoint.py Целия файл

@@ -853,6 +853,12 @@ async def handle_image_async(request: Request,token_id,app_id, wxid,msg_data,fro
''' '''
私聊图片消息 私聊图片消息
''' '''
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_image_async.__name__} 不回复消息")
return
msg_content=msg_data["Content"]["string"] msg_content=msg_data["Content"]["string"]


callback_to_user=from_wxid callback_to_user=from_wxid
@@ -891,6 +897,12 @@ async def handle_image_group_async(request: Request,token_id,app_id, wxid,msg_da
msg_content=msg_data["Content"]["string"] msg_content=msg_data["Content"]["string"]
callback_to_user=msg_data["FromUserName"]["string"] callback_to_user=msg_data["FromUserName"]["string"]


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_image_group_async.__name__} 不回复消息")
return

# aeskey = re.search(r'aeskey="([^"]+)"', msg_content).group(1) # aeskey = re.search(r'aeskey="([^"]+)"', msg_content).group(1)
# cdnthumburl = re.search(r'cdnthumburl="([^"]+)"', msg_content).group(1) # cdnthumburl = re.search(r'cdnthumburl="([^"]+)"', msg_content).group(1)
# md5 = re.search(r'md5="([^"]+)"', msg_content).group(1) # md5 = re.search(r'md5="([^"]+)"', msg_content).group(1)
@@ -929,6 +941,13 @@ async def handle_voice_async(request: Request,token_id,app_id, wxid,msg_data,fro
msg_content=msg_data["Content"]["string"] msg_content=msg_data["Content"]["string"]
msg_id=msg_data["MsgId"] msg_id=msg_data["MsgId"]


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_voice_async.__name__} 不回复消息")
return

request.app.state.message_lock[app_id]=asyncio.Lock() request.app.state.message_lock[app_id]=asyncio.Lock()


config=await request.app.state.gewe_service.get_wxchat_config_from_cache_async(wxid) config=await request.app.state.gewe_service.get_wxchat_config_from_cache_async(wxid)


Loading…
Отказ
Запис