fix: TKG rebuild type mismatch and face_track nodes

- Fix trace_id type mismatch (INT4 vs i64) with explicit ::bigint cast
- Change build_face_track_nodes to use from_pg version
- Add skin_tone_trace_nodes to API response
- Add #[derive(Serialize)] to TkgResult
- Fix Unicode panic in text label truncation
- Add push_existing_embeddings.py script
This commit is contained in:
Accusys
2026-06-25 11:23:53 +08:00
parent ecb0e9c7d0
commit fd2edd5736
3 changed files with 99 additions and 10 deletions
+5 -4
View File
@@ -458,6 +458,7 @@ struct FaceDetectionRow {
// ── Public API ────────────────────────────────────────────────────
#[derive(Debug, Serialize)]
pub struct TkgResult {
pub face_track_nodes: usize,
pub gaze_track_nodes: usize,
@@ -554,7 +555,7 @@ async fn build_face_track_nodes(
file_uuid: &str,
pose_data: &[FacePose],
) -> Result<usize> {
build_face_track_nodes_from_face_json(pool, file_uuid, pose_data).await
build_face_track_nodes_from_pg(pool, file_uuid, pose_data).await
}
async fn build_face_track_nodes_from_pg(
@@ -2228,8 +2229,8 @@ async fn build_text_region_nodes(pool: &PgPool, file_uuid: &str) -> Result<usize
&rows
{
let external_id = format!("text_{}", chunk_id);
let label = if text.len() > 50 {
format!("Text: {}...", &text[..47])
let label = if text.chars().count() > 50 {
format!("Text: {}...", text.chars().take(47).collect::<String>())
} else {
format!("Text: {}", text)
};
@@ -2587,7 +2588,7 @@ async fn build_skin_tone_trace_nodes(
let mut count = 0;
let rows: Vec<(i64, i64)> = sqlx::query_as(&format!(
"SELECT trace_id, COUNT(*) \
"SELECT trace_id::bigint, COUNT(*)::bigint \
FROM {} \
WHERE file_uuid = $1 AND trace_id IS NOT NULL \
GROUP BY trace_id",