|
|
@@ -402,7 +402,7 @@ async def handle_text_async(request: Request,token_id,app_id, wxid,msg_data,from |
|
|
|
callback_to_user=msg_data["FromUserName"]["string"] |
|
|
|
|
|
|
|
# 判断哪些关键词存在于 msg_content 中 |
|
|
|
keywords = ["预约", "报价", "购买", "价钱"] |
|
|
|
keywords = ["预约", "报价", "购买", "价钱","价格", "多少钱", "下单"] |
|
|
|
found_keywords = [keyword for keyword in keywords if keyword in msg_content] |
|
|
|
if found_keywords: |
|
|
|
await request.app.state.gewe_service.set_human_handle_msg_with_contact_wxid_async(wxid,callback_to_user,60*30) |
|
|
@@ -625,11 +625,11 @@ async def ai_chat_text_async(request: Request,token_id, app_id, wxid, msg_data, |
|
|
|
if ret!=200: |
|
|
|
logger.warning(f'{wxid} 发送视频{video_url} 到 {callback_to_user} 失败,{ret_msg}') |
|
|
|
await asyncio.sleep(random.uniform(1.5, 3)) |
|
|
|
|
|
|
|
# 发送AI微信回复 |
|
|
|
#await request.app.state.gewe_service.post_text_async(token_id, app_id, callback_to_user, reply_content) |
|
|
|
async with message_lock: |
|
|
|
await ai_post_text_split_async_async(request, token_id, app_id, callback_to_user, reply_content) |
|
|
|
if (not video_urls) and (not img_urls): |
|
|
|
async with message_lock: |
|
|
|
await ai_post_text_split_async_async(request, token_id, app_id, callback_to_user, reply_content) |
|
|
|
|
|
|
|
await request.app.state.gewe_service.save_session_messages_to_cache_async(hash_key, {"role": "assistant", "content": reply_content}) |
|
|
|
# 回复的对话 |
|
|
|