feat: only run identity agent if file has seed identities

Identity agent now checks Qdrant _seeds collection for the file's
seed identity photos before running. If no seeds exist, the agent
is skipped to avoid unnecessary processing.

Flow:
1. Job completes (Face + ASRX done)
2. Check Qdrant _seeds for file_uuid
3. If seeds exist → run identity agent
4. If no seeds → skip identity agent
This commit is contained in:
Accusys
2026-07-05 22:22:22 +08:00
parent 0b82aa875c
commit 5a3f791ecd

View File

@@ -1786,9 +1786,32 @@ impl JobWorker {
}); });
} }
// 🚀 P3 Trigger: Identity Agent (Face + ASRX) // 🚀 P3 Trigger: Identity Agent (Face + ASRX + has seed identities)
if has_face && has_asrx { if has_face && has_asrx {
info!("📝 Prerequisites met for Identity Agent. Starting analysis..."); // Check if file has seed identity photos in Qdrant _seeds collection
let has_seeds = {
use crate::core::db::qdrant_db::QdrantDb;
let qdrant = QdrantDb::new();
let schema = std::env::var("DATABASE_SCHEMA").unwrap_or_else(|_| "dev".to_string());
let seeds_collection = if schema == "public" {
"momentry_public_seeds"
} else {
&format!("momentry_{}_seeds", schema)
};
let filter = serde_json::json!({
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
});
match qdrant.scroll_all_points("_seeds", filter, 1).await {
Ok(points) => !points.is_empty(),
Err(e) => {
warn!("Failed to check _seeds for {}: {}", uuid, e);
false
}
}
};
if has_seeds {
info!("📝 Prerequisites met for Identity Agent (has seeds). Starting analysis...");
let db_clone = self.db.clone(); let db_clone = self.db.clone();
let redis_clone = self.redis.clone(); let redis_clone = self.redis.clone();
let uuid_clone = uuid.to_string(); let uuid_clone = uuid.to_string();
@@ -1803,6 +1826,9 @@ impl JobWorker {
Err(e) => error!("❌ Identity Agent failed for {}: {}", uuid_clone, e), Err(e) => error!("❌ Identity Agent failed for {}: {}", uuid_clone, e),
} }
}); });
} else {
info!("📝 Skipping Identity Agent for {} (no seed identities)", uuid);
}
} }
// 🚀 P4 Trigger: TKG Build (Face + ASRX) → then Rule2 ingestion // 🚀 P4 Trigger: TKG Build (Face + ASRX) → then Rule2 ingestion