소스 검색

调整

develop
H Vs 3 일 전
부모
커밋
39d959eb9b
1개의 변경된 파일6개의 추가작업 그리고 12개의 파일을 삭제
  1. +6
    -12
      app/endpoints/pipeline_endpoint.py

+ 6
- 12
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])


Loading…
취소
저장