fix(flywheel-stats): 修補 FlywheelStatsService 三個欄位錯誤
Some checks failed
CD Pipeline / build-and-deploy (push) Failing after 30s

- KnowledgeEntryRecord.vectorized → embedding.is_(None) (欄位不存在)
- IncidentRecord.id → IncidentRecord.incident_id (主鍵名稱)
- 修復後 /api/v1/stats/flywheel nodes 不再全部回傳 unknown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-12 17:27:27 +08:00
parent 295869d6c7
commit a1691c41d5

View File

@@ -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(