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(