fix: face group name read consistency, sync_file_status fix, cleanup ghost records, identity_agent replaced with face_dedup

- get_face_groups_handler: COALESCE(tp.name, tn.label) for name consistency
- sync_file_status: compare JSON vs pre_chunks (not chunk table)
- face consistency: compare frames.len() not total_faces
- cleanup 2 ghost records with NULL file_name/file_path
- replace identity_agent with face_dedup in pipeline stages
- remove identity_agent_api.rs and all references
- update required_processors to match actual processors
- update AGENTS.md with team responsibilities
- add Studio pipeline changes documentation
This commit is contained in:
Accusys
2026-07-27 02:15:51 +08:00
parent fcdeab82e6
commit 39a2cbc65b
118 changed files with 19386 additions and 2964 deletions
+92 -9
View File
@@ -19,19 +19,29 @@ Rust-based digital asset management system with video analysis and RAG capabilit
### 開發範圍界定
| 範圍 | 狀態 | 說明 |
|------|------|------|
| `momentry_core_0.1/` | ✅ **可開發** | Momentry Core 主要開發目錄 |
| `momentry_core_0.1/portal/` | ✅ **可開發** | Tauri Portal 前端 |
| `momentry_core_0.1/src/` | ✅ **可開發** | Rust 後端程式碼 |
| `/Users/accusys/wordpress/` | ❌ **禁止修改** | WordPress/Marcom 團隊負責 |
| `~/momentry_core/` | ✅ **可開發** | Momentry Core 後端(Rust),Core team 負責 |
| `~/momentry_core/portal/` | ⚠️ **僅供測試** | Tauri Portal 僅用於測試,非正式前端 |
| `~/momentry_studio/` | ❌ **禁止修改** | Momentry Studio 前端,**Studio team 負責** |
| `/Users/accusys/wordpress/` | ❌ **禁止修改** | WordPress 網站僅供參考,已被 Studio 取代 |
| n8n 工作流 | ❌ **禁止修改** | 自動化流程,與 dev 無關 |
| WordPress/n8n 資料庫 table | ❌ **禁止修改** | Marcom 團隊管理,與 dev 無關 |
### 團隊職責劃分
| 團隊 | 負責專案 | 目錄 |
|------|---------|------|
| **Core team** | Momentry Core 後端 | `~/momentry_core/` |
| **Studio team** | Momentry Studio 前端 | `~/momentry_studio/` |
| **Marcom team** | WordPress 網站(已停用) | `/Users/accusys/wordpress/` |
### 開發環境
| 服務 | Port | 用途 | 命令 |
|------|------|------|------|
| Playground | 3003 | **唯一開發環境** | `cargo run --bin momentry_playground -- server` |
| Production | 3002 | ❌ 禁止修改 | `cargo run -- server` (僅 release 時) |
| Portal (Tauri) | 1420 | 前端開發 | `npm run tauri dev` |
| 服務 | Port | 用途 | 命令 | 狀態 |
|------|------|------|------|------|
| Playground | 3003 | ~~開發環境~~ (暫停) | `cargo run --bin momentry_playground -- server` | 🔴 已暫停 (節省 memory) |
| Production | 3002 | **開發 + 生產環境** | `cargo run -- server` | 🟢 運行中 (debug binary) |
| Portal (Tauri) | 1420 | 前端開發 | `npm run tauri dev` | - |
> **注意 (2026-07-25)**: Playground (3003) 已暫停服務。Production (3002) 改為直接用於開發測試。新功能可直接部署至 3002。
> **注意 (2026-07-23)**: 為節省記憶體,Playground (3003) 已關閉。Production (3002) 目前使用 debug binary 運行(已套用 smart_search 修復)。正式 release 時需重新 build release binary。
### 日誌與啟動
| 服務 | 日誌路徑 | 啟動方式 |
@@ -234,6 +244,77 @@ grep -i "error\|panic\|FAIL" logs/momentry_*.log | tail -20
| `momentry_playground` | Development | 3003 | `momentry_dev:` | `.env.development` |
| `momentry_player` | Video player | - | - | - |
## LLM Services
### 環境一致性原則
**生產環境 (port 3002) 與 Playground (port 3003) 使用相同的 LLM/VLM/Embedding 服務。**
### LLM Configuration
| 用途 | Model | 服務 | Port | API 格式 |
|------|-------|------|------|----------|
| **Agent Search** | `llama3.1:8b` | Ollama | 11434 | `/v1/chat/completions` |
| **VLM(視覺)** | `llava-v1.6-vicuna-13b` | llama.cpp | 8091 | `/v1/chat/completions` |
| **Embedding** | `embeddinggemma-300m` | Python | 11436 | Custom |
### Model 檔案位置
```
/Users/accusys/models/
├── llava-v1.6-vicuna-13b.Q4_K_M.gguf (VLM model)
├── mmproj-model-f16.gguf (VLM mmproj)
├── embeddinggemma-300M-Q8_0.gguf (Embedding model)
├── gemma-4-E4B-it-Q4_K_M.gguf (Text LLM)
└── google_gemma-4-26B-A4B-it-Q5_K_M.gguf (Text LLM)
```
### 啟動命令
**Ollama (llama3.1:8b)**
```bash
ollama serve # Service
ollama run llama3.1:8b # Interactive
curl http://localhost:11434/api/chat # API endpoint
```
**llama.cpp (llava-v1.6-vicuna-13b)**
```bash
/Users/accusys/llama/bin/llama-server \
-m /Users/accusys/models/llava-v1.6-vicuna-13b.Q4_K_M.gguf \
--mmproj /Users/accusys/models/mmproj-model-f16.gguf \
--host 0.0.0.0 \
--port 8091 \
-ngl 99 \
-c 4096
```
**Embedding (embeddinggemma-300m)**
```bash
python3 scripts/embeddinggemma_server.py --port 11436
```
### VLM 用途
- **Face trace VLM**: 描述人物外貌(衣著、顏色、配件)
- **Scene VLM**: 場景分析
- **Agent `analyze_frame`**: 畫面分析工具
### Agent Search 語言
- **預設使用英文回答**(除非用戶明確要求其他語言)
- System prompt 已明確規範 LLM 必須使用英文回應
### 環境變數
```bash
# .env.development
MOMENTRY_LLM_CHAT_URL=http://localhost:11434/api/chat
MOMENTRY_LLM_CHAT_MODEL=llama3.1:8b
MOMENTRY_LLM_VISION_URL=http://localhost:8091/v1/chat/completions
MOMENTRY_LLM_VISION_MODEL=llava-v1.6-vicuna-13b
```
## Testing
```bash
@@ -272,6 +353,8 @@ cargo check --all-features
- Use Rust 2021 edition
- Use tracing for logging (not println!)
- Keep lines under 100 characters
- **Always provide absolute paths when referencing files** — use full paths like `/Users/accusys/momentry_core/src/main.rs` instead of relative paths like `src/main.rs`
- **All document references MUST include full paths** — when listing files to modify, API endpoints, or cross-references in docs, always use absolute paths (e.g., `/Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE/modules/19_people_api.md`)
### Imports (order: std → external → local)
```rust