diff --git a/src/api/scan.rs b/src/api/scan.rs index 94b79991..f9db2acc 100644 --- a/src/api/scan.rs +++ b/src/api/scan.rs @@ -1303,6 +1303,38 @@ async fn get_pipeline_progress_handler( ); } + // Check VLM summary progress from trace_profiles + let tp_table = schema::table_name("trace_profiles"); + let vlm_total: i64 = sqlx::query_scalar::<_, i64>(&format!( + "SELECT COUNT(*) FROM {tp_table} WHERE file_uuid = $1" + )) + .bind(&file_uuid) + .fetch_one(pool) + .await + .unwrap_or(0); + let vlm_done: i64 = sqlx::query_scalar::<_, i64>(&format!( + "SELECT COUNT(*) FROM {tp_table} WHERE file_uuid = $1 AND vlm_description IS NOT NULL AND vlm_description != ''" + )) + .bind(&file_uuid) + .fetch_one(pool) + .await + .unwrap_or(0); + + if vlm_total > 0 { + let vlm_progress = if vlm_done > 0 { + vlm_done as f64 / vlm_total as f64 + } else { + 0.0 + }; + let status = if vlm_done == vlm_total { "completed" } else { "running" }; + pp.update_stage( + "vlm_summary", + vlm_progress, + status, + Some(format!("{}/{}", vlm_done, vlm_total)), + ); + } + // Check face dedup from actual face_cluster.json content if processors_done && tkg_node_count > 0 { let output_dir = crate::core::config::OUTPUT_DIR.as_str();