Selaa lähdekoodia

微信不回复

1257
H Vs 2 viikkoa sitten
vanhempi
commit
2f0e180e77
1 muutettua tiedostoa jossa 9 lisäystä ja 1 poistoa
  1. +9
    -1
      app/endpoints/pipeline_endpoint.py

+ 9
- 1
app/endpoints/pipeline_endpoint.py Näytä tiedosto

@@ -531,7 +531,15 @@ async def ai_chat_text_async(request: Request,token_id, app_id, wxid, msg_data,
await request.app.state.gewe_service.post_image_async(token_id, app_id, callback_to_user, img_url)
await asyncio.sleep(random.uniform(1.5, 3))
else:
await request.app.state.gewe_service.post_text_async(token_id, app_id, callback_to_user, reply_content)
if reply_content=='不回复':
end_time = time.time() # 记录任务结束时间
execution_time = end_time - start_time # 计算执行时间
logger.warning(f"AI回答任务完成,耗时 {execution_time:.2f} 秒,AI回答<不回复>,跳过微信回复")
await request.app.state.gewe_service.save_session_messages_to_cache_async(hash_key, {"role": "assistant", "content": reply_content})
return
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})
# 回复的对话


Loading…
Peruuta
Tallenna