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:
@@ -997,12 +997,13 @@ async fn rebuild_tkg(
|
||||
success: true,
|
||||
file_uuid,
|
||||
result: Some(serde_json::json!({
|
||||
"face_track_nodes": r.face_track_nodes,
|
||||
"gaze_track_nodes": r.gaze_track_nodes,
|
||||
"lip_track_nodes": r.lip_track_nodes,
|
||||
"text_region_nodes": r.text_region_nodes,
|
||||
"appearance_trace_nodes": r.appearance_trace_nodes,
|
||||
"accessory_nodes": r.accessory_nodes,
|
||||
"face_track_nodes": r.face_track_nodes,
|
||||
"gaze_track_nodes": r.gaze_track_nodes,
|
||||
"lip_track_nodes": r.lip_track_nodes,
|
||||
"text_region_nodes": r.text_region_nodes,
|
||||
"appearance_trace_nodes": r.appearance_trace_nodes,
|
||||
"skin_tone_trace_nodes": r.skin_tone_trace_nodes,
|
||||
"accessory_nodes": r.accessory_nodes,
|
||||
"object_nodes": r.object_nodes,
|
||||
"hand_nodes": r.hand_nodes,
|
||||
"speaker_nodes": r.speaker_nodes,
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user