Files
ewoooc/migrations/009_pgvector_embedding.sql
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

15 lines
625 B
SQL

-- ADR-007, Step 3: pgvector Extension 啟用與 HNSW 索引
-- 日期: 2026-04-18
-- 注意:這份腳本僅應在 PostgreSQL 環境下執行。若是 SQLite 會跳過。
-- 1. 啟用 pgvector 擴充 (需 SUPERUSER 權限 或已授權)
CREATE EXTENSION IF NOT EXISTS vector;
-- 2. 為 ai_insights 新增 embedding 欄位 (維度 1024 配合 bge-m3)
ALTER TABLE ai_insights ADD COLUMN IF NOT EXISTS embedding vector(1024);
-- 3. 為 embedding 欄位建立 HNSW 索引,使用 Cosine 距離優化語意檢索
CREATE INDEX IF NOT EXISTS idx_ai_insights_embedding
ON ai_insights
USING hnsw (embedding vector_cosine_ops);