use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MultimodalRef {
Screenshot {
path: PathBuf,
timestamp: DateTime<Utc>,
description: String,
dimensions: (u32, u32),
},
InteractionTrace {
trace_id: String,
action_count: usize,
summary: String,
duration_ms: u64,
},
SpatialLayout {
description: String,
element_positions: Vec<(String, f64, f64)>,
hierarchy: Vec<(String, Vec<String>)>,
},
EmbeddingRef {
collection: String,
chunk_id: String,
similarity: f32,
},
TemporalPattern {
description: String,
event_times: Vec<DateTime<Utc>>,
intervals_ms: Vec<u64>,
},
}
impl MultimodalRef {
pub fn type_name(&self) -> &'static str {
match self {
Self::Screenshot { .. } => "screenshot",
Self::InteractionTrace { .. } => "interaction_trace",
Self::SpatialLayout { .. } => "spatial_layout",
Self::EmbeddingRef { .. } => "embedding_ref",
Self::TemporalPattern { .. } => "temporal_pattern",
}
}
pub fn description(&self) -> &str {
match self {
Self::Screenshot { description, .. } => description,
Self::InteractionTrace { summary, .. } => summary,
Self::SpatialLayout { description, .. } => description,
Self::EmbeddingRef { collection, .. } => collection,
Self::TemporalPattern { description, .. } => description,
}
}
pub fn has_file_dependency(&self) -> bool {
matches!(self, Self::Screenshot { .. })
}
pub fn file_path(&self) -> Option<&PathBuf> {
match self {
Self::Screenshot { path, .. } => Some(path),
_ => None,
}
}
}
#[cfg(test)]
#[path = "../../tests/unit/consolidation/multimodal/multimodal_test.rs"]
mod tests;