From b2378a219b29d80e55a78756bbfef215f93f6650 Mon Sep 17 00:00:00 2001 From: Accusys Date: Mon, 24 Aug 2026 19:40:00 +0800 Subject: [PATCH] fix: pipeline stats API now shows VLM summary progress - Added trace_profiles query to compute vlm_done/vlm_total - vlm_summary stage now shows actual progress (e.g. 312/4829) - Status shows 'running' while in progress, 'completed' when done --- src/api/scan.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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();