feat: Phase 2.6 edges migration to Qdrant (TKG-only architecture)

Phase 2.6.1: co_occurrence_edges migration
- build_co_occurrence_edges_from_qdrant()
- Qdrant embeddings → frame grouping → YOLO objects
- Result: 6679 edges (vs 6701 PostgreSQL)

Phase 2.6.2: face_face_edges migration
- build_face_face_edges_from_qdrant()
- Qdrant embeddings → frame grouping → face pairs
- mutual_gaze detection preserved
- Result: 6 edges (exact match)

Phase 2.6.3: speaker_face_edges migration
- build_speaker_face_edges_from_qdrant()
- Qdrant embeddings → trace_id frame ranges
- SPEAKS_AS edge creation

Architecture:
- All edges use Qdrant payload (no face_detections queries)
- PostgreSQL fallback for empty Qdrant
- Estimated 3.6x performance improvement

Testing:
- Playground (3003): ✓ All Phase 2.6 logs verified
- Edge counts: ✓ Close match with PostgreSQL
- Fallback: ✓ Working

Docs:
- docs_v1.0/DESIGN/TKG_PHASE2_6_EDGES_MIGRATION.md
- docs_v1.0/M4_workspace/2026-06-21_phase2_6_test.md
This commit is contained in:
Accusys
2026-06-21 04:47:49 +08:00
parent 0afc70fc5b
commit 2cfcfdd1af
2926 changed files with 8311058 additions and 1394 deletions

View File

@@ -0,0 +1,96 @@
#!/bin/bash
# Config Check Script
# 驗證配置是否正確設置
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo "=========================================="
echo "Momentry Core 配置檢查"
echo "=========================================="
# 檢查 .env 文件
if [ -f ".env" ]; then
echo -e "${GREEN}✅ .env 文件存在${NC}"
else
if [ -f ".env.example" ]; then
echo -e "${YELLOW}⚠️ .env 文件不存在,使用模板創建...${NC}"
cp .env.example .env
echo -e "${YELLOW}⚠️ 已創建 .env請編輯並設置正確的憑據${NC}"
else
echo -e "${RED}❌ .env 和 .env.example 都不存在${NC}"
fi
fi
# 檢查必要配置
check_var() {
local var_name="$1"
local description="$2"
if grep -q "^${var_name}=" .env 2>/dev/null; then
echo -e "${GREEN}${var_name}${NC} - $description"
else
echo -e "${YELLOW}⚠️ ${var_name}${NC} - $description (使用默認值)"
fi
}
if [ -f ".env" ]; then
echo ""
echo "檢查環境變數..."
check_var "DATABASE_URL" "PostgreSQL 連接"
check_var "REDIS_URL" "Redis 連接"
check_var "REDIS_PASSWORD" "Redis 密碼"
check_var "MOMENTRY_OUTPUT_DIR" "輸出目錄"
check_var "MOMENTRY_PYTHON_PATH" "Python 路徑"
check_var "RUST_LOG" "日誌級別"
fi
# 檢查目錄權限
echo ""
echo "檢查目錄權限..."
check_dir() {
local dir="$1"
local description="$2"
if [ -d "$dir" ]; then
if [ -w "$dir" ]; then
echo -e "${GREEN}${dir}${NC} - $description (可寫)"
else
echo -e "${RED}${dir}${NC} - $description (不可寫)"
fi
else
echo -e "${YELLOW}⚠️ ${dir}${NC} - $description (目錄不存在)"
fi
}
check_dir "/Users/accusys/momentry/output" "輸出目錄"
check_dir "/Users/accusys/momentry/backup" "備份目錄"
# 檢查 Python
echo ""
echo "檢查 Python..."
if command -v python3.11 &> /dev/null; then
version=$(python3.11 --version 2>&1)
echo -e "${GREEN}✅ Python 3.11 可用${NC} ($version)"
else
echo -e "${RED}❌ Python 3.11 不可用${NC}"
fi
# 檢查 Rust
echo ""
echo "檢查 Rust..."
if command -v cargo &> /dev/null; then
version=$(cargo --version 2>&1)
echo -e "${GREEN}✅ Cargo 可用${NC} ($version)"
else
echo -e "${RED}❌ Cargo 不可用${NC}"
fi
echo ""
echo "=========================================="
echo "配置檢查完成"
echo "=========================================="