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
chore: re-enable ollama, add custom prompt in settings
Louis Beaumont46df36d2b08b
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.tsxindex db2a06233..e7abd65dd 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@@ -67,10 +67,11 @@ export function ChatList({const [error, setError] = useState<string | null>(null);const { settings } = useSettings();const posthog = usePostHog();+ const customPrompt = settings.customPrompt || "";const { messagesRef } = useScrollAnchor();- console.log("messages", messages);+ // console.log("messages", messages);const handleSendMessage = async () => {if (!inputMessage.trim()) return;@@ -137,32 +138,61 @@ export function ChatList({Based on the user request, use tools to query screenpipe to best help the user.Rules:- q should be a single keyword that would properly find in the text found on the user screen some infomation that would help answering the user question.- - q contains a single query, again, for example instead of "life plan" just use "life"- - Respond with only the updated JSON object- 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- - 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 "all" for querying the same keyword over vision and audio- - When the user ask "show me what i was doing at 10.11 am" do not use "q" intent is not looking for specific content but for a time range+ - your output will be given to another llm, so return concise data (1 to 4 queries max in the array)+ - use "all" for querying the same keyword over vision and audio+ - for time-specific queries, focus on the time range rather than content+ - Do not add '"' around JSON arrays e.g. bad: "queries": "[ ... ]" good: "queries": [ ... ]+ - adapt queries to the user's specific question, intent, and time range+ - use 'app_name' when the user mentions a specific application but keep in mind user might use the app thru browser+ - limit to 1-4 queries per response+ - Current time: ${new Date().toLocaleString()}. Adjust start/end times to match user intent.+ - Convert user times to UTC. User timezone: ${+ Intl.DateTimeFormat().resolvedOptions().timeZone+ }+ - MAKE SURE TO ADAPT THE TIME RANGE PROPS TO THE USER'S INTENT+ - Also make sure to follow the user's custom system prompt: "${customPrompt}"+ examples of user queries and expected responses:- Example of your answer:+ 1. user: "what was i working on yesterday afternoon in vscode and chrome?"{- queries: [- { content_type: "audio", start_time: "2024-03-01T00:00:00Z", end_time: "2024-03-01T23:59:59Z" },- { content_type: "ocr", app_name: "arc", start_time: "2024-03-01T00:00:00Z", end_time: "2024-03-01T23:59:59Z", q: "john" },+ "queries": [+ { "content_type": "ocr", "app_name": "vscode", "start_time": "2024-03-14T12:00:00Z", "end_time": "2024-03-14T17:00:00Z" },+ { "content_type": "ocr", "app_name": "chrome", "start_time": "2024-03-14T12:00:00Z", "end_time": "2024-03-14T17:00:00Z" }]}-- Or+ 2. user: "find emails from john and mentions of project deadlines in my recent calls"{- queries: [- { content_type: "all", start_time: "2024-03-01T00:00:00Z", end_time: "2024-03-01T01:00:00Z" },+ "queries": [+ { "content_type": "ocr", "app_name": "gmail", "start_time": "2024-03-08T00:00:00Z", "end_time": "2024-03-15T23:59:59Z", "q": "john" },+ { "content_type": "audio", "start_time": "2024-03-01T00:00:00Z", "end_time": "2024-03-15T23:59:59Z", "q": "deadline" }]}++ 3. user: "show me what i was doing at 10:11 am today across all apps"+ {+ "queries": [+ { "content_type": "all", "start_time": "2024-03-15T10:11:00Z", "end_time": "2024-03-15T10:12:00Z" }+ ]+ }++ 4. user: "what did i work on in the last hour in vscode, notion, and slack?"+ {+ "queries": [+ { "content_type": "ocr", "app_name": "vscode", "start_time": "2024-03-15T09:00:00Z", "end_time": "2024-03-15T10:00:00Z" },+ { "content_type": "ocr", "app_name": "notion", "start_time": "2024-03-15T09:00:00Z", "end_time": "2024-03-15T10:00:00Z" },+ { "content_type": "ocr", "app_name": "slack", "start_time": "2024-03-15T09:00:00Z", "end_time": "2024-03-15T10:00:00Z" }+ ]+ }++ BAD RESPONSE: {"queries":"[{"content_type": "all", "start_time": "2024-03-15T11:48:00Z", "end_time": "2024-03-15T11:49:00Z"}]"}+ BAD RESPONSE: {"queries":"[{"content_type": "all", "start_time": "2024-03-15T11:48:00Z", "end_time": "2024-03-15T11:49:00Z"}]"}+ You added '"' around the array, you should not do that.+ DO NOT FUCKING ADD '"' AROUND JSON ARRAYS+ - MAKE SURE TO ADAPT THE TIME RANGE PROPS TO THE USER'S INTENT+`,},// add prev messages but convert all tool role messages to assistant bcs not supported in generateText@@ -234,17 +264,24 @@ export function ChatList({Intl.DateTimeFormat().resolvedOptions().timeZone}.- - You typically always query screenpipe in the first user message- - ALWAYS use the "stream_response" tool to stream the final response to the user- - ALWAYS use the "stream_response" tool to stream the final response to the user- - ALWAYS use the "stream_response" tool to stream the final response to the user- - ONLY USE query tool ONCE- Do not try to show screenshots- You can analyze/view/show/access videos to the user by putting .mp4 files in a code block (we'll render it) like this: \`/users/video.mp4\`- You can analyze/view/show/access videos BY JUST FUCKING PUTTING THE ABSOLUTE FILE PATH IN A CODE BLOCK- Always use the absolute file path to access videos- When the user ask "show me what i was doing at 10.11 am" make sure to embed the path to the video in the response in a code block- MAKE SURE TO FUCKING ANSWER THE USER QUESTION+ - Also make sure to follow the user's custom system prompt: "${customPrompt}"+ - If the data retuned by tools is empty or not relevant, make sure to tell the user that you could not find anything relevant to the user question and ask the user to try something more precise in a new chat++ Example responses:++ 1. "You were coding in VSCode from 2-3 PM, working on 'UserProfile.js'. In Chrome, you researched React hooks. Need more details?"++ 2. "Found 2 emails from John about the project. In a call at 3 PM, the frontend deadline was moved to Friday. Video: \`/users/calls/2024-03-15-15-00.mp4\`"++ 3. "At 10:11 AM: Slack chat in #project-alpha, VSCode open to 'dataProcessor.js', Chrome on AWS docs. Video: \`/users/screen/2024-03-15-10-11.mp4\`"++ 4. "Last hour: VSCode - API integration, Notion - roadmap updates, Slack - code review discussion. More on any of these?"`,},// @ts-ignore@@ -393,8 +430,8 @@ export function ChatList({</Button></div><p className="text-xs font-medium text-center text-neutral-700 mt-2">- screenpipe is in beta, base its answer on your computer activity and- can make errors.+ screenpipe is in alpha, base its answer on your screen & audio+ recordings and can make errors.</p></div></div>diff --git a/examples/apps/screenpipe-app-tauri/components/function-call-message.tsx b/examples/apps/screenpipe-app-tauri/components/function-call-message.tsxindex b80731b97..208b29449 100644--- a/examples/apps/screenpipe-app-tauri/components/function-call-message.tsx+++ b/examples/apps/screenpipe-app-tauri/components/function-call-message.tsx@@ -32,7 +32,7 @@ interface FunctionCallMessageProps {export function FunctionCallMessage({ message }: FunctionCallMessageProps) {const { settings } = useSettings();const [isDialogOpen, setIsDialogOpen] = useState(false);- console.log("FunctionCallMessage", message);+ // console.log("FunctionCallMessage", message);// Assuming message.content is the array shown in the image// @ts-ignore@@ -60,8 +60,8 @@ export function FunctionCallMessage({ message }: FunctionCallMessageProps) {// @ts-ignoreconst isResult = toolResults.some((result) => result.result !== null);- console.log("toolCalls", toolCalls);- console.log("toolResults", toolResults);+ // console.log("toolCalls", toolCalls);+ // console.log("toolResults", toolResults);// message.content.find((content) => content.args.queriesreturn (<div className="group relative mb-4 flex items-start md:-ml-12">diff --git a/examples/apps/screenpipe-app-tauri/components/settings.tsx b/examples/apps/screenpipe-app-tauri/components/settings.tsxindex 57429e784..ac6c73d66 100644--- a/examples/apps/screenpipe-app-tauri/components/settings.tsx+++ b/examples/apps/screenpipe-app-tauri/components/settings.tsx@@ -24,6 +24,7 @@ import { MemoizedReactMarkdown } from "./markdown";import { Separator } from "@/components/ui/separator";import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";import { platform } from "@tauri-apps/plugin-os";+import { Textarea } from "./ui/textarea";export function Settings({ className }: { className?: string }) {const { settings, updateSettings } = useSettings();@@ -51,6 +52,13 @@ export function Settings({ className }: { className?: string }) {updateSettings({ ...localSettings, aiModel: e.target.value });};+ const handleCustomPromptChange = (+ e: React.ChangeEvent<HTMLTextAreaElement>+ ) => {+ setLocalSettings({ ...localSettings, customPrompt: e.target.value });+ updateSettings({ ...localSettings, customPrompt: e.target.value });+ };+React.useEffect(() => {setLocalSettings(settings);setCurrentPlatform(platform());@@ -88,7 +96,7 @@ export function Settings({ className }: { className?: string }) {<div className="mt-8 space-y-6"><Card><CardHeader>- <CardTitle className="text-center">ai model selection</CardTitle>+ <CardTitle className="text-center">general ai settings</CardTitle></CardHeader><CardContent className="flex flex-col items-center"><div className="w-full max-w-md">@@ -118,6 +126,27 @@ export function Settings({ className }: { className?: string }) {: "recommended: gpt-4o for openai"}</p></div>+ <Separator className="my-4" />+ <div className="w-full max-w-md">+ <div className="flex flex-col gap-2 mb-4">+ <Label htmlFor="customPrompt" className="text-sm font-medium">+ Enter your custom prompt (keep it short):+ </Label>+ <Textarea+ id="customPrompt"+ value={localSettings.customPrompt || ""}+ onChange={handleCustomPromptChange}+ className="w-full"+ placeholder="Enter additional instructions for the AI..."+ rows={4}+ maxLength={200}+ />+ </div>+ <p className="text-sm text-muted-foreground text-center">+ This prompt will be added to the system message for all your+ queries.+ </p>+ </div></CardContent></Card><Card>@@ -168,42 +197,24 @@ export function Settings({ className }: { className?: string }) {</CardHeader><CardContent className="space-y-6"><div className="flex flex-col items-center space-y-2">- <TooltipProvider>- <TooltipProvider>- <Tooltip>- <TooltipTrigger asChild>- <div className="flex items-center space-x-4">- <Switch- id="use-ollama"- checked={localSettings.useOllama}- onCheckedChange={handleOllamaToggle}- />- <Label- htmlFor="use-ollama"- className="flex items-center space-x-2"- >- Use Ollama- <Badge variant="outline" className="ml-2">- Disabled- </Badge>- </Label>- </div>- </TooltipTrigger>- <TooltipContent>- <p>Ollama support is currently disabled.</p>- </TooltipContent>- </Tooltip>- </TooltipProvider>- <a- href="https://github.com/sgomez/ollama-ai-provider/issues/22"- target="_blank"- rel="noopener noreferrer"- className="text-sm text-primary hover:underline"+ <div className="flex items-center space-x-4">+ <Switch+ id="use-ollama"+ checked={localSettings.useOllama}+ onCheckedChange={handleOllamaToggle}+ />+ <Label+ htmlFor="use-ollama"+ className="flex items-center space-x-2">- want to make this work?- </a>- </TooltipProvider>- {/* {localSettings.useOllama && (+ Use Ollama+ <Badge variant="outline" className="ml-2">+ Experimental+ </Badge>+ </Label>+ </div>++ {localSettings.useOllama && (<div className="w-full max-w-md mt-2"><div className="flex-col gap-2 mb-4"><div className="flex items-center gap-4 mb-4">@@ -249,10 +260,18 @@ export function Settings({ className }: { className?: string }) {}}>{currentPlatform === "windows"- ? "You need to [install Ollama](https://ollama.com/) and run `set OLLAMA_ORIGINS=* && ollama run llama3.1` first. Currently only supports Llama 3.1"- : "You need to [install Ollama](https://ollama.com/) and run `ollama run llama3.1` first. Currently only supports Llama 3.1"}+ ? "You need to [install Ollama](https://ollama.com/) and run `set OLLAMA_ORIGINS=* && ollama run llama3.1` first. \n\nCurrently only supports models supporting tools like llama3.1, mistral-nemo, etc."+ : "You need to [install Ollama](https://ollama.com/) and run `ollama run llama3.1` first. \n\nCurrently only supports models supporting tools like llama3.1, mistral-nemo, etc."}</MemoizedReactMarkdown>- </div> */}+ </div>+ <a+ href="https://github.com/louis030195/screen-pipe/issues/167"+ target="_blank"+ rel="noopener noreferrer"+ className="text-sm text-primary hover:underline"+ >+ want to help make this well?+ </a></div><Separator />diff --git a/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsxindex f61b64b19..72a16a7c0 100644--- a/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx+++ b/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx@@ -13,6 +13,7 @@ interface Settings {aiModel: string;installedPipes: string[];userId: string;+ customPrompt: string;}let store: Store | null = null;@@ -28,6 +29,7 @@ export function useSettings() {aiModel: "gpt-4o",installedPipes: [],userId: "",+ customPrompt: "",});useEffect(() => {@@ -53,6 +55,8 @@ export function useSettings() {const savedInstalledPipes =((await store!.get("installedPipes")) as string[]) || [];const savedUserId = ((await store!.get("userId")) as string) || "";+ const savedCustomPrompt =+ ((await store!.get("customPrompt")) as string) || "";setSettings({openaiApiKey: savedKey,useOllama: savedUseOllama,@@ -63,6 +67,7 @@ export function useSettings() {aiModel: savedAiModel,installedPipes: savedInstalledPipes,userId: savedUserId,+ customPrompt: savedCustomPrompt,});} catch (error) {console.error("Failed to load settings:", error);@@ -87,6 +92,7 @@ export function useSettings() {await store!.set("aiModel", updatedSettings.aiModel);await store!.set("installedPipes", updatedSettings.installedPipes);await store!.set("userId", updatedSettings.userId);+ await store!.set("customPrompt", updatedSettings.customPrompt);await store!.save();setSettings(updatedSettings);} catch (error) {diff --git a/examples/apps/screenpipe-app-tauri/lib/screenpipe.ts b/examples/apps/screenpipe-app-tauri/lib/screenpipe.tsindex 624084683..b80e5498c 100644--- a/examples/apps/screenpipe-app-tauri/lib/screenpipe.ts+++ b/examples/apps/screenpipe-app-tauri/lib/screenpipe.ts@@ -64,6 +64,7 @@ export const screenpipeMultiQuery = z.object({export async function queryScreenpipeNtimes(params: z.infer<typeof screenpipeMultiQuery>) {+ console.log("queryScreenpipeNtimes", params);return Promise.all(params.queries.map(queryScreenpipe));}diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 18c78658b..b1cd8ce67 100644--- a/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "screenpipe-app"-version = "0.1.40"+version = "0.1.41"description = ""authors = ["you"]license = ""