Some checks are pending
CD Pipeline / build-and-deploy (push) Has started running
Phase 31: log_summary_service.py — deepseek-r1:14b K8s Pod日誌異常摘要
- 觸發: signoz_webhook 告警時背景呼叫
- Redis快取 log_summary:{pod}:{date} TTL 24h
- 敏感資料regex遮蔽
Phase 32: local_code_review_service.py — qwen2.5-coder:7b PR自動審查
- Fallback: Gemini (diff > 50KB 或 Ollama超時)
- semaphore 最多2個同時審查
- 雙寫: Redis TTL 7d + pr_reviews表 (phase29 migration)
Phase 33: knowledge_rag_service.py — nomic-embed-text 768維 pgvector RAG
- 向量化(188) + 生成(111) 雙Ollama
- rag_chunks表 (phase28 migration)
- 初期線性搜尋,>100筆啟用ivfflat索引
Phase 34: image_analysis_service.py — llava:latest Telegram圖片分析
- download_and_analyze: Bot API getFile → 下載 → llava → 回應
- Rate limit: 每chat_id每分鐘3次 (Redis sliding window)
- telegram.py webhook新增photo分支
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
1.3 KiB
SQL
29 lines
1.3 KiB
SQL
-- Phase 28 (ADR-067): RAG 知識庫 pgvector 向量表
|
|
-- 2026-04-10 Claude Sonnet 4.6 Asia/Taipei
|
|
-- 前置: pgvector 0.8.2 已安裝於 awoooi_prod ✅
|
|
-- 索引: 初期線性搜尋 (< 100 筆);超過 100 筆後執行 CREATE INDEX ivfflat
|
|
|
|
CREATE EXTENSION IF NOT EXISTS vector;
|
|
|
|
CREATE TABLE IF NOT EXISTS rag_chunks (
|
|
id SERIAL PRIMARY KEY,
|
|
source TEXT NOT NULL, -- 來源: "playbook", "incident", "runbook", "adr"
|
|
source_id TEXT, -- 來源 ID (playbook_id / incident_id 等)
|
|
title TEXT NOT NULL, -- 標題 / 檔名
|
|
chunk_text TEXT NOT NULL, -- 原始文字片段
|
|
embedding vector(768), -- nomic-embed-text 768維向量
|
|
metadata JSONB DEFAULT '{}', -- 額外 metadata
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS ix_rag_chunks_source ON rag_chunks (source);
|
|
CREATE INDEX IF NOT EXISTS ix_rag_chunks_created ON rag_chunks (created_at DESC);
|
|
|
|
-- 向量近鄰索引 (超過 100 筆後執行)
|
|
-- CREATE INDEX IF NOT EXISTS ix_rag_chunks_embedding
|
|
-- ON rag_chunks USING ivfflat (embedding vector_cosine_ops)
|
|
-- WITH (lists = 10);
|
|
|
|
COMMENT ON TABLE rag_chunks IS 'RAG 知識庫向量片段 — Phase 28 ADR-067 (2026-04-10)';
|