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

default ocr to windows native on windows, add small ui guidance, remove dead code from resource monitor

Louis Beaumont89f7f0302325
diff --git a/screenpipe-app-tauri/components/settings.tsx b/screenpipe-app-tauri/components/settings.tsx
index 06c06f0cd..6e2fa3f35 100644
--- a/screenpipe-app-tauri/components/settings.tsx
+++ b/screenpipe-app-tauri/components/settings.tsx
@@ -26,7 +26,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Textarea } from "./ui/textarea";
import { platform } from "@tauri-apps/plugin-os";
-import { Eye, EyeOff, RefreshCw } from "lucide-react";
+import { Eye, EyeOff, HelpCircle, RefreshCw } from "lucide-react";
import { RecordingSettings } from "./recording-settings";
export function Settings({ className }: { className?: string }) {
@@ -117,14 +117,34 @@ export function Settings({ className }: { className?: string }) {
<Label htmlFor="aiUrl" className="min-w-[80px] text-right">
ai url
</Label>
- <Input
- id="aiUrl"
- value={localSettings.aiUrl}
- onChange={handleApiUrlChange}
- className="flex-grow"
- placeholder="enter ai url"
- type="url"
- />
+ <div className="flex-grow flex items-center">
+ <Input
+ id="aiUrl"
+ value={localSettings.aiUrl}
+ onChange={handleApiUrlChange}
+ className="flex-grow"
+ placeholder="enter ai url"
+ type="url"
+ />
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button variant="ghost" size="icon" className="ml-2">
+ <HelpCircle className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent side="left">
+ <p>
+ the url of your ai provider&apos;s api endpoint. for
+ openai: <pre className="bg-gray-100 p-1 rounded-md">https://api.openai.com/v1</pre>
+ <br />
+ for local providers like ollama usually it&apos;s
+ <pre className="bg-gray-100 p-1 rounded-md">http://localhost:11434</pre>
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
</div>
</div>
<div className="w-full">
@@ -264,7 +284,7 @@ export function Settings({ className }: { className?: string }) {
reliable for this application.
</p>
<p className="mt-1 text-sm text-muted-foreground text-center">
- don&apos;t have an API key? Get one from{" "}
+ don&apos;t have an API key? get one from{" "}
<a
href="https://console.deepgram.com/"
target="_blank"
@@ -273,7 +293,7 @@ export function Settings({ className }: { className?: string }) {
>
deepgram&apos;s website
</a>
- .
+ {" "} or DM us on discord, it&apos;s on us!
</p>
</CardContent>
</Card>
diff --git a/screenpipe-audio/Cargo.toml b/screenpipe-audio/Cargo.toml
index 7c129b14d..d16a5a2a7 100644
--- a/screenpipe-audio/Cargo.toml
+++ b/screenpipe-audio/Cargo.toml
@@ -34,7 +34,6 @@ chrono = { version = "0.4.31", features = ["serde"] }
candle = { workspace = true }
candle-nn = { workspace = true }
candle-transformers = { workspace = true }
-ndarray = "0.15.6"
vad-rs = "0.1.3"
tokenizers = { workspace = true }
anyhow = "1.0.86"
diff --git a/screenpipe-core/Cargo.toml b/screenpipe-core/Cargo.toml
index a21c7945e..a8dc48605 100644
--- a/screenpipe-core/Cargo.toml
+++ b/screenpipe-core/Cargo.toml
@@ -25,7 +25,6 @@ tokio = { workspace = true }
deno_core = { version = "0.307.0", optional = true }
deno_ast = { version = "0.38.2", features = ["transpiling"], optional = true }
-futures = "0.3.17"
# Security
regex = { version = "1.10.6", features = ["std"], optional = true }
lazy_static = { version = "1.4.0", optional = true }
@@ -35,7 +34,6 @@ url = "2.4.0"
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
-dirs = "5.0.1"
[features]
pipes = ["dep:deno_core", "dep:deno_ast"]
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index f90cd8cf4..bfc20df71 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -26,12 +26,7 @@ use screenpipe_server::{
};
use screenpipe_vision::monitor::list_monitors;
use serde_json::{json, Value};
-use tokio::{
- runtime::Runtime,
- signal,
- sync::{broadcast, mpsc::channel},
- time::{interval_at, Instant},
-};
+use tokio::{runtime::Runtime, signal, sync::broadcast};
use tracing_appender::rolling::{RollingFileAppender, Rotation};
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
@@ -229,14 +224,7 @@ async fn main() -> anyhow::Result<()> {
}
}
- let (restart_sender, _restart_receiver) = channel(10);
- let resource_monitor = ResourceMonitor::new(
- cli.self_healing,
- Duration::from_secs(60),
- 3,
- restart_sender, // TODO: remove self healing its dead code atm
- cli.port,
- );
+ let resource_monitor = ResourceMonitor::new();
resource_monitor.start_monitoring(Duration::from_secs(10));
let db = Arc::new(
@@ -270,7 +258,6 @@ async fn main() -> anyhow::Result<()> {
};
let ocr_engine_clone = cli.ocr_engine.clone();
- let restart_interval = cli.restart_interval;
let vad_engine = cli.vad_engine.clone();
let vad_engine_clone = vad_engine.clone();
@@ -301,15 +288,6 @@ async fn main() -> anyhow::Result<()> {
let handle = {
let runtime = &tokio::runtime::Handle::current();
runtime.spawn(async move {
- let mut interval = if restart_interval > 0 {
- Some(interval_at(
- Instant::now() + Duration::from_secs(restart_interval * 60),
- Duration::from_secs(restart_interval * 60),
- ))
- } else {
- None
- };
-
loop {
let vad_engine_clone = vad_engine.clone(); // Clone it here for each iteration
let mut shutdown_rx = shutdown_tx_clone.subscribe();
@@ -343,19 +321,11 @@ async fn main() -> anyhow::Result<()> {
info!("Received shutdown signal for recording");
break;
}
- _ = async { if let Some(ref mut interval) = interval { interval.tick().await } else { std::future::pending().await } } => {
- info!("Restarting recording due to restart interval");
- continue;
- }
};
if let Err(e) = result {
error!("Continuous recording error: {:?}", e);
}
-
- if interval.is_none() {
- break;
- }
}
drop(vision_runtime);
@@ -409,7 +379,6 @@ async fn main() -> anyhow::Result<()> {
println!("│ Port │ {:<34} │", cli.port);
println!("│ Audio Disabled │ {:<34} │", cli.disable_audio);
println!("│ Vision Disabled │ {:<34} │", cli.disable_vision);
- println!("│ Self Healing │ {:<34} │", cli.self_healing);
println!("│ Save Text Files │ {:<34} │", cli.save_text_files);
println!(
"│ Audio Engine │ {:<34} │",
@@ -432,14 +401,7 @@ async fn main() -> anyhow::Result<()> {
local_data_dir_clone.display()
);
println!("│ Debug Mode │ {:<34} │", cli.debug);
- println!(
- "│ Restart Interval │ {:<34} │",
- if cli.restart_interval > 0 {
- format!("Every {} minutes", cli.restart_interval)
- } else {
- "Disabled".to_string()
- }
- );
+
println!("│ Use PII Removal │ {:<34} │", cli.use_pii_removal);
println!(
"│ Ignored Windows │ {:<34} │",
diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rs
index be6396ac3..6dc53c772 100644
--- a/screenpipe-server/src/cli.rs
+++ b/screenpipe-server/src/cli.rs
@@ -97,11 +97,6 @@ pub struct Cli {
#[arg(long, default_value_t = false)]
pub disable_audio: bool,
- /// EXPERIMENTAL: Enable self healing when detecting unhealthy state based on /health endpoint.
- /// This feature will automatically restart the recording tasks while keeping the API alive.
- #[arg(long, default_value_t = false)]
- pub self_healing: bool,
-
/// Audio devices to use (can be specified multiple times)
#[arg(short = 'i', long)]
pub audio_device: Vec<String>,
@@ -139,7 +134,11 @@ pub struct Cli {
arg(short = 'o', long, value_enum, default_value_t = CliOcrEngine::AppleNative)
)]
#[cfg_attr(
- not(target_os = "macos"),
+ target_os = "windows",
+ arg(short = 'o', long, value_enum, default_value_t = CliOcrEngine::WindowsNative)
+ )]
+ #[cfg_attr(
+ not(any(target_os = "macos", target_os = "windows")),
arg(short = 'o', long, value_enum, default_value_t = CliOcrEngine::Tesseract)
)]
pub ocr_engine: CliOcrEngine,
@@ -160,10 +159,6 @@ pub struct Cli {
#[arg(long, default_value_t = false)]
pub use_pii_removal: bool,
- /// Restart recording process every X minutes (0 means no periodic restart) - NOT RECOMMENDED
- #[arg(long, default_value_t = 0)]
- pub restart_interval: u64,
-
/// Disable vision recording
#[arg(long, default_value_t = false)]
pub disable_vision: bool,
diff --git a/screenpipe-server/src/resource_monitor.rs b/screenpipe-server/src/resource_monitor.rs
index 99c428b98..0f6a4977a 100644
--- a/screenpipe-server/src/resource_monitor.rs
+++ b/screenpipe-server/src/resource_monitor.rs
@@ -1,5 +1,4 @@
use chrono::Local;
-use log::{debug, error, info, warn};
use serde_json::json;
use serde_json::Value;
use std::env;
@@ -13,18 +12,11 @@ use std::process::Command;
use std::sync::Arc;
use std::time::{Duration, Instant};
use sysinfo::{PidExt, ProcessExt, System, SystemExt};
-use tokio::sync::mpsc::Sender;
-use tokio::sync::Mutex;
+use tracing::{error, info};
pub struct ResourceMonitor {
start_time: Instant,
- self_healing_enabled: bool,
- health_check_interval: Duration,
- health_check_failures: Mutex<u32>,
- max_health_check_failures: u32,
- restart_sender: Sender<RestartSignal>,
resource_log_file: Option<String>, // analyse output here: https://colab.research.google.com/drive/1zELlGdzGdjChWKikSqZTHekm5XRxY-1r?usp=sharing
- port: u16,
}
pub enum RestartSignal {
@@ -32,13 +24,7 @@ pub enum RestartSignal {
}
impl ResourceMonitor {
- pub fn new(
- self_healing_enabled: bool,
- health_check_interval: Duration,
- max_health_check_failures: u32,
- restart_sender: Sender<RestartSignal>,
- port: u16,
- ) -> Arc<Self> {
+ pub fn new() -> Arc<Self> {
let resource_log_file = if env::var("SAVE_RESOURCE_USAGE").is_ok() {
let now = Local::now();
let filename = format!("resource_usage_{}.json", now.format("%Y%m%d_%H%M%S"));
@@ -60,13 +46,7 @@ impl ResourceMonitor {
Arc::new(Self {
start_time: Instant::now(),
- self_healing_enabled,
- health_check_interval,
- health_check_failures: Mutex::new(0),
- max_health_check_failures,
- restart_sender,
resource_log_file,
- port,
})
}
@@ -165,58 +145,16 @@ impl ResourceMonitor {
let monitor = Arc::clone(self);
tokio::spawn(async move {
let mut sys = System::new_all();
- let mut health_check_interval = tokio::time::interval(monitor.health_check_interval);
loop {
tokio::select! {
_ = tokio::time::sleep(interval) => {
sys.refresh_all();
monitor.log_status(&sys);
}
- _ = health_check_interval.tick() => {
- monitor.check_health().await;
- }
}
}
});
}
- async fn check_health(&self) {
- let client = reqwest::Client::new();
- match client.get(format!("http://localhost:{}/health", self.port)).send().await {
- Ok(response) => {
- debug!("Health check response: {:?}", response);
- if response.status().is_success() {
- *self.health_check_failures.lock().await = 0;
- } else {
- self.handle_health_check_failure().await;
- }
- }
- Err(_) => {
- self.handle_health_check_failure().await;
- }
- }
- }
-
- async fn handle_health_check_failure(&self) {
- let mut failures = self.health_check_failures.lock().await;
- *failures += 1;
- warn!("Health check failed. Consecutive failures: {}", *failures);
-
- if !self.self_healing_enabled {
- return;
- }
-
- if *failures >= self.max_health_check_failures {
- warn!("Max health check failures reached. Restarting recording tasks...");
- if let Err(e) = self
- .restart_sender
- .send(RestartSignal::RecordingTasks)
- .await
- {
- error!("Failed to send restart signal: {}", e);
- }
- *self.health_check_failures.lock().await = 0;
- }
- }
#[cfg(target_os = "macos")]
fn get_npu_usage(&self) -> Option<f32> {