From a1691c41d58f2da69f54ea0eb24b358d6cb70cfb Mon Sep 17 00:00:00 2001 From: OG T Date: Sun, 12 Apr 2026 17:27:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(flywheel-stats):=20=E4=BF=AE=E8=A3=9C=20Fly?= =?UTF-8?q?wheelStatsService=20=E4=B8=89=E5=80=8B=E6=AC=84=E4=BD=8D?= =?UTF-8?q?=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - KnowledgeEntryRecord.vectorized → embedding.is_(None) (欄位不存在) - IncidentRecord.id → IncidentRecord.incident_id (主鍵名稱) - 修復後 /api/v1/stats/flywheel nodes 不再全部回傳 unknown Co-Authored-By: Claude Sonnet 4.6 --- apps/api/src/services/flywheel_stats_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/services/flywheel_stats_service.py b/apps/api/src/services/flywheel_stats_service.py index a216d032..915c6c53 100644 --- a/apps/api/src/services/flywheel_stats_service.py +++ b/apps/api/src/services/flywheel_stats_service.py @@ -219,9 +219,9 @@ class FlywheelStatsService: today_start = now.replace(hour=0, minute=0, second=0, microsecond=0) async with get_db_context() as db: - # 未向量化數量 + # 未向量化數量 (embedding IS NULL = 未向量化) unvectorized_q = await db.execute( - select(func.count()).where(KnowledgeEntryRecord.vectorized.is_(False)) + select(func.count()).where(KnowledgeEntryRecord.embedding.is_(None)) ) unvectorized = unvectorized_q.scalar_one_or_none() or 0 @@ -256,7 +256,7 @@ class FlywheelStatsService: async with get_db_context() as db: # alertname NULL 率 - total_q = await db.execute(select(func.count(IncidentRecord.id))) + total_q = await db.execute(select(func.count(IncidentRecord.incident_id))) total = total_q.scalar_one_or_none() or 0 null_q = await db.execute(