Expand temporal context window for SMS retrieval from ±2 days to ±4 days

This commit is contained in:
Cameron
2026-01-29 19:48:09 -05:00
parent 92a468233e
commit e92513fbe9
2 changed files with 11 additions and 11 deletions

View File

@@ -737,14 +737,14 @@ impl InsightGenerator {
let disable_rag_for_testing = false;
if disable_rag_for_testing {
log::warn!("RAG DISABLED FOR TESTING - Using only time-based retrieval (±2 days)");
log::warn!("RAG DISABLED FOR TESTING - Using only time-based retrieval (±4 days)");
// Skip directly to fallback
} else {
// ALWAYS use Strategy B: Expanded immediate context + historical RAG
// This is more reliable than pure semantic search which can match irrelevant messages
log::info!("Using expanded immediate context + historical RAG approach");
// Step 1: Get FULL immediate temporal context (±2 days, ALL messages)
// Step 1: Get FULL immediate temporal context (±4 days, ALL messages)
let immediate_messages = self
.sms_client
.fetch_messages_for_contact(contact.as_deref(), timestamp)
@@ -755,7 +755,7 @@ impl InsightGenerator {
});
log::info!(
"Fetched {} messages from ±2 days window (using ALL for immediate context)",
"Fetched {} messages from ±4 days window (using ALL for immediate context)",
immediate_messages.len()
);
@@ -813,7 +813,7 @@ impl InsightGenerator {
// Combine summaries
sms_summary = Some(format!(
"Immediate context (±2 days): {}\n\nSimilar moments from the past: {}",
"Immediate context (±4 days): {}\n\nSimilar moments from the past: {}",
immediate_summary, historical_summary
));
}
@@ -863,7 +863,7 @@ impl InsightGenerator {
// 6. Fallback to traditional time-based message retrieval if RAG didn't work
if !used_rag {
log::info!("Using traditional time-based message retrieval (±2 days)");
log::info!("Using traditional time-based message retrieval (±4 days)");
let sms_messages = self
.sms_client
.fetch_messages_for_contact(contact.as_deref(), timestamp)