fix(drift-card): 修 drift 卡片 2 bug — AI 研判 copy 樣式 + Diff 按鈕 AttributeError
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m8s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m8s
Bug 1: 按「🔍 查看 Diff」失敗 錯誤: 'DriftReportRepository' object has no attribute 'get_by_id' 根因: DriftReportRepository 方法叫 get(), 其他 repo 都叫 get_by_id() 修法: 加 get_by_id() alias, 對齊 repo 介面慣例 Bug 2: AI 研判內容被渲染成 code block + copy 按鈕 根因: telegram_gateway line 1962 用 <pre> 包 diff_summary 但 diff_summary 是 AI 研判敘述 + emoji 清單, 非 code 修法: 移除 <pre>, 改以分隔線 + html.escape 純文字顯示 驗收: - 下次 drift 卡片: AI 研判段落純文字(無紫色 code block + copy) - 按「🔍 查看 Diff」→ 送完整 diff 詳情(非 AttributeError) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -116,6 +116,11 @@ class DriftReportRepository:
|
||||
row = result.fetchone()
|
||||
return _row_to_report(row) if row else None
|
||||
|
||||
# 2026-04-19 Claude Opus 4.7 修 drift_view 按鈕 AttributeError
|
||||
# 其他 repo 慣例皆 get_by_id,對齊介面供 telegram_gateway 呼叫
|
||||
async def get_by_id(self, report_id: str) -> DriftReport | None:
|
||||
return await self.get(report_id)
|
||||
|
||||
async def list_recent(self, limit: int = 50) -> list[DriftReport]:
|
||||
"""列出最近 N 筆(倒序)"""
|
||||
async with get_db_context() as db:
|
||||
|
||||
Reference in New Issue
Block a user