feat: face fix deployment + trace_* regeneration + executor stderr filter fix

- swift_face.swift: frame rounding (.rounded()), conf 0.75, min_size 64
- trace_* directories regenerated for KOBA (37 traces, start_frame 5307)
- executor.rs: stderr filter now logs all non-empty stderr (was discarding)
- VAD not skippable in ASRX (main_fixed.py Step 2 always runs)
- Step 2.5 sentence boundary refinement added
- Cluster agent async endpoints + similarity transparency
- Keyword search: relationship text extraction, priority ordering
- Face fix handoff doc for Studio team
This commit is contained in:
Accusys
2026-08-05 00:13:50 +08:00
parent 36a704e3d3
commit 3d13a06bd9
42 changed files with 3447 additions and 778 deletions
+85 -67
View File
@@ -563,7 +563,12 @@ pub async fn exec_smart_search(
.filter(|s| !s.is_empty() && *s != "<nil>" && *s != "null");
let limit = args.get("limit").and_then(|v| v.as_i64()).unwrap_or(5) as i64;
tracing::info!("[smart_search] query='{}', file_uuid={:?}, limit={}", query, file_uuid, limit);
tracing::info!(
"[smart_search] query='{}', file_uuid={:?}, limit={}",
query,
file_uuid,
limit
);
let chunk_table = schema::table_name("chunk");
let videos = schema::table_name("videos");
@@ -619,7 +624,17 @@ pub async fn exec_smart_search(
let cards: Vec<serde_json::Value> = rows
.into_iter()
.map(
|(chunk_id, text_content, start_frame, end_frame, chunk_type, content, fuuid, file_name, fps)| {
|(
chunk_id,
text_content,
start_frame,
end_frame,
chunk_type,
content,
fuuid,
file_name,
fps,
)| {
let source = if let Some(ref c) = content {
let text = c.get("text").and_then(|t| t.as_str()).unwrap_or("");
let ocr_text = c.get("ocr_text").and_then(|t| t.as_str()).unwrap_or("");
@@ -641,8 +656,16 @@ pub async fn exec_smart_search(
.map(|t| t.chars().take(150).collect::<String>())
.unwrap_or_default();
let start_time = if fps > 0.0 { start_frame as f64 / fps } else { 0.0 };
let end_time = if fps > 0.0 { end_frame as f64 / fps } else { 0.0 };
let start_time = if fps > 0.0 {
start_frame as f64 / fps
} else {
0.0
};
let end_time = if fps > 0.0 {
end_frame as f64 / fps
} else {
0.0
};
serde_json::json!({
"card_type": "chunk",
@@ -667,7 +690,8 @@ pub async fn exec_smart_search(
"query": query,
"count": cards.len(),
"cards": cards
}).to_string())
})
.to_string())
}
pub async fn exec_identity_text(
@@ -1467,15 +1491,13 @@ pub async fn exec_trace_search(
})
.collect();
Ok(
serde_json::json!({
"tool": "trace_search",
"query": query,
"count": cards.len(),
"cards": cards
})
.to_string(),
)
Ok(serde_json::json!({
"tool": "trace_search",
"query": query,
"count": cards.len(),
"cards": cards
})
.to_string())
}
/// Semantic search using embedding + Qdrant
@@ -1495,7 +1517,12 @@ pub async fn exec_semantic_search(
.unwrap_or(10)
.min(50) as usize;
tracing::info!("[exec_semantic_search] query='{}', file_uuid={:?}, limit={}", query, file_uuid, limit);
tracing::info!(
"[exec_semantic_search] query='{}', file_uuid={:?}, limit={}",
query,
file_uuid,
limit
);
if query.is_empty() {
return Err("query is required".to_string());
@@ -1503,15 +1530,15 @@ pub async fn exec_semantic_search(
// Generate embedding
let embedder = Embedder::new("embeddinggemma-300m".to_string());
let embedding = embedder
.embed_query(query)
.await
.map_err(|e| {
tracing::error!("[exec_semantic_search] Embedding failed: {}", e);
format!("Embedding failed: {}", e)
})?;
let embedding = embedder.embed_query(query).await.map_err(|e| {
tracing::error!("[exec_semantic_search] Embedding failed: {}", e);
format!("Embedding failed: {}", e)
})?;
tracing::info!("[exec_semantic_search] Embedding generated, dim={}", embedding.len());
tracing::info!(
"[exec_semantic_search] Embedding generated, dim={}",
embedding.len()
);
// Search Qdrant
let qdrant = QdrantDb::new();
@@ -1526,16 +1553,16 @@ pub async fn exec_semantic_search(
})?
} else {
tracing::info!("[exec_semantic_search] Searching all collections");
qdrant
.search(&embedding, limit)
.await
.map_err(|e| {
tracing::error!("[exec_semantic_search] Qdrant search failed: {}", e);
format!("Qdrant search failed: {}", e)
})?
qdrant.search(&embedding, limit).await.map_err(|e| {
tracing::error!("[exec_semantic_search] Qdrant search failed: {}", e);
format!("Qdrant search failed: {}", e)
})?
};
tracing::info!("[exec_semantic_search] Qdrant returned {} hits", search_results.len());
tracing::info!(
"[exec_semantic_search] Qdrant returned {} hits",
search_results.len()
);
// Enrich from PostgreSQL
let chunk_table = schema::table_name("chunk");
@@ -1543,29 +1570,24 @@ pub async fn exec_semantic_search(
let mut cards = Vec::new();
for hit in search_results.iter() {
let row: Option<(
String,
String,
f64,
f64,
f64,
Option<String>,
String,
)> = sqlx::query_as(&format!(
"SELECT c.chunk_id, c.chunk_type, c.start_time, c.end_time, c.fps, \
let row: Option<(String, String, f64, f64, f64, Option<String>, String)> =
sqlx::query_as(&format!(
"SELECT c.chunk_id, c.chunk_type, c.start_time, c.end_time, c.fps, \
c.text_content, v.file_name \
FROM {} c \
JOIN {} v ON v.file_uuid = c.file_uuid \
WHERE c.file_uuid = $1 AND c.chunk_id = $2",
chunk_table, videos
))
.bind(&hit.uuid)
.bind(&hit.chunk_id)
.fetch_optional(pool)
.await
.map_err(|e| format!("PG query failed: {}", e))?;
chunk_table, videos
))
.bind(&hit.uuid)
.bind(&hit.chunk_id)
.fetch_optional(pool)
.await
.map_err(|e| format!("PG query failed: {}", e))?;
if let Some((chunk_id, chunk_type, start_time, end_time, fps, text_content, file_name)) = row {
if let Some((chunk_id, chunk_type, start_time, end_time, fps, text_content, file_name)) =
row
{
let start_frame = (start_time * fps) as i64;
let end_frame = (end_time * fps) as i64;
let text_preview = text_content
@@ -1590,15 +1612,13 @@ pub async fn exec_semantic_search(
}
}
Ok(
serde_json::json!({
"tool": "semantic_search",
"query": query,
"count": cards.len(),
"cards": cards
})
.to_string(),
)
Ok(serde_json::json!({
"tool": "semantic_search",
"query": query,
"count": cards.len(),
"cards": cards
})
.to_string())
}
/// Search named face profiles by name — finds face_track TKG nodes whose label
@@ -1685,13 +1705,11 @@ pub async fn exec_face_profile_search(
})
.collect();
Ok(
serde_json::json!({
"tool": "face_profile_search",
"query": name,
"count": cards.len(),
"cards": cards
})
.to_string(),
)
Ok(serde_json::json!({
"tool": "face_profile_search",
"query": name,
"count": cards.len(),
"cards": cards
})
.to_string())
}