Commit Graph

518 Commits

Author SHA1 Message Date
Accusys 8101ff0cb4 fix: face processor 讀取 .with_embedding 檔案當 copy 失敗時(確保 facenet embeddings 不會遺失)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-18 01:05:38 +08:00
Accusys 18aa0130a7 fix: 檔案列表 name matching fallback — path 不匹配時改用 name 比對(處理 symlink 路徑差異)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 23:38:01 +08:00
Accusys 1d3c86c56c fix: upload_paths output_path 自動設定 + settings save 不覆蓋既有 full_path
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- 新增 upload_path 時自動設定 output_path = /Users/accusys/momentry/output/{name}
- ON CONFLICT 只設 enabled=true,不再覆蓋 full_path
2026-11-17 22:11:54 +08:00
Accusys 2a8bd88a3e fix: appearance API per-library output path(與 trace_profile/face_cluster 同樣的 per-library fallback 模式)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 19:46:13 +08:00
Accusys be16a588c2 feat: 自動產生 face_id(face_{frame}_{idx})於 face.json 儲存前
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 19:29:14 +08:00
Accusys 4100d5c77a fix: per-library output path for cluster_agent, profile, trace_agent
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- cluster_agent: resolve_output_path per-library + fallback
- profile.rs: materialize_auto_groups + get_cluster_results + trace_profile filesystem fallback
- trace_agent_api.rs: read_trace_profile per-library + fallback
All now check output/demo/ before falling back to global output/
2026-11-17 19:14:15 +08:00
Accusys a16a2981e1 fix: unregistered 卡片確保有 size/mdate — MarkBase fallback + 磁碟掃描補齊 + formatSize/formatDate 顯示 '—' 替代空白
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 18:12:21 +08:00
Accusys 953d677c8e feat: DELETE API /api/v1/file/delete-unregistered — 永久刪除殘留 entry(磁碟檔 + DB + Qdrant + Redis),路徑限縮 storage root
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 17:56:06 +08:00
Accusys 5b5c1d9563 fix: face pipeline 三項修復
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
1. face_clustering: 先試 Rust binary,Python script 缺失不再提前返回空結果
2. face.rs: facenet model 查找加 fallback ( -> momentry_core/models),config 路徑補 --model 參數
3. rust_store_traced_faces: embedding 缺失時退回純 IoU 追蹤(不再強制要求 similarity);trace_profile.json 補上真實 avg_bbox/best_bbox/capture_quality
2026-11-17 17:26:00 +08:00
Accusys 5056c20667 fix: embedding port 全部改為 11436(plist + svc_def + server_type + test-embedding) 2026-11-17 13:31:20 +08:00
Accusys 8f0315e588 fix: embedding port 11437 → 11436 (correct system port)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 13:26:56 +08:00
Accusys 6ba4ee1e06 fix: Redis service label sh.brew.redis → com.momentry.redis
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 12:48:51 +08:00
Accusys 7fd7df2913 fix: scripts_dir() 恢復正確路徑 resolve_asset_path('MOMENTRY_SCRIPTS_DIR', 'scripts'); embedding port 11436→11437
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 08:41:34 +08:00
Accusys eac827d932 fix: scripts_dir() 恢復正確路徑 resolve_asset_path('MOMENTRY_SCRIPTS_DIR', 'scripts') → ~/momentry/scripts/ 2026-11-17 04:31:03 +08:00
Accusys a85e31ff16 fix: embedding default port 11436 → 11437 (llama-server GGUF) 2026-11-17 04:26:33 +08:00
Accusys 646d2a1361 fix(P0): face_cluster_done 雙路徑檢查 + run_processor 改用 async get_output_dir_for_file; 補 ingestion_complete output_dir
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 03:03:16 +08:00
Accusys d01e456ae5 fix(P0): per-library output dir for worker ingestion/verification (face_cluster guard, verifier, TKG, qdrant_face, ASR/ASRX); fix face_cluster serde default for empty output; fix face_cluster dependencies in pipeline_flows.json
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 02:46:57 +08:00
Accusys db790e2c89 fix: face_cluster guard checks both global OUTPUT_DIR and demo subdirectory for face_traced.json
Cross-Project Integration / integration (push) Has been cancelled
Core Test / lint-and-test (push) Has been cancelled
2026-11-17 01:29:28 +08:00
Accusys 75cbaa3302 feat: rebuild embeddings endpoint + standalone tool (API + binary), clear collection before rebuild, fix upsert_scene_embedding args
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-16 21:56:43 +08:00
Accusys 083d73d287 feat: real service test endpoints (proxy 7-route round-trip, core/chat/vlm/markbase/embedding), unified log paths + errorLog, pipeline tools/import/export/folder APIs, face pipeline check, dynamic concurrency tuning
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-16 18:16:46 +08:00
Accusys d21d1ab960 fix: Library Re-run 完整重建搜尋索引 (ASR/ASRX/OCR/Scene VLM)
- trigger_processing: force 時僅刪除指定 processor 的輸出檔與 processor_results
  (其他 processor 資料保留),並設定 rerun_rebuild Redis flag 要求重建索引
- worker: 單一 processor Re-run 時強制 Rule 1 重新 chunk + vectorize
  (清除 momentry_rule1 舊 vectors,避免 stale 搜尋結果)
- Scene VLM Re-run: job_processors 含 scene_vlm 即 dispatch,
  scene-only job 完成條件改以 scenes.json 完整度判定
- 前端 redoProcessor 傳 force=true,Scene VLM 新增 🔄 Re-run 按鈕
2026-11-10 07:59:31 +08:00
Accusys 3d7ec83ec9 fix: Qdrant collection ensure + self-healing on clean install
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- qdrant_db.rs: ensure_collection now uses PUT /collections/{name}
  (was POST /collections without name) and checks response status.
  Previous code silently no-op'd, so every upsert got 404 on clean
  installs with empty Qdrant.
- face.rs: store_face_embeddings_to_qdrant ensures _faces (512D)
  collection exists before upsert (fixes face→facenet→Qdrant broken
  link on fresh machines).
- pipeline/mod.rs: vectorize_chunks ensures main text collection
  (768D) before upserts.
- job_worker.rs: vectorize_chunks ensures main collection (768D)
  before upserts; also 3 additional lines of job_worker WIP fixes.

Verified: after these fixes, Qdrant collections are auto-created
on first upsert, resolving the face embedding + rule1 vectorize
failures on 203.
2026-11-09 15:55:01 +08:00
Accusys 70f5667adc fix: processor-counts resolves face_trace -> face_traced.json
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
get_processor_counts built the filename from the queue name
(face_trace.json) while rust_store_traced_faces writes face_traced.json
(per processor_tools_v3 output_file), so the API/UI reported
face_trace has_json=false and face_traced data was unreachable for
existing files. Map face_trace -> face_traced in both
get_processor_counts and get_processor_json.

Verified: dev (201) & 203 processor-counts now report face_trace
has_json=true and /api/v1/processor-json?processor=face_trace returns 200.
2026-11-09 12:39:44 +08:00
Accusys c1ede4ade8 fix: rust_asr_asrx handles MLX Whisper non-finite JSON literals
- MLX Whisper emits 'avg_logprob: NaN' / 'compression_ratio: Infinity' when a
  clip has no intelligible audio (e.g. near-silent test clips). serde_json
  strictly refuses those literals, so rust_asr_asrx failed with
  'expected value at line 1 column 151' and asrx never completed.
- Sanitize NaN / Infinity / -Infinity literals outside strings into null
  before parsing (sanitize_json_nonfinite).
- Add no-audio-track early-out. Clean up .wav byproduct after success.

Verified on dev (m5max48): 002.mp4 asrx re-scan now completes and produces
output/df6376c8....asrx.json; processor_results asrx = completed.
2026-11-09 12:02:19 +08:00
Accusys 4f4aa27da8 refactor: remove MongoDB from health check
- Removed check_mongodb() function from health.rs
- Health endpoint no longer requires MongoDB (status depends on PG+Redis+Qdrant only)
- ServiceHealth struct: mongodb field commented out
- Both health() and health_detailed() updated
- Removed MongoCache import

Note: Binary rebuild blocked by missing .sqlx cache files for
command/queue.rs and vlm/consumer.rs. Once build env is fixed:
  cd momentry_core && SQLX_OFFLINE=true cargo build --release
  cp target/release/momentry ../momentry/bin/momentry
2026-11-08 23:24:02 +08:00
Accusys c6cbb5d1fb feat: asrx recovery + pipeline fixes + face trace improvements
- ASR-ASRX unified processor (asr_asrx → asrx), output .asrx.json
- ffmpeg -vsync → -fps_mode (swift_ocr, swift_hand, swift_pose, frame_cache)
- ffprobe absolute path for probe
- PYTHONPATH + PATH added to executor subprocesses
- cut processor path fix (cut/cut_processor.py)
- scene_vlm fallback when blur_scores empty + ffmpeg absolute path
- rust_store_traced_faces generates key_face.jpg with --video-path
- face group representative trace picks highest best_confidence
- Studio: move FS doesn't remove from unassigned, always reload after move
- Studio: confirmMoveFaceToNewGroup simplified to just rename
- Studio: scene_vlm added to processors list
- Studio: scene_vlm shows (0) when ready but no scenes
- admin_config asr_config block added
2026-11-06 10:00:24 +08:00
Accusys ada49d3491 fix: add DISTINCT ON to cluster-results handler to prevent duplicate group cards 2026-11-02 18:59:54 +08:00
Accusys eebaa11bfb fix: prevent duplicate face group cards - deduplicate tkg_nodes and DISTINCT ON in get_face_groups_handler 2026-11-02 17:30:29 +08:00
Accusys f67219fe02 feat: add face_operations.rs SQLite module for face pipeline state management 2026-11-02 16:50:54 +08:00
Accusys adcc5a1dc1 feat: face_tracker v2 schema - add schema_version, TraceBBox with x2/y2/center, TracePoint with pose/landmarks 2026-11-02 14:51:31 +08:00
Accusys 5d18183d82 feat: Face JSON v2 schema - add schema_version, bbox x2/y2/center, keep embeddings, update clustering 2026-11-02 14:34:02 +08:00
Accusys 2fca49b120 fix: update tkg_nodes.label when face_track node already exists
- ensure_face_track_node now UPDATEs label instead of returning early
- Fixes rename persistence - names are now stored in database
- Enables consistent names across all access points (localhost, DDNS)
2026-10-30 22:47:16 +08:00
Accusys b1bc83586f fix: fallback to MarkBase data for file_size and modified_time
- When videos table has null values, use MarkBase file info as fallback
- Ensures registered files display correct size and date
- Fixes issue where registered files showed '0B' and no date
2026-10-30 12:50:58 +08:00
Accusys d61d242f4e fix: use default SFTP root path for unregistered files
- Add fallback path when MOMENTRY_SFTP_ROOT env var is not set
- Default: /Users/accusys/momentry/var/sftpgo/data/demo
- Fixes 500 error when registering files (file_path was empty)
2026-10-30 12:26:51 +08:00
Accusys 7251a12469 feat: add comprehensive logging for scene VLM tags parsing
- Log VLM response content (first 500 chars)
- Log JSON extraction success/failure
- Log JSON parsing success/failure
- Log missing 'summary' field
- Log parsed objects and tags count
- Helps debug why vlm_tags may be empty in some cases
2026-10-24 13:44:42 +08:00
Accusys b6cf793e1b feat: add detailed logging for scene VLM tags generation
- Log tags count and content after generation
- Log JSON extraction and parsing status
- Log parsed objects and tags count
- Helps debug why vlm_tags may be empty in some cases
2026-10-24 12:55:51 +08:00
Accusys db12446a68 fix: resolve route conflict in service management API
- Remove duplicate health::health_routes() merge that was conflicting with public_health_routes
- Move service_management::router() to protected_routes for proper auth
- Service management now works correctly:
  - /api/v1/mbe/health (public) - shows VLM status
  - /api/v2/service/start (protected) - starts llama-server
  - /api/v2/service/stop (protected) - stops llama-server
2026-10-24 11:54:30 +08:00
Accusys c151b49334 feat: implement service management API for VLM control
- Add /api/v1/mbe/health endpoint for status checks
- Add /api/v2/service/start to start llama-server
- Add /api/v2/service/stop to stop llama-server
- Use TCP connection test for port detection (more reliable than lsof)
- Add ps aux fallback for PID detection
- Implement structured bilingual VLM tags
- Add VLM integration documentation for Studio team

Endpoints tested and working with Momentry Studio AdminView UI.
2026-10-24 02:37:53 +08:00
Accusys d14cd9f3de fix: clear paused state on unregister/re-scan
- Added Redis SREM to clear jobs:paused set in unregister_internal
- Ensures re-scan always starts with clean state
- Fixes issue where paused files remain paused after re-scan
2026-10-19 03:24:50 +08:00
Accusys 121610f8d9 feat: dynamic processor list from pipeline_flows.json
- Changed pipeline_flows.json: scene → scene_vlm
- Added get_enabled_processors() method to PipelineFlows
- Updated create_monitor_job to use dynamic processors
- Updated process_register_command to use dynamic processors
- Removed hardcoded processor arrays
- Added tests for get_enabled_processors()
2026-10-19 02:03:15 +08:00
Accusys c4bdb01b21 feat: add status sync trigger and status query APIs
- Created PostgreSQL trigger to sync videos.status with monitor_jobs.status
- Added GET /api/v1/jobs/:uuid/status endpoint
- Added POST /api/v1/admin/sync-status endpoint for batch sync
- Status mapping: paused→paused, pending→registered, running→processing, completed→completed, failed→failed
- Migration file: 008_sync_video_status_trigger.sql
2026-10-18 22:08:19 +08:00
Accusys 9f7bc1c37a feat: add pause/resume job functionality
- Added Redis paused set for job management
- Worker skips paused jobs during polling
- Added POST /api/v1/jobs/:uuid/pause endpoint
- Added POST /api/v1/jobs/:uuid/resume endpoint
- Added GET /api/v1/jobs/paused endpoint
- Paused jobs are excluded from worker processing queue
2026-10-18 20:13:31 +08:00
Accusys f165dc1425 feat: enhance worker status API with PID, uptime, and liveness check
- Added worker_pid (from pgrep)
- Added uptime_secs
- Added last_poll_at (most recent job activity)
- Added poll_interval_secs
- Added is_alive (based on worker process existence)
2026-10-18 16:20:46 +08:00
Accusys 9cd386b720 feat: add data-consistency API + deprecate old face docs
- Added GET /api/v1/file/:uuid/data-consistency endpoint
  Checks consistency across tkg_nodes, trace_profiles, FS trace dirs, and Qdrant
- Marked 6 old face documents as deprecated with link to Face_Operations_Complete.md
2026-10-18 15:01:52 +08:00
Accusys 58431d1d8d feat: sync_trace_label unified function + fix is_tkg_done
- Created trace_sync module with sync_trace_label() to sync labels across:
  1. tkg_nodes.label (PostgreSQL)
  2. trace_profiles.name (PostgreSQL)
  3. trace_profile.json label (FS)
  4. Qdrant _faces payload.label (NEW - was missing)

- Fixed is_tkg_done: allow 0 trace dirs if tkg_nodes exist
  (prevents permanent stuck in 'Scanning' status)

- Updated Face Cluster to use sync_trace_label
- Updated merge_trace to use sync_trace_label + cleanup source dir

- Created Face_Operations_Complete.md reference document
  (consolidates all face-related docs into single source of truth)
2026-10-18 14:15:12 +08:00
Accusys f3013c8509 feat: add /api/v1/trace-profile-file endpoint
- Added endpoint to serve trace_profile.json files
- Fixes Studio proxy bug (missing file_uuid in path)
- Studio proxy at proxy.rs:809 constructs path without file_uuid
- Core endpoint now provides correct implementation
- Studio can proxy to this endpoint instead of local file reading
2026-10-18 09:23:49 +08:00
Accusys aecf64af27 fix: replace hardcoded store_traced_faces.py with Rust binary
- Worker was calling Python store_traced_faces.py instead of Rust version
- This caused trace_id=0 in Qdrant, blocking TKG and file completion
- Now uses rust_binary_path() to find and execute rust_store_traced_faces
- Also removed all Python implementations from processor config
- Removed POSE processor (deprecated)
- Added redis_publisher.py symlink for face clustering

Fixed: file stuck in 'Scanning' due to trace stability check failure
2026-10-18 08:43:56 +08:00
Accusys 17cdb6c7fd feat: implement dynamic concurrency control for SCENE_VLM (complete)
- Add DynamicSemaphore, SystemMonitor, VlmMonitor, AutoScaler
- Replace static SCENE_VLM_SEM with dynamic version (max: 3)
- Start AutoScaler in Worker::run() for automatic adjustment
- Configured for M5Max48: 48GB, thresholds at 38GB/41GB
- Expected processing time: 23-28 days for 10000 files

Note: VLM response tracking to be added separately if needed
2026-10-17 21:52:01 +08:00
Accusys 229eef6db1 fix: call start_autoscaler() in Worker::run() to enable dynamic concurrency 2026-10-17 21:49:58 +08:00
Accusys 9886a3a5b2 feat: implement dynamic concurrency control for SCENE_VLM
- Add dynamic_concurrency module with DynamicSemaphore, SystemMonitor, VlmMonitor, AutoScaler
- Replace static SCENE_VLM_SEM with dynamic version (max concurrency: 3)
- Add AutoScaler background task for automatic concurrency adjustment
- Configured for M5Max48 (48GB): thresholds at 38GB/41GB
- Expected processing time: 23-28 days for 10000 files

Related: Phase 1 implementation after Phase 0 TKG fix verification
2026-10-17 21:47:33 +08:00