feature/insights #46

Merged
cameron merged 25 commits from feature/insights into master 2026-01-15 01:07:59 +00:00
5 changed files with 8 additions and 21 deletions
Showing only changes of commit e31d5716b6 - Show all commits

View File

@@ -1,5 +1,4 @@
use anyhow::Result; use anyhow::Result;
use chrono::NaiveDate;
use reqwest::Client; use reqwest::Client;
use serde::Deserialize; use serde::Deserialize;
@@ -21,21 +20,6 @@ impl SmsApiClient {
} }
} }
pub async fn fetch_messages_for_date(&self, date: NaiveDate) -> Result<Vec<SmsMessage>> {
// Calculate date range (midnight to midnight in local time)
let start = date
.and_hms_opt(0, 0, 0)
.ok_or_else(|| anyhow::anyhow!("Invalid start time"))?;
let end = date
.and_hms_opt(23, 59, 59)
.ok_or_else(|| anyhow::anyhow!("Invalid end time"))?;
let start_ts = start.and_utc().timestamp();
let end_ts = end.and_utc().timestamp();
self.fetch_messages(start_ts, end_ts, None, None).await
}
/// Fetch messages for a specific contact within ±1 day of the given timestamp /// Fetch messages for a specific contact within ±1 day of the given timestamp
/// Falls back to all contacts if no messages found for the specific contact /// Falls back to all contacts if no messages found for the specific contact
/// Messages are sorted by proximity to the center timestamp /// Messages are sorted by proximity to the center timestamp

View File

@@ -35,16 +35,19 @@ pub fn is_media_file(path: &Path) -> bool {
} }
/// Check if a DirEntry is an image file (for walkdir usage) /// Check if a DirEntry is an image file (for walkdir usage)
#[allow(dead_code)]
pub fn direntry_is_image(entry: &DirEntry) -> bool { pub fn direntry_is_image(entry: &DirEntry) -> bool {
is_image_file(entry.path()) is_image_file(entry.path())
} }
/// Check if a DirEntry is a video file (for walkdir usage) /// Check if a DirEntry is a video file (for walkdir usage)
#[allow(dead_code)]
pub fn direntry_is_video(entry: &DirEntry) -> bool { pub fn direntry_is_video(entry: &DirEntry) -> bool {
is_video_file(entry.path()) is_video_file(entry.path())
} }
/// Check if a DirEntry is a media file (for walkdir usage) /// Check if a DirEntry is a media file (for walkdir usage)
#[allow(dead_code)]
pub fn direntry_is_media(entry: &DirEntry) -> bool { pub fn direntry_is_media(entry: &DirEntry) -> bool {
is_media_file(entry.path()) is_media_file(entry.path())
} }

View File

@@ -20,7 +20,6 @@ pub struct AppState {
pub ollama: OllamaClient, pub ollama: OllamaClient,
pub sms_client: SmsApiClient, pub sms_client: SmsApiClient,
pub insight_generator: InsightGenerator, pub insight_generator: InsightGenerator,
pub insight_dao: Arc<Mutex<Box<dyn InsightDao>>>,
} }
impl AppState { impl AppState {
@@ -34,7 +33,6 @@ impl AppState {
ollama: OllamaClient, ollama: OllamaClient,
sms_client: SmsApiClient, sms_client: SmsApiClient,
insight_generator: InsightGenerator, insight_generator: InsightGenerator,
insight_dao: Arc<Mutex<Box<dyn InsightDao>>>,
) -> Self { ) -> Self {
let playlist_generator = PlaylistGenerator::new(); let playlist_generator = PlaylistGenerator::new();
let video_playlist_manager = let video_playlist_manager =
@@ -51,7 +49,6 @@ impl AppState {
ollama, ollama,
sms_client, sms_client,
insight_generator, insight_generator,
insight_dao,
} }
} }
@@ -132,7 +129,6 @@ impl Default for AppState {
ollama, ollama,
sms_client, sms_client,
insight_generator, insight_generator,
insight_dao,
) )
} }
} }
@@ -201,7 +197,6 @@ impl AppState {
ollama, ollama,
sms_client, sms_client,
insight_generator, insight_generator,
insight_dao,
) )
} }
} }

View File

@@ -260,9 +260,13 @@ pub struct InsertTaggedPhoto {
#[derive(Queryable, Clone, Debug)] #[derive(Queryable, Clone, Debug)]
pub struct TaggedPhoto { pub struct TaggedPhoto {
#[allow(dead_code)] // Part of API contract
pub id: i32, pub id: i32,
#[allow(dead_code)] // Part of API contract
pub photo_name: String, pub photo_name: String,
#[allow(dead_code)] // Part of API contract
pub tag_id: i32, pub tag_id: i32,
#[allow(dead_code)] // Part of API contract
pub created_time: i64, pub created_time: i64,
} }

View File

@@ -10,6 +10,7 @@ use walkdir::WalkDir;
pub mod actors; pub mod actors;
pub mod ffmpeg; pub mod ffmpeg;
#[allow(dead_code)]
pub async fn generate_video_gifs() { pub async fn generate_video_gifs() {
tokio::spawn(async { tokio::spawn(async {
info!("Starting to make video gifs"); info!("Starting to make video gifs");