feat: add cluster-agent endpoint, fix OCR labeling, fix ingestion blocking

- Add POST /api/v1/file/:file_uuid/cluster-agent endpoint for on-demand face clustering
- Fix OCR chunks being labeled as ASRX: use ChunkType.as_str() instead of {:?}
- Rule 1 now deletes old chunks before re-inserting to avoid stale data
- Add fallback face_traced.json when store_traced_faces.py fails
- ingestion_complete now handles status='error' to unblock jobs
- VLM describe tool now uses trace_id with pre-extracted face crops
This commit is contained in:
Accusys
2026-07-20 21:48:27 +08:00
parent 244af51edf
commit 7dc910e2de
8 changed files with 654 additions and 57 deletions
+9 -1
View File
@@ -30,6 +30,14 @@ pub async fn execute_rule1(db: &PostgresDb, file_uuid: &str, fps: f64) -> Result
let mut count = 0;
let mut tx = pool.begin().await?;
// Delete existing chunks for this file before re-inserting
let chunk_table = schema::table_name("chunk");
sqlx::query(&format!("DELETE FROM {} WHERE file_uuid = $1", chunk_table))
.bind(file_uuid)
.execute(&mut *tx)
.await?;
info!("Rule 1: Deleted old chunks for video {}", file_uuid);
// Phase 1: ASRX segments (pure speech, NO OCR merge)
for seg in asr_segments.iter() {
// Skip chunks with no text
@@ -97,7 +105,7 @@ pub async fn execute_rule1(db: &PostgresDb, file_uuid: &str, fps: f64) -> Result
file_id as i32,
file_uuid.to_string(),
format!("{}", count),
ChunkType::Sentence,
ChunkType::Ocr,
ChunkRule::Rule1,
start_time,
end_time,