diff --git a/app.py b/app.py index e236aeb..5724ceb 100644 --- a/app.py +++ b/app.py @@ -591,6 +591,25 @@ app.register_blueprint(ai_bp) csrf.exempt(ai_bp) # ICAIM API 使用內部呼叫,不需要 CSRF sys_log.info("[Blueprint] ✅ AI 智慧文案系統 Blueprint 已註冊") +# ========================================== +# 🔧 Blueprint 註冊 - CI/CD Dashboard +# ========================================== +from routes.cicd_routes import cicd_bp +app.register_blueprint(cicd_bp) +csrf.exempt(cicd_bp) # CI/CD API doesn't need CSRF +sys_log.info("[Blueprint] CI/CD Dashboard Blueprint registered") + +# ========================================== +# 🔧 Blueprint 註冊 - Code Review 系統 +# ========================================== +try: + from routes.code_review_routes import code_review_bp + app.register_blueprint(code_review_bp) + csrf.exempt(code_review_bp) # Code Review API 使用內部認證,不需要 CSRF + sys_log.info("[Blueprint] ✅ Code Review 系統 Blueprint 已註冊 (CSRF 已豁免)") +except Exception as _e: + sys_log.warning(f"[Blueprint] ⚠️ Code Review 系統 Blueprint 註冊失敗: {_e}") + # ========================================== # 🔧 Blueprint 註冊 - 趨勢資料系統 # ========================================== @@ -644,11 +663,6 @@ app.register_blueprint(bot_api_bp) csrf.exempt(bot_api_bp) # Bot API 使用 Token 認證,不需要 CSRF sys_log.info("[Blueprint] ✅ Bot API Blueprint 已註冊") -# CI/CD Dashboard Blueprint -from routes.cicd_routes import cicd_bp -app.register_blueprint(cicd_bp) -csrf.exempt(cicd_bp) # CI/CD API doesn't need CSRF -sys_log.info("[Blueprint] CI/CD Dashboard Blueprint registered") # ========================================== # Elephant Alpha AI Agent Super Orchestrator Blueprint @@ -3845,7 +3859,12 @@ def _get_filtered_sales_data(cache_key): df = cache_data['df'] cols_map = cache_data['cols'] else: - # V-Fix: 增加自動重載邏輯,如果快取不存在,試圖從資料庫載入 + # 快取不存在時,直接回傳錯誤讓呼叫端顯示 spinner 導回 sales_analysis + # 不在此發起全表 DB 查詢(748k 行會 hang Gunicorn worker) + sys_log.warning(f"[Sales Analysis] ⚠️ 快取不存在 ({cache_key}),回傳錯誤讓 UI 導回 sales_analysis") + return None, {}, f"快取未就緒,請先從業績分析主頁載入資料 (cache_key={cache_key})" + + if False: # 保留舊冷快取重載邏輯(已停用,避免全表掃描 hang) sys_log.warning(f"[Sales Analysis] ⚠️ 快取不存在 ({cache_key}),試圖重新從資料庫載入...") try: # V-Fix: 從 cache_key 提取 table_name