浏览代码

调整

c1
H Vs 4 周前
父节点
当前提交
f6085f2c72
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. +10
    -4
      app/endpoints/pipeline_endpoint.py

+ 10
- 4
app/endpoints/pipeline_endpoint.py 查看文件

@@ -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}]


正在加载...
取消
保存