From 8b43b57bb24cd683c14a3a5e63155bd174f1db12 Mon Sep 17 00:00:00 2001 From: Sakurasan <26715255+Sakurasan@users.noreply.github.com> Date: Tue, 1 Sep 2026 16:16:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8C=E4=B8=80=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E6=97=A5=E5=86=85=E5=8F=AF=E9=9A=8F=E6=97=B6=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/routes/ai_analysis.py | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/backend/routes/ai_analysis.py b/backend/routes/ai_analysis.py index a6070c3..2f84677 100644 --- a/backend/routes/ai_analysis.py +++ b/backend/routes/ai_analysis.py @@ -35,21 +35,8 @@ def _has_ai_report(trade_date: str) -> bool: def _can_trigger(trade_date: str) -> tuple[bool, str]: - """检查是否可以触发分析(12小时频率限制)""" - conn = get_connection() - try: - row = conn.execute( - "SELECT created_at FROM ai_reports WHERE trade_date = ? ORDER BY id DESC LIMIT 1", - (trade_date,) - ).fetchone() - if row: - last_time = datetime.strptime(row["created_at"], "%Y-%m-%d %H:%M:%S") - now = datetime.now(_CST) - if (now - last_time).total_seconds() < 12 * 3600: - return False, "12小时内已触发过,请稍后再试" - return True, "" - finally: - conn.close() + """检查是否可以触发分析(同一交易日内可随时重新生成)""" + return True, "" @router.get("/ai-analysis/latest", summary="最新 AI 分析报告") @@ -111,13 +98,6 @@ async def trigger_analysis(): now = datetime.now(_CST) trade_date = now.strftime("%Y-%m-%d") - if _has_ai_report(trade_date): - raise HTTPException(status_code=400, detail="今日已有分析报告") - - can, msg = _can_trigger(trade_date) - if not can: - raise HTTPException(status_code=429, detail=msg) - from services.ai_service import collect_ai_analysis result = await collect_ai_analysis(trade_date) return JSONResponse({"data": result}) @@ -134,10 +114,6 @@ async def regenerate_report(report_id: int): finally: conn.close() - can, msg = _can_trigger(trade_date) - if not can: - raise HTTPException(status_code=429, detail=msg) - from services.ai_service import collect_ai_analysis result = await collect_ai_analysis(trade_date) return JSONResponse({"data": result})