feat: unify TKG face_track external_id to trace_N, add trace restore endpoint
- tkg.rs: use trace_N as primary external_id, delete duplicate face_track_N nodes - trace_agent_api.rs: add POST /trace/:id/restore to undo soft delete - ensure 1:1 mapping: each trace has exactly one TKG node with full profile
This commit is contained in:
@@ -1153,7 +1153,8 @@ async fn build_face_track_nodes_from_qdrant(
|
||||
|
||||
let mut count = 0;
|
||||
for (tid, agg) in &traces {
|
||||
let external_id = format!("face_track_{}", tid);
|
||||
// Use trace_N as primary external_id (consistent with cluster_agent)
|
||||
let external_id = format!("trace_{}", tid);
|
||||
let label = format!("Face Trace {}", tid);
|
||||
|
||||
// Compute average pose for this trace
|
||||
@@ -1217,6 +1218,17 @@ async fn build_face_track_nodes_from_qdrant(
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
// Delete old face_track_N format to avoid duplicates
|
||||
let old_external_id = format!("face_track_{}", tid);
|
||||
let _ = sqlx::query(&format!(
|
||||
"DELETE FROM {} WHERE file_uuid = $1 AND node_type = 'face_track' AND external_id = $2",
|
||||
nodes_table
|
||||
))
|
||||
.bind(file_uuid)
|
||||
.bind(&old_external_id)
|
||||
.execute(pool)
|
||||
.await;
|
||||
|
||||
count += 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user