YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: reconciled audio now appears on timeline
Louis Beaumont2e35988df7ba
diff --git a/crates/screenpipe-audio/src/audio_manager/manager.rs b/crates/screenpipe-audio/src/audio_manager/manager.rsindex 329525c77..db221cd25 100644--- a/crates/screenpipe-audio/src/audio_manager/manager.rs+++ b/crates/screenpipe-audio/src/audio_manager/manager.rs@@ -158,13 +158,14 @@ impl AudioManager {if self.options.read().await.transcription_mode == TranscriptionMode::Batch {let db = self.db.clone();let engine_ref = self.engine.clone();+ let on_insert_bg = self.on_transcription_insert.clone();tokio::spawn(async move {// Wait for model to load + initial recordingstokio::time::sleep(Duration::from_secs(120)).await;loop {if let Some(ref engine) = *engine_ref.read().await {let count = super::reconciliation::reconcile_untranscribed(- &db, engine,+ &db, engine, on_insert_bg.as_ref(),).await;if count > 0 {@@ -385,6 +386,7 @@ impl AudioManager {let meeting_detector = self.meeting_detector.clone();let db = self.db.clone();let shared_engine = self.engine.clone();+ let on_insert_session = self.on_transcription_insert.clone();// Build unified transcription engine — only loads the needed modellet engine = TranscriptionEngine::new(@@ -467,6 +469,7 @@ impl AudioManager {let count = super::reconciliation::reconcile_untranscribed(&db,&engine,+ on_insert_session.as_ref(),).await;info!("batch mode: transcribed {} chunks after session end", count);diff --git a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs b/crates/screenpipe-audio/src/audio_manager/reconciliation.rsindex 142f7b71d..cb2afc7e5 100644--- a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs+++ b/crates/screenpipe-audio/src/audio_manager/reconciliation.rs@@ -8,6 +8,7 @@ use screenpipe_db::{DatabaseManager, UntranscribedChunk};use tracing::{debug, error, warn};use crate::transcription::engine::TranscriptionEngine;+use crate::transcription::{AudioInsertCallback, AudioInsertInfo};use crate::utils::ffmpeg::read_audio_from_file;/// Maximum number of consecutive 30s chunks to concatenate into a single batch.@@ -24,6 +25,7 @@ const MAX_BATCH_CHUNKS: usize = 10;pub async fn reconcile_untranscribed(db: &DatabaseManager,engine: &TranscriptionEngine,+ on_insert: Option<&AudioInsertCallback>,) -> usize {let since = chrono::Utc::now() - chrono::Duration::hours(24);let chunks = match db.get_untranscribed_chunks(since, 50).await {@@ -159,6 +161,23 @@ pub async fn reconcile_untranscribed(}success_count += 1;+ // Notify hot frame cache so reconciled audio appears on the timeline+ if let Some(callback) = on_insert {+ let capture_ts = primary_chunk.timestamp.timestamp() as u64;+ callback(AudioInsertInfo {+ audio_chunk_id: primary_chunk.id,+ transcription: full_text.clone(),+ device_name: device_name.clone(),+ is_input,+ audio_file_path: primary_chunk.file_path.clone(),+ duration_secs: batch_duration,+ start_time: Some(0.0),+ end_time: Some(batch_duration),+ speaker_id: None,+ capture_timestamp: capture_ts,+ });+ }+// Delete the secondary chunks — they're now merged into the primary.for chunk in &valid_chunks[1..] {if let Err(e) = db.delete_audio_chunk(chunk.id).await {