|
|
@@ -370,7 +370,11 @@ async def check_timeout_async(task: asyncio.Task, request: Request,token_id, wxi |
|
|
|
print(f"任务运行时间超过{timeout_duration}秒,token_id={token_id}, app_id={app_id}, callback_to_user={callback_to_user}") |
|
|
|
wx_config = await request.app.state.gewe_service.get_wxchat_config_from_cache_async(wxid) |
|
|
|
if bool(wx_config.get("chatWaitingMsgEnabled", True)): |
|
|
|
await request.app.state.gewe_service.post_text_async(token_id, app_id, callback_to_user, "亲,我正在组织回复的信息,请稍等一会") |
|
|
|
if callback_to_user == 'wxid_mesh33pw13e721': |
|
|
|
logger.info(f'wxid_mesh33pw13e721 不发送到微信有关等待的AI回复到微信') |
|
|
|
else: |
|
|
|
await request.app.state.gewe_service.post_text_async(token_id, app_id, callback_to_user, "亲,我正在组织回复的信息,请稍等一会") |
|
|
|
#await request.app.state.gewe_service.post_text_async(token_id, app_id, callback_to_user, "亲,我正在组织回复的信息,请稍等一会") |
|
|
|
|
|
|
|
async def ai_chat_text_async(request: Request,token_id, app_id, wxid, msg_data, msg_content): |
|
|
|
|
|
|
@@ -450,10 +454,12 @@ async def ai_chat_text_async(request: Request,token_id, app_id, wxid, msg_data, |
|
|
|
} |
|
|
|
reply_content = remove_markdown_symbol(res["choices"][0]["message"]["content"]) |
|
|
|
|
|
|
|
if callback_to_user not in 'wxid_mesh33pw13e721': |
|
|
|
logger.info(f'{callback_to_user} 不发送到微信有关{msg_content}的AI回复到微信') |
|
|
|
if callback_to_user == 'wxid_mesh33pw13e721': |
|
|
|
logger.info(f'wxid_mesh33pw13e721 不发送到微信有关{msg_content}的AI回复到微信') |
|
|
|
else: |
|
|
|
await request.app.state.gewe_service.post_text_async(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}) |
|
|
|
# 回复的对话 |
|
|
|
input_wx_content_dialogue_message = [{"type": "text", "text": reply_content}] |
|
|
|