feat: add enrichment parameter to gather_search_context() replacing weak metadata query
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -512,13 +512,19 @@ impl InsightGenerator {
|
||||
timestamp: i64,
|
||||
location: Option<&str>,
|
||||
contact: Option<&str>,
|
||||
enrichment: Option<&str>,
|
||||
) -> Result<Option<String>> {
|
||||
let tracer = global_tracer();
|
||||
let span = tracer.start_with_context("ai.context.search", parent_cx);
|
||||
let search_cx = parent_cx.with_span(span);
|
||||
|
||||
// Build semantic query from metadata
|
||||
let query_text = format!(
|
||||
// Use enrichment (topics + photo description + tags) if available;
|
||||
// fall back to generic temporal query.
|
||||
let query_text = if let Some(enriched) = enrichment {
|
||||
enriched.to_string()
|
||||
} else {
|
||||
// Fallback: generic temporal query
|
||||
format!(
|
||||
"searches about {} {} {}",
|
||||
DateTime::from_timestamp(timestamp, 0)
|
||||
.map(|dt| dt.format("%B %Y").to_string())
|
||||
@@ -527,7 +533,8 @@ impl InsightGenerator {
|
||||
contact
|
||||
.map(|c| format!("involving {}", c))
|
||||
.unwrap_or_default()
|
||||
);
|
||||
)
|
||||
};
|
||||
|
||||
let query_embedding = match self.ollama.generate_embedding(&query_text).await {
|
||||
Ok(emb) => emb,
|
||||
@@ -948,6 +955,7 @@ impl InsightGenerator {
|
||||
timestamp,
|
||||
location.as_deref(),
|
||||
contact.as_deref(),
|
||||
None, // enrichment — wired up in Task 5
|
||||
)
|
||||
.await
|
||||
.ok()
|
||||
|
||||
Reference in New Issue
Block a user