fix: agent_search tool descriptions + HAND_OBJECT casing + rule2 edge types
- agent_search.rs: text_region -> text_trace, removed skin_tone_trace (never built, misleading LLM agents) - tkg.rs + scan.rs: hand_object -> HAND_OBJECT for consistency with all other edge types (CO_OCCURS_WITH, SPEAKS_AS, etc.) - rule2_ingest.rs: added LIP_SYNC and HAND_OBJECT to edge_type priority list so these edges generate relationship chunks
This commit is contained in:
@@ -247,10 +247,10 @@ fn make_tools(pool: &sqlx::PgPool) -> Vec<ToolDef> {
|
|||||||
),
|
),
|
||||||
function_calling::make_tool(
|
function_calling::make_tool(
|
||||||
"tkg_nodes_query",
|
"tkg_nodes_query",
|
||||||
"查詢 TKG 知識圖譜的節點列表。可依照節點類型篩選(face_track, gaze_track, lip_track, text_region, appearance_trace, skin_tone_trace, object, speaker)。適合查詢影片中有多少人物軌跡、文字片段等。",
|
"查詢 TKG 知識圖譜的節點列表。可依照節點類型篩選(face_track, gaze_track, lip_track, text_trace, appearance_trace, object, speaker)。適合查詢影片中有多少人物軌跡、文字片段等。",
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"file_uuid": {"type": "string", "description": "影片 UUID"},
|
"file_uuid": {"type": "string", "description": "影片 UUID"},
|
||||||
"node_type": {"type": "string", "description": "節點類型(可選): face_track, gaze_track, lip_track, text_region, appearance_trace, skin_tone_trace, object, speaker"},
|
"node_type": {"type": "string", "description": "節點類型(可選): face_track, gaze_track, lip_track, text_trace, appearance_trace, object, speaker"},
|
||||||
"page": {"type": "integer", "default": 1},
|
"page": {"type": "integer", "default": 1},
|
||||||
"page_size": {"type": "integer", "default": 20}
|
"page_size": {"type": "integer", "default": 20}
|
||||||
}),
|
}),
|
||||||
|
|||||||
+2
-2
@@ -566,7 +566,7 @@ async fn get_ingestion_status(
|
|||||||
let lip_sync_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'LIP_SYNC'"));
|
let lip_sync_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'LIP_SYNC'"));
|
||||||
let has_appearance_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'HAS_APPEARANCE'"));
|
let has_appearance_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'HAS_APPEARANCE'"));
|
||||||
let wears_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'WEARS'"));
|
let wears_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'WEARS'"));
|
||||||
let hand_object_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'hand_object'"));
|
let hand_object_edges: i64 = count_sql!(&format!("SELECT COUNT(*) FROM {tkg_edges_table} WHERE file_uuid = '{file_uuid}' AND edge_type = 'HAND_OBJECT'"));
|
||||||
|
|
||||||
// Rule 2 relationship chunks
|
// Rule 2 relationship chunks
|
||||||
let rule2_chunks = count_sql!(&format!(
|
let rule2_chunks = count_sql!(&format!(
|
||||||
@@ -1026,7 +1026,7 @@ async fn get_file_stats(
|
|||||||
has_appearance_edges: count_edges(pool, &tkg_edges_table, &file_uuid, "HAS_APPEARANCE")
|
has_appearance_edges: count_edges(pool, &tkg_edges_table, &file_uuid, "HAS_APPEARANCE")
|
||||||
.await,
|
.await,
|
||||||
wears_edges: count_edges(pool, &tkg_edges_table, &file_uuid, "WEARS").await,
|
wears_edges: count_edges(pool, &tkg_edges_table, &file_uuid, "WEARS").await,
|
||||||
hand_object_edges: count_edges(pool, &tkg_edges_table, &file_uuid, "hand_object").await,
|
hand_object_edges: count_edges(pool, &tkg_edges_table, &file_uuid, "HAND_OBJECT").await,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,10 @@ pub async fn ingest_rule2(
|
|||||||
"SPEAKS_AS",
|
"SPEAKS_AS",
|
||||||
"MUTUAL_GAZE",
|
"MUTUAL_GAZE",
|
||||||
"CO_OCCURS_WITH",
|
"CO_OCCURS_WITH",
|
||||||
|
"LIP_SYNC",
|
||||||
"HAS_APPEARANCE",
|
"HAS_APPEARANCE",
|
||||||
"WEARS",
|
"WEARS",
|
||||||
|
"HAND_OBJECT",
|
||||||
];
|
];
|
||||||
let total_types = edge_types.len();
|
let total_types = edge_types.len();
|
||||||
|
|
||||||
|
|||||||
@@ -2930,7 +2930,7 @@ async fn build_hand_object_edges(
|
|||||||
"#,
|
"#,
|
||||||
edges_table
|
edges_table
|
||||||
))
|
))
|
||||||
.bind("hand_object")
|
.bind("HAND_OBJECT")
|
||||||
.bind(hand_id)
|
.bind(hand_id)
|
||||||
.bind(obj_id)
|
.bind(obj_id)
|
||||||
.bind(file_uuid)
|
.bind(file_uuid)
|
||||||
|
|||||||
Reference in New Issue
Block a user