@@ -450,7 +450,11 @@ async def handle_text_async(request: Request,token_id,app_id, wxid,msg_data,from | |||
18664262743 | |||
wxid_9pocbage7cdb22 | |||
''' | |||
await request.app.state.gewe_service.post_text_async(token_id, app_id, 'wxid_9pocbage7cdb22', msg_content) | |||
contacts_brief= await request.app.state.gewe_service.get_contacts_brief_from_cache_async(wxid) | |||
contact_nick_name=next(filter(lambda x:x.get("userName") == callback_to_user,contacts_brief),{}).get("nickName","") | |||
assistant_msg_content=f'AI管家转人工提醒:【{contact_nick_name}】有{found_keywords[0]}需求' | |||
await request.app.state.gewe_service.post_text_async(token_id, app_id, 'wxid_9pocbage7cdb22', assistant_msg_content) | |||
return | |||
@@ -153,7 +153,8 @@ async def lifespan(app: FastAPI): | |||
# redis_service_instance=app.state.redis_service | |||
# 初始化 GeWeChatCom | |||
app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://api.geweapi.com/gewe") | |||
#app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://api.geweapi.com/gewe") | |||
app.state.gewe_service = await GeWeService.get_instance(redis_service,"http://218.78.116.24:10883/gewe") | |||
gewe_service=app.state.gewe_service | |||
# # 初始化 GeWeChatCom | |||
#app.state.gwechat_service = GeWeService(app) | |||
@@ -52,7 +52,8 @@ kafka_config = { | |||
'group_id': KAFKA_GROUP_ID, | |||
} | |||
gewe_config = { | |||
'api_url': "http://api.geweapi.com/gewe", | |||
#'api_url': "http://api.geweapi.com/gewe", | |||
'api_url':"http://218.78.116.24:10883/gewe", | |||
} | |||
@@ -628,7 +628,7 @@ class GeWeService: | |||
'X-GEWE-TOKEN': token_id, | |||
'Content-Type': 'application/json' | |||
} | |||
url = 'http://api.geweapi.com/gewe/v2/api/message/downloadVoice' | |||
url = f'{self.base_url}/v2/api/message/downloadVoice' | |||
async with aiohttp.ClientSession() as session: | |||
async with session.post(url, json=data, headers=headers) as response: | |||
if response.ok: | |||