63990ac632
PR-2B (Memo Inbox Triage) backend 1/2. plan: beszel-tingly-sloth.md 라운드 13. 사용자 비전 = 메모는 inbox, AI 는 triage assistant. AI worker 는 events row 직접 생성 X. Migrations 250–253 (실측 N=250): - 250 CREATE TYPE event_kind_hint AS ENUM (note|task|calendar_event|activity_log|reference) - 251 ALTER TABLE documents ADD ai_event_kind event_kind_hint - 252 ALTER TABLE documents ADD ai_event_confidence NUMERIC(3,2) + CHECK 0–1 - 253 CREATE INDEX idx_documents_ai_event_kind partial WHERE ai_event_kind IS NOT NULL ORM: - Document.ai_event_kind / ai_event_confidence 컬럼 추가 (Enum SQLAlchemy 동기) - source_channel enum 에 'voice' 추가 (PR-2C 와 호환) Worker: - classify_worker Phase 3 (Gemma 4B triage) 확장 · TriageOutput 에 event_kind_hint + event_kind_confidence 필드 추가 · 4B 응답에 hint 가 있을 때만 Document 에 저장 (enum 외 값은 무시) - prompt p3a_short_summary.txt 확장 — note/task/calendar_event/activity_log/reference 분류 기준 + confidence + default='note' 명시 원칙: AI worker 는 hint 만 제공. events 생성은 다음 commit 의 promote endpoint 에서만.
8 lines
402 B
SQL
8 lines
402 B
SQL
-- Memo Intake Upgrade PR-2B (4/4) — partial index on ai_event_kind
|
|
-- 메모 list 의 분류 결과 필터 + 사용자 inbox triage 흐름 핵심 인덱스.
|
|
-- ai_event_kind IS NULL (분류 대기 / 미통과) 행은 size 절감 목적 partial 로 제외.
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_documents_ai_event_kind
|
|
ON documents (ai_event_kind, created_at DESC)
|
|
WHERE ai_event_kind IS NOT NULL;
|