Skip to content

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

release-app make real time vision disabled by default as it is leaking memory

Louis Beaumontd12d0d5932f6
diff --git a/screenpipe-app-tauri/components/settings/recording-settings.tsx b/screenpipe-app-tauri/components/settings/recording-settings.tsx
index 374314145..7b0e25c51 100644
--- a/screenpipe-app-tauri/components/settings/recording-settings.tsx
+++ b/screenpipe-app-tauri/components/settings/recording-settings.tsx
@@ -702,6 +702,39 @@ export function RecordingSettings() {
{!settings.disableVision && (
<>
+ <div className="flex items-center justify-between">
+ <div className="space-y-1">
+ <h4 className="font-medium">
+ enable realtime vision processing
+ </h4>
+ <p className="text-sm text-muted-foreground">
+ stream screen content in real-time (dev preview) -{" "}
+ <a
+ href="https://github.com/mediar-ai/screenpipe/tree/main/screenpipe-js/examples/stream-screenshots"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-primary hover:underline"
+ >
+ view example
+ </a>
+ </p>
+ </div>
+ <div className="flex items-center gap-2">
+ <Switch
+ id="enableRealtimeVision"
+ checked={settings.enableRealtimeVision}
+ onCheckedChange={(checked) =>
+ handleSettingsChange(
+ {
+ enableRealtimeVision: checked,
+ },
+ true
+ )
+ }
+ />
+ </div>
+ </div>
+
{/* <div className="flex items-center justify-between mb-4">
<div className="space-y-1">
<h4 className="font-medium">use all monitors</h4>
diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index ca41ed1f8..3f951b0ed 100644
--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -105,6 +105,7 @@ export type Settings = {
realtimeAudioTranscriptionEngine: string;
disableVision: boolean;
useAllMonitors: boolean;
+ enableRealtimeVision: boolean;
};
const DEFAULT_SETTINGS: Settings = {
@@ -165,6 +166,7 @@ const DEFAULT_SETTINGS: Settings = {
realtimeAudioTranscriptionEngine: "whisper-large-v3-turbo",
disableVision: false,
useAllMonitors: false,
+ enableRealtimeVision: false,
};
const DEFAULT_IGNORED_WINDOWS_IN_ALL_OS = [
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 12f6b5352..4228dfadc 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.39.3"
+version = "0.39.4"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-app-tauri/src-tauri/src/sidecar.rs b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
index d8f1b88c6..d02608310 100644
--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs
+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
@@ -264,6 +264,11 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
.and_then(|v| v.as_bool())
.unwrap_or(false);
+ let enable_realtime_vision = store
+ .get("enableRealtimeVision")
+ .and_then(|v| v.as_bool())
+ .unwrap_or(false);
+
let _use_all_monitors = store
.get("useAllMonitors")
.and_then(|v| v.as_bool())
@@ -390,6 +395,10 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
args.push("--enable-realtime-audio-transcription");
}
+ if enable_realtime_vision {
+ args.push("--enable-realtime-vision");
+ }
+
// if use_all_monitors {
// args.push("--use-all-monitors");
// }
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index cf984d6a8..c95ff7b5b 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -722,6 +722,7 @@ async fn main() -> anyhow::Result<()> {
};
let audio_chunk_duration = Duration::from_secs(cli.audio_chunk_duration);
+ let deepgram_api_key = cli.deepgram_api_key.clone();
let handle = {
let runtime = &tokio::runtime::Handle::current();
runtime.spawn(async move {
@@ -747,12 +748,13 @@ async fn main() -> anyhow::Result<()> {
&audio_handle,
&cli.ignored_windows,
&cli.included_windows,
- cli.deepgram_api_key.clone(),
+ deepgram_api_key.clone(),
cli.vad_sensitivity.clone(),
languages.clone(),
cli.capture_unfocused_windows,
realtime_audio_devices.clone(),
cli.enable_realtime_audio_transcription,
+ cli.enable_realtime_vision,
);
let result = tokio::select! {
@@ -787,7 +789,6 @@ async fn main() -> anyhow::Result<()> {
#[cfg(feature = "llm")]
debug!("LLM initialized");
-
let (audio_devices_tx, _) = broadcast::channel(100);
let server = SCServer::new(
@@ -916,6 +917,23 @@ async fn main() -> anyhow::Result<()> {
"│ frame cache │ {:<34} │",
cli.enable_frame_cache
);
+ println!(
+ "│ capture unfocused wins │ {:<34} │",
+ cli.capture_unfocused_windows
+ );
+ println!(
+ "│ auto-destruct pid │ {:<34} │",
+ cli.auto_destruct_pid.unwrap_or(0)
+ );
+ // For security reasons, you might want to mask the API key if displayed
+ println!(
+ "│ deepgram key │ {:<34} │",
+ if cli.deepgram_api_key.is_some() {
+ "set (masked)"
+ } else {
+ "not set"
+ }
+ );
const VALUE_WIDTH: usize = 34;
diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rs
index 1d119e2d4..f5b9cd9a6 100644
--- a/screenpipe-server/src/cli.rs
+++ b/screenpipe-server/src/cli.rs
@@ -167,6 +167,10 @@ pub struct Cli {
#[arg(long, default_value_t = false)]
pub enable_realtime_audio_transcription: bool,
+ /// Enable realtime vision
+ #[arg(long, default_value_t = false)]
+ pub enable_realtime_vision: bool,
+
/// OCR engine to use.
/// AppleNative is the default local OCR engine for macOS.
/// WindowsNative is a local OCR engine for Windows.
diff --git a/screenpipe-server/src/core.rs b/screenpipe-server/src/core.rs
index 5863ee166..bc227cdf8 100644
--- a/screenpipe-server/src/core.rs
+++ b/screenpipe-server/src/core.rs
@@ -50,6 +50,7 @@ pub async fn start_continuous_recording(
capture_unfocused_windows: bool,
realtime_audio_devices: Vec<Arc<AudioDevice>>,
realtime_audio_enabled: bool,
+ realtime_vision: bool,
) -> Result<()> {
debug!("Starting video recording for monitor {:?}", monitor_ids);
let video_tasks = if !vision_disabled {
@@ -80,6 +81,7 @@ pub async fn start_continuous_recording(
video_chunk_duration,
languages.clone(),
capture_unfocused_windows,
+ realtime_vision,
)
.await
})
@@ -195,6 +197,7 @@ async fn record_video(
video_chunk_duration: Duration,
languages: Vec<Language>,
capture_unfocused_windows: bool,
+ realtime_vision: bool,
) -> Result<()> {
debug!("record_video: Starting");
let db_chunk_callback = Arc::clone(&db);
@@ -257,20 +260,22 @@ async fn record_video(
&window_result.text
};
- let _ = send_event(
- "ocr_result",
- WindowOcr {
- image: Some(frame.image.clone()),
- text: text.clone(),
- text_json: window_result.text_json.clone(),
- app_name: window_result.app_name.clone(),
- window_name: window_result.window_name.clone(),
- focused: window_result.focused,
- confidence: window_result.confidence,
- timestamp: frame.timestamp,
- browser_url: window_result.browser_url.clone(),
- },
- );
+ if realtime_vision {
+ let _ = send_event(
+ "ocr_result",
+ WindowOcr {
+ image: Some(frame.image.clone()),
+ text: text.clone(),
+ text_json: window_result.text_json.clone(),
+ app_name: window_result.app_name.clone(),
+ window_name: window_result.window_name.clone(),
+ focused: window_result.focused,
+ confidence: window_result.confidence,
+ timestamp: frame.timestamp,
+ browser_url: window_result.browser_url.clone(),
+ },
+ );
+ }
if let Err(e) = db
.insert_ocr_text(frame_id, text, &text_json, Arc::clone(&ocr_engine))
.await