feature/insights #46
@@ -611,17 +611,6 @@ impl InsightGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate AI insight for a single photo with optional custom model
|
|
||||||
/// (Deprecated: Use generate_insight_for_photo_with_config instead)
|
|
||||||
pub async fn generate_insight_for_photo_with_model(
|
|
||||||
&self,
|
|
||||||
file_path: &str,
|
|
||||||
custom_model: Option<String>,
|
|
||||||
) -> Result<()> {
|
|
||||||
self.generate_insight_for_photo_with_config(file_path, custom_model, None, None)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Generate AI insight for a single photo with custom configuration
|
/// Generate AI insight for a single photo with custom configuration
|
||||||
pub async fn generate_insight_for_photo_with_config(
|
pub async fn generate_insight_for_photo_with_config(
|
||||||
&self,
|
&self,
|
||||||
@@ -890,7 +879,7 @@ impl InsightGenerator {
|
|||||||
log::info!(
|
log::info!(
|
||||||
"Fetched {} SMS messages closest to {}",
|
"Fetched {} SMS messages closest to {}",
|
||||||
sms_messages.len(),
|
sms_messages.len(),
|
||||||
chrono::DateTime::from_timestamp(timestamp, 0)
|
DateTime::from_timestamp(timestamp, 0)
|
||||||
.map(|dt| dt.format("%Y-%m-%d %H:%M:%S").to_string())
|
.map(|dt| dt.format("%Y-%m-%d %H:%M:%S").to_string())
|
||||||
.unwrap_or_else(|| "unknown time".to_string())
|
.unwrap_or_else(|| "unknown time".to_string())
|
||||||
);
|
);
|
||||||
@@ -1109,43 +1098,6 @@ Return ONLY the comma-separated list, nothing else."#,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find relevant messages using RAG with topic-enriched query
|
|
||||||
async fn find_relevant_messages_rag_enriched(
|
|
||||||
&self,
|
|
||||||
date: chrono::NaiveDate,
|
|
||||||
contact: Option<&str>,
|
|
||||||
topics: &[String],
|
|
||||||
limit: usize,
|
|
||||||
) -> Result<Vec<String>> {
|
|
||||||
// Build enriched query from date + topics
|
|
||||||
let mut query_parts = Vec::new();
|
|
||||||
|
|
||||||
query_parts.push(format!("On {}", date.format("%B %d, %Y")));
|
|
||||||
|
|
||||||
if !topics.is_empty() {
|
|
||||||
query_parts.push(format!("about {}", topics.join(", ")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(c) = contact {
|
|
||||||
query_parts.push(format!("conversation with {}", c));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add day of week
|
|
||||||
let weekday = date.format("%A");
|
|
||||||
query_parts.push(format!("it was a {}", weekday));
|
|
||||||
|
|
||||||
let query = query_parts.join(", ");
|
|
||||||
|
|
||||||
log::info!("========================================");
|
|
||||||
log::info!("ENRICHED RAG QUERY: {}", query);
|
|
||||||
log::info!("Extracted topics: {:?}", topics);
|
|
||||||
log::info!("========================================");
|
|
||||||
|
|
||||||
// Use existing RAG method with enriched query
|
|
||||||
self.find_relevant_messages_rag(date, None, contact, None, limit)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Summarize pre-formatted message strings using LLM (concise version for historical context)
|
/// Summarize pre-formatted message strings using LLM (concise version for historical context)
|
||||||
async fn summarize_messages(
|
async fn summarize_messages(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
Reference in New Issue
Block a user