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
chore: small optim + loggings
Louis Beaumont96dfce9ce5ec
diff --git a/screenpipe-audio/src/stt.rs b/screenpipe-audio/src/stt.rsindex e7a52dc22..2cd3151c2 100644--- a/screenpipe-audio/src/stt.rs+++ b/screenpipe-audio/src/stt.rs@@ -11,7 +11,7 @@ use rubato::{Resampler, SincFixedIn, SincInterpolationParameters, SincInterpolationType, WindowFunction,};-use crate::{pcm_decode::pcm_decode};+use crate::pcm_decode::pcm_decode;// TODO: improve model loading strategydiff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rsindex b22759856..81f163e86 100644--- a/screenpipe-server/src/server.rs+++ b/screenpipe-server/src/server.rs@@ -7,7 +7,7 @@ use axum::{};use chrono::{DateTime, Utc};-use log::info;+use log::{error, info};use serde::{Deserialize, Serialize};use serde_json::json;use std::{net::SocketAddr, sync::Arc};@@ -107,6 +107,14 @@ async fn search(JsonResponse<PaginatedResponse<ContentItem>>,(StatusCode, JsonResponse<serde_json::Value>),> {+ info!(+ "Received search request: query='{}', content_type={:?}, limit={}, offset={}",+ query.q.as_deref().unwrap_or(""),+ query.content_type,+ query.pagination.limit,+ query.pagination.offset+ );+let query_str = query.q.as_deref().unwrap_or("");let results = state.db@@ -118,6 +126,7 @@ async fn search().await.map_err(|e| {+ error!("Failed to search for content: {}", e);(StatusCode::INTERNAL_SERVER_ERROR,JsonResponse(json!({"error": format!("Failed to search for content: {}", e)})),@@ -129,12 +138,14 @@ async fn search(.count_search_results(query_str, query.content_type).await.map_err(|e| {+ error!("Failed to count search results: {}", e);(StatusCode::INTERNAL_SERVER_ERROR,JsonResponse(json!({"error": format!("Failed to count search results: {}", e)})),)})?;+ info!("Search completed: found {} results", total);Ok(JsonResponse(PaginatedResponse {data: results.into_iter().map(into_content_item).collect(),pagination: PaginationInfo {@@ -152,6 +163,11 @@ async fn get_by_date_range(JsonResponse<PaginatedResponse<ContentItem>>,(StatusCode, JsonResponse<serde_json::Value>),> {+ info!(+ "Received date range request: start_date={:?}, end_date={:?}, limit={}, offset={}",+ query.start_date, query.end_date, query.pagination.limit, query.pagination.offset+ );+let results = state.db.get_recent_results(@@ -162,6 +178,7 @@ async fn get_by_date_range().await.map_err(|e| {+ error!("Database error while fetching recent results: {}", e);(StatusCode::INTERNAL_SERVER_ERROR,JsonResponse(json!({"error": format!("Database error: {}", e)})),@@ -173,12 +190,14 @@ async fn get_by_date_range(.count_recent_results(query.start_date, query.end_date).await.map_err(|e| {+ error!("Database error while counting recent results: {}", e);(StatusCode::INTERNAL_SERVER_ERROR,JsonResponse(json!({"error": format!("Database error: {}", e)})),)})?;+ info!("Date range query completed: found {} results", total);Ok(JsonResponse(PaginatedResponse {data: results.into_iter().map(into_content_item).collect(),pagination: PaginationInfo {@@ -230,11 +249,21 @@ impl Server {info!("Starting server on {}", self.addr);- serve(+ match serve(TcpListener::bind(self.addr).await.unwrap(),app.into_make_service(),).await+ {+ Ok(_) => {+ info!("Server stopped gracefully");+ Ok(())+ }+ Err(e) => {+ error!("Server error: {}", e);+ Err(e)+ }+ }}}diff --git a/screenpipe-vision/src/core.rs b/screenpipe-vision/src/core.rsindex 79fee0465..56a6510c2 100644--- a/screenpipe-vision/src/core.rs+++ b/screenpipe-vision/src/core.rs@@ -16,7 +16,7 @@ pub enum ControlMessage {}pub struct CaptureResult {- pub image: DynamicImage,+ pub image: Arc<DynamicImage>,pub text: String,}@@ -27,7 +27,8 @@ pub fn continuous_capture(result_tx: Sender<CaptureResult>,interval: Duration,) {- let monitor = Monitor::all().unwrap().first().unwrap().clone();+ let monitors = Monitor::all().unwrap();+ let monitor = monitors.first().unwrap();let cpu_count = num_cpus::get();let pool_size = (cpu_count as f32 * 1.2) as usize;let pool_size = std::cmp::min(pool_size, MAX_THREADS);@@ -61,14 +62,13 @@ pub fn continuous_capture(// Clone necessary values for the OCR threadlet result_tx_clone = result_tx.clone();- let image_clone = image.clone();-+ let image_arc = Arc::new(image);// Perform OCR in a separate threadocr_pool.execute(move || {- let text = perform_ocr(&image_clone);+ let text = perform_ocr(&image_arc);result_tx_clone.send(CaptureResult {- image: image_clone,+ image: image_arc,text,}).unwrap();