|
|
|
@ -76,7 +76,9 @@ async def on_session_end(session_id):
|
|
|
|
|
if response.choices and response.choices[0].message.content:
|
|
|
|
|
analysis_result = response.choices[0].message.content.strip()
|
|
|
|
|
if analysis_result.startswith("NO"):
|
|
|
|
|
await update_risk(app.state.mysql_pool, session_id, analysis_result)
|
|
|
|
|
# 异步执行 update_risk
|
|
|
|
|
asyncio.create_task(update_risk(app.state.mysql_pool, session_id, analysis_result))
|
|
|
|
|
logger.info(f"已异步更新 session_id={session_id} 的风险状态。")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 初始化 FastAPI 应用
|
|
|
|
|