feat: Rule 3 moment chunks — 10s windows with 1-2 key frames

- Add ChunkType::Moment to types.rs
- Add moment_interval to FileProfile (configurable, default 10s)
- Create rule3_moment.rs: reads trace_profile.json, groups by time window,
  selects 1-2 diverse key frames using Jaccard similarity on VLM text
- Embed moment chunks into Qdrant using trace VLM embeddings
- Wire into worker: triggers after VLM completes, blocks job completion
- Add moment_chunks progress stage (weight: 0.01)
This commit is contained in:
Accusys
2026-08-26 02:37:47 +08:00
parent 8732c3e0a4
commit 20f5974b52
7 changed files with 440 additions and 6 deletions
+10
View File
@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use crate::core::chunk::rule1_ingest;
use crate::core::chunk::rule3_moment;
use crate::core::config;
use crate::core::db::postgres_db::PostgresDb;
use crate::core::db::qdrant_db::QdrantDb;
@@ -74,6 +75,15 @@ pub async fn execute_rule1(db: &PostgresDb, uuid: &str) -> Result<usize> {
Ok(count)
}
pub async fn execute_rule3_moment(db: &PostgresDb, uuid: &str) -> Result<usize> {
let count = rule3_moment::execute_rule3_moment(db, uuid)
.await
.context("Rule 3 moment chunks failed")?;
println!("Rule 3 completed: {} moment chunks for {}", count, uuid);
Ok(count)
}
pub async fn vectorize_chunks(uuid: &str) -> Result<()> {
let db = PostgresDb::new(&config::DATABASE_URL).await?;
let qdrant = QdrantDb::new();