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
feat: add device_name in frame table and search query return (#1751)
Divanshu Groverc3f9b9c623ba
diff --git a/screenpipe-db/src/db.rs b/screenpipe-db/src/db.rsindex 978f07cd8..00b9260ec 100644--- a/screenpipe-db/src/db.rs+++ b/screenpipe-db/src/db.rs@@ -341,7 +341,7 @@ impl DatabaseManager {// Insert the new frame with file_path as name and app/window metadatalet id = sqlx::query(- "INSERT INTO frames (video_chunk_id, offset_index, timestamp, name, browser_url, app_name, window_name, focused) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)",+ "INSERT INTO frames (video_chunk_id, offset_index, timestamp, name, browser_url, app_name, window_name, focused, device_name) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)",).bind(video_chunk_id).bind(offset_index)@@ -351,6 +351,7 @@ impl DatabaseManager {.bind(app_name).bind(window_name).bind(focused)+ .bind(device_name).execute(&mut *tx).await?.last_insert_rowid();@@ -714,6 +715,7 @@ impl DatabaseManager {frames.app_name,ocr_text.ocr_engine,frames.window_name,+ video_chunks.device_name,GROUP_CONCAT(tags.name, ',') as tags,frames.browser_url,frames.focused@@ -792,6 +794,7 @@ impl DatabaseManager {app_name: raw.app_name,ocr_engine: raw.ocr_engine,window_name: raw.window_name,+ device_name: raw.device_name,tags: raw.tags.map(|t| t.split(',').map(String::from).collect())@@ -2092,6 +2095,7 @@ impl DatabaseManager {ocr_engine: raw.ocr_engine,window_name: raw.window_name,frame_name: raw.frame_name,+ device_name: raw.device_name,tags: raw.tags.map(|t| t.split(',').map(String::from).collect())diff --git a/screenpipe-db/src/migrations/20250131232938_add_device_name_to_frame.sql b/screenpipe-db/src/migrations/20250131232938_add_device_name_to_frame.sqlnew file mode 100644index 000000000..ce2c4634a--- /dev/null+++ b/screenpipe-db/src/migrations/20250131232938_add_device_name_to_frame.sql@@ -0,0 +1,2 @@+-- Add migration script here+ALTER TABLE frames ADD COLUMN device_name TEXT NOT NULL DEFAULT '';\ No newline at end of filediff --git a/screenpipe-db/src/types.rs b/screenpipe-db/src/types.rsindex 6aadba36c..b2faff261 100644--- a/screenpipe-db/src/types.rs+++ b/screenpipe-db/src/types.rs@@ -46,6 +46,7 @@ pub struct OCRResultRaw {pub tags: Option<String>,pub browser_url: Option<String>,pub focused: Option<bool>,+ pub device_name: String,}#[derive(OaSchema, Debug, Serialize, Deserialize)]@@ -63,6 +64,7 @@ pub struct OCRResult {pub tags: Vec<String>,pub browser_url: Option<String>,pub focused: Option<bool>,+ pub device_name: String,}#[derive(OaSchema, Debug, Deserialize, PartialEq, Default, Clone)]diff --git a/screenpipe-js/common/types.ts b/screenpipe-js/common/types.tsindex d632f7267..43717b201 100644--- a/screenpipe-js/common/types.ts+++ b/screenpipe-js/common/types.ts@@ -75,6 +75,7 @@ export interface OCRContent {frameName?: string;browserUrl?: string;focused?: boolean;+ deviceName: string;}/**diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rsindex e8c727e4d..6125355af 100644--- a/screenpipe-server/src/server.rs+++ b/screenpipe-server/src/server.rs@@ -209,6 +209,7 @@ pub struct OCRContent {pub frame_name: Option<String>,pub browser_url: Option<String>,pub focused: Option<bool>,+ pub device_name: String,}#[derive(OaSchema, Serialize, Deserialize, Debug)]@@ -386,6 +387,7 @@ pub(crate) async fn search(frame_name: Some(ocr.frame_name.clone()),browser_url: ocr.browser_url.clone(),focused: ocr.focused,+ device_name: ocr.device_name.clone(),}),SearchResult::Audio(audio) => ContentItem::Audio(AudioContent {chunk_id: audio.audio_chunk_id,