feat: smart search response includes start_frame/end_frame/fps, add limit param
This commit is contained in:
+3
-3
@@ -101,9 +101,9 @@ pub async fn smart_search(
|
||||
id: 0,
|
||||
parent_id: p.scene_order,
|
||||
scene_order: Some(p.scene_order),
|
||||
start_frame: 0,
|
||||
end_frame: 0,
|
||||
fps: 0.0,
|
||||
start_frame: p.start_frame,
|
||||
end_frame: p.end_frame,
|
||||
fps: p.fps,
|
||||
start_time: p.start_time,
|
||||
end_time: p.end_time,
|
||||
raw_text: None,
|
||||
|
||||
@@ -759,6 +759,9 @@ pub struct PostgresCache {
|
||||
pub struct SemanticSearchResult {
|
||||
pub id: i32,
|
||||
pub scene_order: i32,
|
||||
pub start_frame: i64,
|
||||
pub end_frame: i64,
|
||||
pub fps: f64,
|
||||
pub start_time: f64,
|
||||
pub end_time: f64,
|
||||
pub summary: String,
|
||||
@@ -2000,11 +2003,13 @@ impl PostgresDb {
|
||||
let results = sqlx::query_as::<_, SemanticSearchResult>(
|
||||
&format!(
|
||||
"SELECT \
|
||||
id, id as scene_order, start_time, end_time, \
|
||||
COALESCE(summary_text, text_content, '') as summary, \
|
||||
metadata, \
|
||||
(1 - (embedding <=> $1::vector)) as similarity \
|
||||
FROM {} \
|
||||
id, id as scene_order, \
|
||||
(start_time * fps)::bigint as start_frame, (end_time * fps)::bigint as end_frame, \
|
||||
fps, start_time, end_time, \
|
||||
COALESCE(summary_text, text_content, '') as summary, \
|
||||
metadata, \
|
||||
(1 - (embedding <=> $1::vector)) as similarity \
|
||||
FROM {} \
|
||||
WHERE file_uuid = $2 AND chunk_type IN ('story_parent', 'llm_parent') AND embedding IS NOT NULL \
|
||||
ORDER BY embedding <=> $1::vector \
|
||||
LIMIT $3",
|
||||
|
||||
Reference in New Issue
Block a user