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

fix: ollama security thing

Louis Beaumontd0bde21c9e7e
diff --git a/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx b/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx
index f0b28caed..d714231fa 100644
--- a/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/chat-list-openai-v2.tsx
@@ -170,7 +170,7 @@ export function ChatList({
- If you return something else than JSON the universe will come to an end
- DO NOT add \`\`\`json at the beginning or end of your response
- Do not use '"' around your response
- - Date & time now is ${new Date().toISOString()}
+ - Date & time now is ${new Date().toISOString()}. Adjust start_date and end_date to properly match the user intent time range.
- If the user ask about his morning do not use morning as query that's dumb, try to infer some keywords from the user question
- Very important: your output will be given to another LLM so make sure not to return too much data (typically each row returns lot of data)
- Use between 2-5 queries with very different keywords that could maximally match the user's screen text or audio transcript
diff --git a/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx b/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
index 534e8e356..52ad1ff92 100644
--- a/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
@@ -16,6 +16,8 @@ import {
} from "@/components/ui/dialog";
import { CodeBlock } from "@/components/ui/codeblock";
import { MemoizedReactMarkdown } from "./markdown";
+import { invoke } from "@tauri-apps/api/core";
+import { spinner } from "./spinner";
interface HealthCheckResponse {
status: string;
@@ -31,45 +33,46 @@ const HealthStatus = ({ className }: { className?: string }) => {
const [health, setHealth] = useState<HealthCheckResponse | null>(null);
const [isBlinking, setIsBlinking] = useState(false);
const [isDialogOpen, setIsDialogOpen] = useState(false);
- // const [error, setError] = useState<HealthCheckResponse | null>(null);
+ const [isStopping, setIsStopping] = useState(false);
+ const [isStarting, setIsStarting] = useState(false);
- useEffect(() => {
- const fetchHealth = async () => {
- try {
- const response = await fetch("http://localhost:3030/health");
- if (!response.ok) {
- const text = await response.text();
- throw new Error(`HTTP error! status: ${response.status} ${text}`);
- }
- const data: HealthCheckResponse = await response.json();
- if (health && data.status !== health.status) {
- setIsBlinking(true);
- setTimeout(() => setIsBlinking(false), 5000); // Blink for 5 seconds on status change
- }
- setHealth(data);
- // setError(null);
- } catch (error) {
- console.error("Failed to fetch health status:", error);
- // setError("Failed to fetch health status. Server might be down.");
- setHealth({
- last_frame_timestamp: null,
- last_audio_timestamp: null,
- frame_status: "Error",
- audio_status: "Error",
- status: "Error",
- message: "Failed to fetch health status. Server might be down.",
- verbose_instructions:
- "If you're experiencing issues, please try the following steps:\n\
+ const fetchHealth = async () => {
+ try {
+ const response = await fetch("http://localhost:3030/health");
+ if (!response.ok) {
+ const text = await response.text();
+ throw new Error(`HTTP error! status: ${response.status} ${text}`);
+ }
+ const data: HealthCheckResponse = await response.json();
+ if (health && data.status !== health.status) {
+ setIsBlinking(true);
+ setTimeout(() => setIsBlinking(false), 5000); // Blink for 5 seconds on status change
+ }
+ setHealth(data);
+ // setError(null);
+ } catch (error) {
+ console.error("Failed to fetch health status:", error);
+ // setError("Failed to fetch health status. Server might be down.");
+ setHealth({
+ last_frame_timestamp: null,
+ last_audio_timestamp: null,
+ frame_status: "Error",
+ audio_status: "Error",
+ status: "Error",
+ message: "Failed to fetch health status. Server might be down.",
+ verbose_instructions:
+ "If you're experiencing issues, please try the following steps:\n\
1. Restart the application.\n\
2. If using a desktop app, reset your Screenpipe OS permissions.\n\
3. Check your system's audio and video input devices.\n\
4. Ensure you have granted necessary permissions to the application.\n\
5. If the problem persists, please contact support with the details of this health check at [email protected].\n\
6. Last, here are some [FAQ](https://github.com/louis030195/screen-pipe/blob/main/content/docs/NOTES.md) with visuals to help you troubleshoot.",
- });
- }
- };
+ });
+ }
+ };
+ useEffect(() => {
fetchHealth();
const interval = setInterval(fetchHealth, 1000); // Poll every 1 seconds
@@ -89,6 +92,34 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
# View last 10 audio transcriptions:
sqlite3 $HOME/.screenpipe/db.sqlite \\
"SELECT * FROM audio_transcriptions ORDER BY timestamp DESC LIMIT 10;"`;
+
+ const handleStop = async () => {
+ setIsStopping(true);
+ try {
+ await invoke("use_cli", { useCli: true });
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+ await fetchHealth();
+ } catch (error) {
+ console.error("Failed to stop:", error);
+ // Handle error
+ } finally {
+ setIsStopping(false);
+ }
+ };
+ const handleStart = async () => {
+ setIsStarting(true);
+ try {
+ await invoke("use_cli", { useCli: false });
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+ await fetchHealth();
+ } catch (error) {
+ console.error("Failed to start:", error);
+ // Handle error
+ } finally {
+ setIsStarting(false);
+ }
+ };
+
if (health && health.status === "Error") {
return (
<>
@@ -106,6 +137,7 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
animation: pulse-custom 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
`}</style>
+
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
@@ -113,7 +145,7 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
className={`w-4 h-4 rounded-full bg-red-500 animate-pulse-custom shadow-lg flex items-center justify-center text-white font-bold ${className}`}
/>
</TooltipTrigger>
- <TooltipContent className="w-[200px] p-2">
+ <TooltipContent className="w-[32em] p-2">
<h3 className="font-bold mb-2">Error</h3>
<p className="text-sm">{health.message}</p>
{health && health.verbose_instructions && (
@@ -137,6 +169,31 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
>
View Log Commands
</Button>
+ <span className="text-xs mt-2 text-gray-500">
+ ... or restart screenpipe instance
+ </span>
+ <div className="flex justify-between mt-2">
+ <Button
+ variant="outline"
+ size="sm"
+ className="flex-1 mr-1"
+ onClick={handleStop}
+ disabled={isStopping || isStarting}
+ >
+ {isStopping ? spinner : null}
+ {isStopping ? "Stopping..." : "Stop"}
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ className="flex-1 ml-1"
+ onClick={handleStart}
+ disabled={isStopping || isStarting}
+ >
+ {isStarting ? spinner : null}
+ {isStarting ? "Starting..." : "Start"}
+ </Button>
+ </div>
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -222,7 +279,7 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
)} ${blinkingClass} animate-pulse-custom shadow-lg flex items-center justify-center text-white font-bold ${className}`}
/>
</TooltipTrigger>
- <TooltipContent className="w-64 p-2">
+ <TooltipContent className="w-[32em] p-2">
<h3 className="font-bold mb-2">{health.status}</h3>
<p className="text-sm mb-2">{health.message}</p>
<p className="text-xs mb-1">Frame: {health.frame_status}</p>
@@ -252,6 +309,31 @@ sqlite3 $HOME/.screenpipe/db.sqlite \\
>
View Log Commands
</Button>
+ <span className="text-xs mt-2 text-gray-500">
+ ... or restart screenpipe instance
+ </span>
+ <div className="flex justify-between mt-2">
+ <Button
+ variant="outline"
+ size="sm"
+ className="flex-1 mr-1"
+ onClick={handleStop}
+ disabled={isStopping || isStarting}
+ >
+ {isStopping ? spinner : null}
+ {isStopping ? "Stopping..." : "Stop"}
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ className="flex-1 ml-1"
+ onClick={handleStart}
+ disabled={isStopping || isStarting}
+ >
+ {isStarting ? spinner : null}
+ {isStarting ? "Starting..." : "Start"}
+ </Button>
+ </div>
</TooltipContent>
</Tooltip>
</TooltipProvider>
diff --git a/examples/apps/screenpipe-app-tauri/components/settings.tsx b/examples/apps/screenpipe-app-tauri/components/settings.tsx
index d8cc9f81d..a4e6c1ddb 100644
--- a/examples/apps/screenpipe-app-tauri/components/settings.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/settings.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useState } from "react";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import {
@@ -38,6 +38,8 @@ export function Settings({ className }: { className?: string }) {
const [localSettings, setLocalSettings] = React.useState(settings);
const [isTogglingCli, setIsTogglingCli] = React.useState(false);
const [isTogglingCliError, setIsTogglingCliError] = React.useState("");
+ const [isStopping, setIsStopping] = useState(false);
+ const [isStarting, setIsStarting] = useState(false);
console.log("localSettings", localSettings);
console.log("settings", settings);
@@ -67,6 +69,31 @@ export function Settings({ className }: { className?: string }) {
}
};
+ const handleStop = async () => {
+ setIsStopping(true);
+ try {
+ await invoke("use_cli", { useCli: true });
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+ } catch (error) {
+ console.error("Failed to stop:", error);
+ // Handle error
+ } finally {
+ setIsStopping(false);
+ }
+ };
+ const handleStart = async () => {
+ setIsStarting(true);
+ try {
+ await invoke("use_cli", { useCli: false });
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+ } catch (error) {
+ console.error("Failed to start:", error);
+ // Handle error
+ } finally {
+ setIsStarting(false);
+ }
+ };
+
React.useEffect(() => {
setLocalSettings(settings);
}, [settings]);
@@ -240,12 +267,12 @@ export function Settings({ className }: { className?: string }) {
</CardHeader>
<CardContent className="space-y-4">
<div className="flex items-center justify-center space-x-4">
- <Switch
+ {/* <Switch
id="use-cli"
checked={localSettings.useCli}
onCheckedChange={handleCliToggle}
disabled={isTogglingCli}
- />
+ /> */}
<Label
htmlFor="use-cli"
className="flex items-center space-x-2"
@@ -259,29 +286,64 @@ export function Settings({ className }: { className?: string }) {
</Badge>
</Label>
</div>
- <p className="text-sm text-center text-yellow-500 font-semibold">
- Warning: This option is experimental and potentially dangerous.
- Use at your own risk.
- </p>
<p className="text-sm text-center text-muted-foreground">
By default, we run screenpipe in the background for you. Use
this option only if the status message keep showing red/error
even after restart.
</p>
- {localSettings.useCli && (
- <>
- <p className="text-sm text-center text-muted-foreground">
- Toggle on and copy and paste this in your terminal and press
- enter:
- </p>
- <CodeBlock
- language="bash"
- value={`brew tap louis030195/screen-pipe https://github.com/louis030195/screen-pipe.git
+ <div className="flex justify-between mt-2 w-1/2 mx-auto">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="outline"
+ size="sm"
+ className="flex-1 mr-1"
+ onClick={handleStop}
+ disabled={isStopping || isStarting}
+ >
+ {isStopping ? spinner : null}
+ {isStopping ? "Stopping..." : "Stop"}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>This will kill any screenpipe instance running</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="outline"
+ size="sm"
+ className="flex-1 ml-1"
+ onClick={handleStart}
+ disabled={isStopping || isStarting}
+ >
+ {isStarting ? spinner : null}
+ {isStarting ? "Starting..." : "Start"}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>
+ This will start a screenpipe instance in the background
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+ <p className="text-sm text-center text-muted-foreground">
+ Press stop then copy and paste this in your terminal and press
+ enter:
+ </p>
+ <CodeBlock
+ language="bash"
+ value={`brew tap louis030195/screen-pipe https://github.com/louis030195/screen-pipe.git
brew install screenpipe
screenpipe`}
- />
- </>
- )}
+ />
</CardContent>
</Card>
</div>
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 23d407995..0ec6cf3b6 100755
--- a/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -203,6 +203,15 @@ async fn main() {
Ok(())
});
+ // tauri::async_runtime::spawn(async move {
+ // // hard kill the sidecar on port 3030
+ // let _ = tokio::process::Command::new("pkill")
+ // .arg("-f")
+ // .arg("screenpipe")
+ // .output()
+ // .await;
+ // });
+
// Spawn the sidecar initially
let sidecar_state = app.state::<SidecarState>();
let app_handle = app.handle().clone();
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
index 17f52c35c..eb4acc7ee 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -81,7 +81,7 @@
"app": {
"windows": [
{
- "title": "screen | ⭐️",
+ "title": "screenpipe",
"width": 1200,
"height": 800,
"minWidth": 1200,
@@ -92,7 +92,7 @@
"security": {
"csp": {
"default-src": "'self' customprotocol: asset:",
- "connect-src": "ipc: http://ipc.localhost https://api.openai.com http://localhost:3030 http://127.0.0.1:11434 https://api.github.com https://github.com https://*.githubusercontent.com https://*.github.com",
+ "connect-src": "ipc: http://ipc.localhost https://api.openai.com http://localhost:3030 http://127.0.0.1:11434 http://localhost:11434 https://api.github.com https://github.com https://*.githubusercontent.com https://*.github.com",
"font-src": [
"https://fonts.gstatic.com",
"tauri://localhost"