insight-chat: add get_faces_in_photo agentic tool
The LLM had no path to see face_detections data — get_file_tags returns user-applied tags, but a face that's been detected and bound to a person via the embedding-cluster auto-bind path doesn't always have a matching tag. The new tool joins face_detections with persons by content_hash and returns bound names + bboxes, plus unidentified faces (so smaller models can count people in the photo without inferring from a visual description). Gated on face_detections being non-empty via the same has_any_* pattern as daily_summaries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::ai::apollo_client::ApolloClient;
|
||||
use crate::ai::face_client::FaceClient;
|
||||
use crate::faces;
|
||||
use crate::ai::insight_chat::{ChatLockMap, InsightChatService};
|
||||
use crate::ai::openrouter::OpenRouterClient;
|
||||
use crate::ai::{InsightGenerator, OllamaClient, SmsApiClient};
|
||||
@@ -206,6 +207,8 @@ impl Default for AppState {
|
||||
Arc::new(Mutex::new(Box::new(SqliteTagDao::default())));
|
||||
let knowledge_dao: Arc<Mutex<Box<dyn KnowledgeDao>>> =
|
||||
Arc::new(Mutex::new(Box::new(SqliteKnowledgeDao::new())));
|
||||
let face_dao: Arc<Mutex<Box<dyn faces::FaceDao>>> =
|
||||
Arc::new(Mutex::new(Box::new(faces::SqliteFaceDao::new())));
|
||||
|
||||
// Load base path and ensure the primary library row reflects it.
|
||||
let base_path = env::var("BASE_PATH").expect("BASE_PATH was not set in the env");
|
||||
@@ -232,6 +235,7 @@ impl Default for AppState {
|
||||
search_dao.clone(),
|
||||
tag_dao.clone(),
|
||||
knowledge_dao,
|
||||
face_dao.clone(),
|
||||
libraries_vec.clone(),
|
||||
);
|
||||
|
||||
@@ -348,6 +352,8 @@ impl AppState {
|
||||
Arc::new(Mutex::new(Box::new(SqliteTagDao::default())));
|
||||
let knowledge_dao: Arc<Mutex<Box<dyn KnowledgeDao>>> =
|
||||
Arc::new(Mutex::new(Box::new(SqliteKnowledgeDao::new())));
|
||||
let face_dao: Arc<Mutex<Box<dyn faces::FaceDao>>> =
|
||||
Arc::new(Mutex::new(Box::new(faces::SqliteFaceDao::new())));
|
||||
|
||||
// Initialize test InsightGenerator with all data sources
|
||||
let base_path_str = base_path.to_string_lossy().to_string();
|
||||
@@ -371,6 +377,7 @@ impl AppState {
|
||||
search_dao.clone(),
|
||||
tag_dao.clone(),
|
||||
knowledge_dao,
|
||||
face_dao.clone(),
|
||||
vec![test_lib],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user