Files
awoooi/apps/api/migrations/phase30_drift_narrative.sql
OG T 89015d4527
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
feat(phase30): Drift 報告 AI 人話摘要 (ADR-067)
- 新增 DriftNarratorService — qwen2.5:7b-instruct (Ollama 111)
  - 觸發條件: high >= 1 or medium >= 3(HPA replicas 白名單)
  - Redis 快取: drift_narrative:{report_id} TTL 1h
  - LLM 失敗時 graceful fallback 結構化文字
- drift.py _analyze_and_notify: 接入 narrator(Phase 30 標記)
- Migration: drift_reports.narrative_text TEXT (已在 prod 執行)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 01:37:43 +08:00

16 lines
622 B
SQL

-- Phase 30: Drift 報告 AI 人話摘要欄位
-- 2026-04-10 Claude Code (ADR-067): DriftNarratorService 寫入 narrative_text
-- qwen2.5:7b-instruct 生成繁中摘要,儲存於 drift_reports 表
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'drift_reports' AND column_name = 'narrative_text'
) THEN
ALTER TABLE drift_reports ADD COLUMN narrative_text TEXT DEFAULT NULL;
COMMENT ON COLUMN drift_reports.narrative_text IS
'AI 生成的繁體中文人話摘要 (qwen2.5:7b-instruct, Phase 30 ADR-067)';
END IF;
END $$;