fix: face group name read consistency, sync_file_status fix, cleanup ghost records, identity_agent replaced with face_dedup

- get_face_groups_handler: COALESCE(tp.name, tn.label) for name consistency
- sync_file_status: compare JSON vs pre_chunks (not chunk table)
- face consistency: compare frames.len() not total_faces
- cleanup 2 ghost records with NULL file_name/file_path
- replace identity_agent with face_dedup in pipeline stages
- remove identity_agent_api.rs and all references
- update required_processors to match actual processors
- update AGENTS.md with team responsibilities
- add Studio pipeline changes documentation
This commit is contained in:
Accusys
2026-07-27 02:15:51 +08:00
parent fcdeab82e6
commit 39a2cbc65b
118 changed files with 19386 additions and 2964 deletions
+78
View File
@@ -146,6 +146,84 @@ pub async fn vectorize_chunks(uuid: &str) -> Result<()> {
Ok(())
}
pub async fn reindex_embeddings(uuid: &str) -> Result<()> {
let db = PostgresDb::new(&config::DATABASE_URL).await?;
let qdrant = QdrantDb::new();
let chunk_table = schema::table_name("chunk");
let rows = sqlx::query_as::<_, (String, String, String, i64, i64, f64, f64, String, String)>(
&format!(
"SELECT chunk_id, chunk_type, text_content, start_frame, end_frame, \
start_time, end_time, content::text, embedding::text \
FROM {} WHERE file_uuid = $1 AND embedding IS NOT NULL \
ORDER BY id",
chunk_table
),
)
.bind(uuid)
.fetch_all(db.pool())
.await?;
if rows.is_empty() {
println!("No chunks with embeddings to reindex for {}", uuid);
return Ok(());
}
let total = rows.len();
let mut stored = 0usize;
for (
chunk_id,
chunk_type,
text,
start_frame,
end_frame,
start_time,
end_time,
_content_str,
embedding_text,
) in &rows
{
let vector: Vec<f32> = match serde_json::from_str(embedding_text) {
Ok(v) => v,
Err(e) => {
eprintln!("Failed to parse embedding for {}: {}", chunk_id, e);
continue;
}
};
let payload = VectorPayload {
file_uuid: uuid.to_string(),
chunk_id: chunk_id.clone(),
chunk_type: chunk_type.clone(),
start_frame: *start_frame,
end_frame: *end_frame,
start_time: *start_time,
end_time: *end_time,
text: if text.is_empty() {
None
} else {
Some(text.clone())
},
};
if let Err(e) = qdrant.upsert_vector(chunk_id, &vector, payload).await {
eprintln!("Qdrant upsert failed for {}: {}", chunk_id, e);
continue;
}
stored += 1;
if stored % 50 == 0 {
println!("Reindexed {}/{} chunks for {}", stored, total, uuid);
}
}
println!(
"Reindex complete: {}/{} embeddings pushed to Qdrant for {}",
stored, total, uuid
);
Ok(())
}
pub async fn run_phase1(uuid: &str) -> Result<()> {
let executor = PythonExecutor::new().context("Failed to create PythonExecutor")?;