OG T
|
670cd5df86
|
refactor(flywheel): 首席架構師審查修正 C1/C2/I1/I2/I3/I4/M1
CD Pipeline / build-and-deploy (push) Has started running
C1 — Repository 層修正 (積木化鐵律):
新增 PlaybookEmbeddingRepository (pgvector UPSERT)
playbook_embedding_service 改透過 Repository 存取 DB,不再直接 db.execute(text(...))
C2 — Router 層業務邏輯移入 Service 層:
create_incident_for_approval + extract_affected_services (去掉底線前綴) 移入 incident_service.py
webhooks.py 改從 incident_service import,自身不再含業務邏輯
I1 — _infra_jobs 提升為 module-level frozenset (_INFRA_JOB_NAMES),避免每次呼叫重建
I2 — _persist_embeddings_to_db 補齊 PlaybookRAGService / list[Playbook] 型別標注
I3 — embedding 格式顯式化: "[" + ",".join(str(float(x)) for x in embedding) + "]"
防止 pgvector 因格式差異靜默解析失敗
I4 — import asyncio 移至 main.py 頂層,移除 try 區塊內重複 import
M1 — similarity.py: 移除死代碼 `if union > 0 else 0.0`
union 在兩個集合都非空時不可能為 0
2026-04-10 Asia/Taipei — Claude Sonnet 4.6
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-04-10 11:35:10 +08:00 |
|