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
release-app fix scroll not working in audio device selection and ai models, feat: ad gemini support in screenpipe cloud, small cleanup
Louis Beaumonta5053721b992
diff --git a/pipes/search/src/components/search-chat.tsx b/pipes/search/src/components/search-chat.tsxindex 38aa509c9..4f58ae87a 100644--- a/pipes/search/src/components/search-chat.tsx+++ b/pipes/search/src/components/search-chat.tsx@@ -621,6 +621,7 @@ export function SearchChat() {setIsAiLoading(true);try {+ console.log("settings", settings);const openai = new OpenAI({apiKey:settings.aiProviderType === "screenpipe-cloud"@@ -629,7 +630,6 @@ export function SearchChat() {baseURL: settings.aiUrl,dangerouslyAllowBrowser: true,});- console.log("openai", settings.openaiApiKey, settings.aiUrl);const model = settings.aiModel;const customPrompt = settings.customPrompt || "";diff --git a/screenpipe-actions/ai-proxy/src/index.ts b/screenpipe-actions/ai-proxy/src/index.tsindex c24bc71a5..075fdde5c 100644--- a/screenpipe-actions/ai-proxy/src/index.ts+++ b/screenpipe-actions/ai-proxy/src/index.ts@@ -6,7 +6,7 @@ import { Anthropic } from '@anthropic-ai/sdk';async function verifyClerkToken(env: Env, token: string): Promise<boolean> {try {const payload = await verifyToken(token, {- secretKey: env.CLERK_SECRET_KEY,+ secretKey: env.CLERK_SECRET_KEY,});return !!payload.sub;} catch (error) {@@ -166,6 +166,7 @@ export default {};const isStreaming = body.stream === true;const isAnthropicModel = body.model.toLowerCase().includes('claude');+ const isGeminiModel = body.model.toLowerCase().includes('gemini');const trace = langfuse.trace({id: 'ai_call_' + Date.now(),@@ -173,7 +174,7 @@ export default {metadata: {expectJson: body.response_format?.type === 'json_object',streaming: isStreaming,- provider: isAnthropicModel ? 'anthropic' : 'openai',+ provider: isAnthropicModel ? 'anthropic' : isGeminiModel ? 'gemini' : 'openai',},});@@ -215,33 +216,60 @@ export default {try {const stream = await anthropic.messages.create({- messages: body.messages.map(msg => ({- role: msg.role === 'user' ? 'user' : 'assistant',- content: msg.content,- })),- model: body.model,- stream: true,- max_tokens: 4096,- })+ messages: body.messages.map((msg) => ({+ role: msg.role === 'user' ? 'user' : 'assistant',+ content: msg.content,+ })),+ model: body.model,+ stream: true,+ max_tokens: 4096,+ });for await (const chunk of stream) {if (chunk.type === 'content_block_delta' && chunk.delta?.type === 'text_delta') {const openaiChunk = {- choices: [{- delta: {- content: chunk.delta.text- }- }]+ choices: [+ {+ delta: {+ content: chunk.delta.text,+ },+ },+ ],};await writer.write(new TextEncoder().encode(`data: ${JSON.stringify(openaiChunk)}\n\n`));}}-+await writer.write(new TextEncoder().encode('data: [DONE]\n\n'));} catch (error) {console.error('Error in Anthropic stream:', error);throw error;}+ } else if (isGeminiModel) {+ const apiResponse = await fetch('https://generativelanguage.googleapis.com/v1beta/openai/chat/completions', {+ method: 'POST',+ headers: {+ Authorization: `Bearer ${env.GEMINI_API_KEY}`,+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify(body),+ });++ if (!apiResponse.ok) {+ const errorData = await apiResponse.json();+ throw new Error(`API error: ${JSON.stringify(errorData)}`);+ }++ const reader = apiResponse.body?.getReader();+ if (!reader) {+ throw new Error('Failed to get reader from API response');+ }++ while (true) {+ const { done, value } = await reader.read();+ if (done) break;+ await writer.write(value);+ }} else {// Original OpenAI format - keep the fetch call only for OpenAIconst apiResponse = await fetch('https://api.openai.com/v1/chat/completions', {@@ -299,7 +327,11 @@ export default {// Non-streaming responsetry {const apiResponse = await fetch(- isAnthropicModel ? 'https://api.anthropic.com/v1/messages' : 'https://api.openai.com/v1/chat/completions',+ isAnthropicModel+ ? 'https://api.anthropic.com/v1/messages'+ : isGeminiModel+ ? 'https://generativelanguage.googleapis.com/v1beta/openai/chat/completions'+ : 'https://api.openai.com/v1/chat/completions',{method: 'POST',headers: {@@ -308,6 +340,10 @@ export default {'x-api-key': env.ANTHROPIC_API_KEY,'anthropic-version': '2023-06-01',}+ : isGeminiModel+ ? {+ Authorization: `Bearer ${env.GEMINI_API_KEY}`,+ }: {Authorization: `Bearer ${env.OPENAI_API_KEY}`,}),@@ -439,6 +475,7 @@ interface Env {DEEPGRAM_API_KEY: string;RATE_LIMITER: DurableObjectNamespace;CLERK_SECRET_KEY: string;+ GEMINI_API_KEY: string;}/*@@ -504,6 +541,25 @@ curl -X POST $HOST/v1/chat/completions \echo "$line" | sed 's/^data: //g' | jq -r '.choices[0].delta.content // empty' 2>/dev/nulldone | tr -d '\n'+using gemini++curl -X POST $HOST/v1/chat/completions \+-H "Content-Type: application/json" \+-H "Authorization: Bearer $TOKEN" \+-d '{+"model": "gemini-1.5-flash-latest",+"stream": true,+"messages": [+ {+ "role": "system",+ "content": "You are a helpful assistant."+ },+ {+ "role": "user",+ "content": "Tell me a short joke."+ }+]+}'deploymentdiff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsxindex 9edc165d6..0f2da0d48 100644--- a/screenpipe-app-tauri/components/pipe-store.tsx+++ b/screenpipe-app-tauri/components/pipe-store.tsx@@ -429,10 +429,9 @@ const PipeStore: React.FC = () => {console.log("user not authenticated, opening auth window");toast({title: "authentication required",- description: "please sign in to use paid pipes",+ description: "please sign in in settings to use paid pipes",variant: "destructive",});- await invoke("open_auth_window");return;}diff --git a/screenpipe-app-tauri/components/recording-settings.tsx b/screenpipe-app-tauri/components/recording-settings.tsxindex 15f934cfe..8cf43fc43 100644--- a/screenpipe-app-tauri/components/recording-settings.tsx+++ b/screenpipe-app-tauri/components/recording-settings.tsx@@ -1092,7 +1092,7 @@ export function RecordingSettings() {<Mic className="h-4 w-4" /><span>audio devices</span></Label>- <Popover open={openAudioDevices} onOpenChange={setOpenAudioDevices}>+ <Popover open={openAudioDevices} onOpenChange={setOpenAudioDevices} modal={true}><PopoverTrigger asChild><Buttonvariant="outline"diff --git a/screenpipe-app-tauri/components/settings/ai-section.tsx b/screenpipe-app-tauri/components/settings/ai-section.tsxindex 960804794..94d2002f3 100644--- a/screenpipe-app-tauri/components/settings/ai-section.tsx+++ b/screenpipe-app-tauri/components/settings/ai-section.tsx@@ -299,6 +299,10 @@ const AISection = () => {"o1","claude-3-5-sonnet-latest","claude-3-5-haiku-latest",+ "gemini-2.0-flash-exp",+ "gemini-1.5-flash",+ "gemini-1.5-flash-8b",+ "gemini-1.5-pro",];case "openai":return ["gpt-4o", "gpt-4o-mini", "o1-mini", "o1"];@@ -339,7 +343,7 @@ const AISection = () => {<AIProviderCardtype="screenpipe-cloud"title="screenpipe cloud"- description="use openai or anthropic models without worrying about api keys or usage"+ description="use openai, anthropic and google models without worrying about api keys or usage"imageSrc="/images/screenpipe.png"selected={settings.aiProviderType === "screenpipe-cloud"}onClick={() => handleAiProviderChange("screenpipe-cloud")}@@ -443,7 +447,7 @@ const AISection = () => {<div className="w-full"><div className="flex flex-col gap-4 mb-4 w-full"><Label htmlFor="aiModel">ai model</Label>- <Popover>+ <Popover modal={true}><PopoverTrigger asChild><Buttonvariant="outline"diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsxindex a6ede34ca..4791be437 100644--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx@@ -13,7 +13,6 @@ import {import { LazyStore, LazyStore as TauriStore } from "@tauri-apps/plugin-store";import { localDataDir } from "@tauri-apps/api/path";import { flattenObject, unflattenObject } from "../utils";-import { invoke } from "@tauri-apps/api/core";export type VadSensitivity = "low" | "medium" | "high";diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lockindex 481e0df24..c2c559c6d 100755--- a/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -4966,7 +4966,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "0.21.5"+version = "0.21.7"dependencies = ["anyhow","axum",diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 04ac9994b..544cb2330 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.21.7"+version = "0.21.8"description = ""authors = ["you"]license = ""diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rsindex 80dd0ef0c..a6f0dd627 100644--- a/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -247,44 +247,7 @@ pub struct AuthStatus {message: Option<String>,}-// Command to open the auth window-#[tauri::command]-pub async fn open_auth_window(app_handle: tauri::AppHandle<tauri::Wry>) -> Result<(), String> {- // #[cfg(debug_assertions)]- // let auth_url = "http://localhost:3001/login";- // #[cfg(not(debug_assertions))]- let auth_url = "https://screenpi.pe/login";-- // If window exists, try to close it and wait a bit- if let Some(existing_window) = app_handle.get_webview_window("auth") {- let _ = existing_window.destroy();- // Give it a moment to properly close- tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;- }-- let window = tauri::WebviewWindowBuilder::new(- &app_handle,- "auth",- tauri::WebviewUrl::External(auth_url.parse().unwrap()),- )- .title("screenpipe login")- .center()- .inner_size(800.0, 600.0)- .build()- .map_err(|e| format!("failed to open auth window: {}", e))?;-- // Add close event listener to cleanup the window- let window_handle = window.clone();- window.on_window_event(move |event| {- if let tauri::WindowEvent::Destroyed = event {- if let Some(w) = window_handle.get_webview_window("auth") {- let _ = w.close();- }- }- });- Ok(())-}#[tauri::command]pub async fn open_pipe_window(diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rsindex f5de23e3f..1fbfc030f 100755--- a/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/screenpipe-app-tauri/src-tauri/src/main.rs@@ -448,7 +448,6 @@ async fn main() {llm_sidecar::start_ollama_sidecar,llm_sidecar::stop_ollama_sidecar,commands::update_show_screenpipe_shortcut,- commands::open_auth_window,commands::show_meetings,commands::show_identify_speakers,commands::open_pipe_window,