fix: VLM enrich handle nullable start_frame/end_frame

This commit is contained in:
Accusys
2026-08-25 16:41:37 +08:00
parent b5de4f6745
commit 771115b42b
+11 -5
View File
@@ -167,25 +167,31 @@ async fn enrich_vlm_from_pg(
"SELECT start_frame, end_frame, vlm_description FROM {tp_table} \
WHERE file_uuid = $1 AND trace_id = $2"
);
tracing::info!("[VLM-enrich] Query: {}, file_uuid={}, trace_id={}", query, file_uuid, trace_id);
let result = sqlx::query_as(&query)
.bind(file_uuid)
.bind(trace_id)
.fetch_all(db.pool())
.await;
tracing::info!("[VLM-enrich] Query result: {:?}", result.as_ref().map(|r| r.len()));
let rows: Vec<(i64, i64, Option<String>)> = result.ok()?;
let rows: Vec<(Option<i64>, Option<i64>, Option<String>)> = match result {
Ok(r) => r,
Err(e) => {
tracing::warn!("[VLM-enrich] Query failed: {}", e);
return None;
}
};
let (start_frame, end_frame, vlm_desc) = rows.into_iter().next()?;
let text = vlm_desc.unwrap_or_default();
let sf = start_frame.unwrap_or(0);
let ef = end_frame.unwrap_or(0);
Some(SearchResult {
id: 0,
file_uuid: Some(file_uuid.to_string()),
parent_id: 0,
scene_order: None,
start_frame,
end_frame,
start_frame: sf,
end_frame: ef,
fps: 0.0,
start_time: 0.0,
end_time: 0.0,