fix: generate unique face_id when storing to Qdrant

問題:
- Face detection 階段未生成 face_id
- 存儲到 Qdrant 時轉換為空字符串
- 導致 API 無法正確查詢 trace 數據

修復:
- 在存儲到 Qdrant 時,如果 face_id 為空,生成唯一 ID
- 格式: face_{frame}_{idx}
- 例如: face_0_0, face_0_1, face_100_0

影響:
- 只影響新處理的文件
- 舊文件需要重新處理才能修正

相關問題:
- Trace API 404 Not Found
- Qdrant payload face_id 為空字符串
This commit is contained in:
Accusys
2026-10-01 00:16:39 +08:00
parent 323fd342f1
commit 8c7a5efd49
+7 -2
View File
@@ -600,15 +600,20 @@ pub async fn store_face_embeddings_to_qdrant(
let frame_num = frame.frame;
let timestamp_secs = frame_num as f64 / fps;
for face in &frame.faces {
for (idx, face) in frame.faces.iter().enumerate() {
if let Some(embedding) = &face.embedding {
let point_id = Uuid::new_v4().as_u128() as u64;
// Generate face_id if not present (format: face_{frame}_{idx})
let face_id = face.face_id.as_deref()
.map(|s| s.to_string())
.unwrap_or_else(|| format!("face_{}_{}", frame_num, idx));
let payload = serde_json::json!({
"file_uuid": file_uuid,
"frame": frame_num,
"timestamp_secs": timestamp_secs,
"face_id": face.face_id.as_deref().unwrap_or(""),
"face_id": face_id,
"confidence": face.confidence,
"x": face.x,
"y": face.y,