diff --git a/src/api/scan.rs b/src/api/scan.rs index f8624da6..94b79991 100644 --- a/src/api/scan.rs +++ b/src/api/scan.rs @@ -28,6 +28,8 @@ struct FileStatsResponse { tkg: TkgFileStats, // Face Dedup stats face_dedup: FaceDedupStats, + // VLM Summary progress + vlm_summary: VlmSummaryStats, // On-disk face artifact counts (vs expected) face_artifacts: FaceArtifactsCounts, } @@ -87,6 +89,12 @@ struct FaceDedupStats { consistent: bool, } +#[derive(Debug, Serialize, Default)] +struct VlmSummaryStats { + total: i64, + done: i64, +} + #[derive(Debug, Serialize, Deserialize)] struct ScannedFileInfo { file_name: String, @@ -1072,6 +1080,27 @@ async fn get_file_stats( let mut face_artifacts = count_face_artifacts(output_dir, &file_uuid); face_artifacts.expected_traces = expected_traces; + // 8. VLM Summary progress + let vlm_total: i64 = sqlx::query_scalar(&format!( + "SELECT COUNT(*) FROM {trace_profiles_table} WHERE file_uuid = $1" + )) + .bind(&file_uuid) + .fetch_one(pool) + .await + .unwrap_or(0); + let vlm_done: i64 = sqlx::query_scalar(&format!( + "SELECT COUNT(*) FROM {trace_profiles_table} \ + WHERE file_uuid = $1 AND vlm_description IS NOT NULL" + )) + .bind(&file_uuid) + .fetch_one(pool) + .await + .unwrap_or(0); + let vlm_summary = VlmSummaryStats { + total: vlm_total, + done: vlm_done, + }; + Ok(Json(FileStatsResponse { file_uuid: file_uuid_str, file_name, @@ -1081,6 +1110,7 @@ async fn get_file_stats( qdrant: qdrant_stats, tkg, face_dedup, + vlm_summary, face_artifacts, })) }