feat: fix TKG external_id mismatch, add trace delete/merge endpoints, fix no-faces progress update

- identity_binding.rs: match both face_track_N and trace_N external_id formats in bind/unbind/create_pending_person
- profile.rs: fix external_id matching and parameter ordering in trace profile updates
- trace_agent_api.rs: add DELETE /trace/:id (soft/hard delete) and POST /trace/:src/merge/:target endpoints
- qdrant_db.rs: add delete_points_by_filter method
- tkg.rs: add debug logging for scroll and parse operations
- job_worker.rs: update progress for no-faces TKG path
This commit is contained in:
Accusys
2026-07-21 02:45:34 +08:00
parent d25b5921f7
commit 0ad6927d25
6 changed files with 368 additions and 51 deletions
+38 -7
View File
@@ -42,6 +42,11 @@ async fn scroll_face_points(file_uuid: &str) -> Vec<FacePoint> {
.await
{
Ok(pts) => {
tracing::info!(
"[TKG-Qdrant] scroll returned {} raw points for {}",
pts.len(),
file_uuid
);
if attempt > 1 {
tracing::info!(
"[TKG-Qdrant] scroll succeeded on attempt {} for {}",
@@ -49,7 +54,13 @@ async fn scroll_face_points(file_uuid: &str) -> Vec<FacePoint> {
file_uuid
);
}
return parse_face_points(pts);
let parsed = parse_face_points(pts);
tracing::info!(
"[TKG-Qdrant] parsed {} FacePoints for {}",
parsed.len(),
file_uuid
);
return parsed;
}
Err(e) => {
last_err = Some(e);
@@ -77,27 +88,47 @@ async fn scroll_face_points(file_uuid: &str) -> Vec<FacePoint> {
/// Parse FacePoint structs from Qdrant response
fn parse_face_points(points: Vec<serde_json::Value>) -> Vec<FacePoint> {
points
let mut valid = 0;
let mut no_trace_id = 0;
let mut no_frame = 0;
let result: Vec<FacePoint> = points
.iter()
.filter_map(|p| {
let payload = &p["payload"];
let trace_id = payload["trace_id"].as_i64().filter(|&t| t > 0)?;
let frame = payload["frame"].as_i64()?;
let trace_id = payload["trace_id"].as_i64().filter(|&t| t > 0);
if trace_id.is_none() {
no_trace_id += 1;
return None;
}
let frame = payload["frame"].as_i64();
if frame.is_none() {
no_frame += 1;
return None;
}
valid += 1;
let bbox = &payload["bbox"];
let x = bbox["x"].as_f64().unwrap_or(0.0);
let y = bbox["y"].as_f64().unwrap_or(0.0);
let w = bbox["width"].as_f64().unwrap_or(0.0);
let h = bbox["height"].as_f64().unwrap_or(0.0);
Some(FacePoint {
trace_id,
frame,
trace_id: trace_id.unwrap(),
frame: frame.unwrap(),
x,
y,
w,
h,
})
})
.collect()
.collect();
tracing::info!(
"[TKG-parse] total={}, valid={}, no_trace_id={}, no_frame={}",
points.len(),
valid,
no_trace_id,
no_frame
);
result
}
/// Build frame-to-face-points index for O(1) lookup