feat: P5 VLM Summary pipeline integration + trace_profile vlm_summary field

- Add src/core/processor/vlm_summary.rs: VLM + Embedding pipeline stage
  * Reads key_frame.jpg → Ollama llava:7b → vlm_description
  * Writes DB (vlm_description, vlm_model, vlm_embedding) + on-disk JSON
  * EmbeddingGemma → Qdrant upsert (chunk_type=vlm_summary)
  * Non-blocking: errors logged, does not prevent job completion
  * Redis progress tracking: vlm_summary stage N/M traces

- Add src/bin/backfill_trace_vlm.rs: manual backfill binary
  * Supports --file-uuid, --force, --limit flags
  * Concurrency: 2 parallel VLM calls

- Add vlm_embedding JSONB column to trace_profiles (schema + migration)
- Add vlm_summary field to FaceTraceProfile struct
- Add P5 trigger in job_worker.rs (has_face + no-face paths)
- Add VLM monitoring to ingestion_complete() (non-blocking)
- Update .env / .env.development: VISION_URL → Ollama 11434
This commit is contained in:
Accusys
2026-08-22 09:52:04 +08:00
parent 6d7b477b31
commit 476a31ecc6
8 changed files with 800 additions and 174 deletions
+5 -3
View File
@@ -399,6 +399,8 @@ pub struct FaceTraceProfile {
pub key_frame: Option<String>, // filename: key_frame.jpg
pub key_face: Option<String>, // filename: key_face.jpg
pub status: String, // pending / bound / merged
#[serde(default)]
pub vlm_summary: Option<String>, // VLM free-text summary of key_frame
}
/// Recursively round float numbers in a JSON value to 2 decimal places.
@@ -477,6 +479,7 @@ impl FaceTraceProfile {
key_frame: None,
key_face: None,
status: "pending".to_string(),
vlm_summary: None,
}
}
@@ -515,9 +518,8 @@ impl FaceTraceProfile {
}
// Write trace_profile.json
let json =
serde_json::to_string_pretty(&round_json_value(&serde_json::to_value(&*self)?))
.context("Failed to serialize FaceTraceProfile")?;
let json = serde_json::to_string_pretty(&round_json_value(&serde_json::to_value(&*self)?))
.context("Failed to serialize FaceTraceProfile")?;
let profile_path = Self::profile_path(output_dir, &self.file_uuid, self.trace_id);
std::fs::write(&profile_path, json)
.with_context(|| format!("Failed to write {}", profile_path.display()))?;