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

feat: add meeting summarizer in the pipe store

Louis Beaumont97a5ba53a419
diff --git a/examples/apps/screenpipe-app-tauri/bun.lockb b/examples/apps/screenpipe-app-tauri/bun.lockb
index 31bf55e3e..4d0e196ba 100755
Binary files a/examples/apps/screenpipe-app-tauri/bun.lockb and b/examples/apps/screenpipe-app-tauri/bun.lockb differ
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 4543fb312..63880bdf0 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
@@ -123,6 +123,7 @@ export function ChatList({
const [inputMessage, setInputMessage] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
+ const { settings } = useSettings();
const { messagesRef, scrollRef, visibilityRef, isAtBottom, scrollToBottom } =
useScrollAnchor();
@@ -147,7 +148,7 @@ export function ChatList({
apiKey: apiKey,
});
- const model = useOllama ? "llama3.1" : "gpt-4o";
+ const model = settings.aiModel;
// Test Ollama connection
if (useOllama) {
diff --git a/examples/apps/screenpipe-app-tauri/components/chat-list-openai.tsx b/examples/apps/screenpipe-app-tauri/components/chat-list-openai.tsx
deleted file mode 100644
index e2b8c0ea6..000000000
--- a/examples/apps/screenpipe-app-tauri/components/chat-list-openai.tsx
+++ /dev/null
@@ -1,522 +0,0 @@
-// ignore all file ts errors
-// @ts-nocheck
-
-import { useState } from "react";
-import OpenAI from "openai";
-import { z } from "zod";
-import { zodToJsonSchema } from "zod-to-json-schema";
-import { Button } from "@/components/ui/button";
-import { Textarea } from "@/components/ui/textarea";
-import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
-import {
- DropdownMenu,
- DropdownMenuTrigger,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
-} from "@/components/ui/dropdown-menu";
-import { Badge } from "@/components/ui/badge";
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-import { ChatMessage } from "./chat-message";
-
-// Initialize OpenAI client
-const openai = new OpenAI({
- apiKey: process.env.OPENAI_API_KEY,
- dangerouslyAllowBrowser: true, // Enable this only if you're sure about the security implications
-});
-
-const ScreenpipeParams = z.object({
- q: z.string(),
- offset: z.number(),
- limit: z.number(),
- start_date: z.string(),
- end_date: z.string(),
-});
-
-// Add this new function to handle screenpipe requests
-async function queryScreenpipe(params: z.infer<typeof ScreenpipeParams>) {
- try {
- const queryParams = new URLSearchParams({
- q: params.q,
- offset: params.offset.toString(),
- limit: params.limit.toString(),
- start_date: params.start_date,
- end_date: params.end_date,
- });
- const response = await fetch(`http://localhost:3030/search?${queryParams}`);
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
- }
- return await response.json();
- } catch (error) {
- console.error("Error querying screenpipe:", error);
- return null;
- }
-}
-
-const tools = [
- {
- type: "function",
- function: {
- name: "query_screenpipe",
- description:
- "Query the local screenpipe instance for relevant information",
- parameters: zodToJsonSchema(ScreenpipeParams),
- },
- },
-] as const;
-type Message =
- | { role: "user" | "assistant" | "system"; content: string }
- | { role: "assistant"; content: null; tool_calls: any[] }
- | { role: "tool"; content: string; tool_call_id: string };
-// Update the existing FunctionCallFeedback component
-
-
-export function ChatList() {
- const [messages, setMessages] = useState<Message[]>([]);
- const [inputMessage, setInputMessage] = useState("");
- const [isLoading, setIsLoading] = useState(false);
- const [error, setError] = useState<string | null>(null);
-
- const handleSendMessage = async () => {
- if (!inputMessage.trim()) return;
-
- const newMessages = [...messages, { role: "user", content: inputMessage }];
- setMessages(newMessages);
- setInputMessage("");
- setIsLoading(true);
- setError(null);
-
- try {
- const response = await openai.chat.completions.create({
- model: "gpt-4o",
- messages: [
- {
- role: "system",
- content: `You are a helpful assistant.
- The user is using a product called "screenpipe" which records
- his screen and mics 24/7. The user ask you questions
- and you use his screenpipe recordings to answer him.
- Based on the user request, use tools to screenpipe to best help the user.
- Each query should have "q", "offset", "limit", and start_date, end_date fields.
- 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.
- Return a list of objects with the key "queries"
- - 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
- - Date & time now is ${new Date().toISOString()}
-
- Example answers from you:
- "{
- "queries": [
- {"q": "goal", "offset": 0, "limit": 10, "start_date": "2024-07-21T11:30:25Z", "end_date": "2024-07-21T11:35:25Z"},
- {"q": "stripe", "offset": 0, "limit": 50, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"},
- {"q": "customer", "offset": 0, "limit": 20, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"}
- ]
- }"
-
- or
- "{
- "queries": [
- {"q": "sales", "offset": 0, "limit": 10, "start_date": "2024-07-21T11:30:25Z", "end_date": "2024-07-21T11:35:25Z"},
- {"q": "customer", "offset": 0, "limit": 20, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"},
- {"q": "goal", "offset": 0, "limit": 10, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"}
- ]
- }"
-
- Bad example
- "Here's the JSON you wanted:
- [
- {
- "queries": [{"q": "sales", "offset": 0, "limit": 10}]
- },
- {
- "queries": [{"q": "customer", "offset": 0, "limit": 20}]
- },
- {
- "queries": [{"q": "goal", "offset": 0, "limit": 10}]
- }
- ]"
- or
- "\`\`\`json
- [
- {
- "queries": [
- {"q": "goals", "offset": 0, "limit": 3}
- ]
- },
- {
- "queries": [
- {"q": "life plans", "offset": 0, "limit": 5}
- ]
- },
- {
- "queries": [
- {"q": "ambitions", "offset": 0, "limit": 3}
- ]
- }
- ]
- \`\`\`"
- JSON?
- `,
- },
- ...newMessages,
- ],
- tools: tools,
- tool_choice: "auto",
- });
-
- const assistantMessage = response.choices[0].message;
- setMessages([...newMessages, assistantMessage]);
-
- if (assistantMessage.tool_calls) {
- const toolMessages = [];
- for (const toolCall of assistantMessage.tool_calls) {
- if (toolCall.function.name === "query_screenpipe") {
- const functionArgs = JSON.parse(toolCall.function.arguments);
- const screenpipeResult = await queryScreenpipe(functionArgs);
- const functionResponse: Message = {
- role: "tool",
- content: JSON.stringify(screenpipeResult),
- tool_call_id: toolCall.id,
- };
- toolMessages.push(functionResponse);
- }
- }
-
- setMessages((prevMessages) => [...prevMessages, ...toolMessages]);
-
- // Stream the follow-up response
- const stream = await openai.chat.completions.create({
- model: "gpt-4o",
- messages: [...newMessages, assistantMessage, ...toolMessages],
- stream: true,
- });
-
- let streamedMessage = { role: "assistant", content: "" };
- setMessages((prevMessages) => [...prevMessages, streamedMessage]);
-
- for await (const chunk of stream) {
- if (chunk.choices[0]?.delta?.content) {
- streamedMessage.content += chunk.choices[0].delta.content;
- setMessages((prevMessages) => [
- ...prevMessages.slice(0, -1),
- { ...streamedMessage },
- ]);
- }
- }
- }
- } catch (error) {
- console.error("Error processing message:", error);
- setError("Sorry, there was an error processing your request.");
- } finally {
- setIsLoading(false);
- }
- };
- return (
- <div className="grid md:grid-cols-[520] min-h-screen w-full">
- <div className="flex flex-col">
- <div className="sticky top-0 p-2">
- <DropdownMenu>
- <DropdownMenuTrigger asChild disabled>
- <Button
- variant="ghost"
- className="gap-1 rounded-xl px-3 h-10 data-[state=open]:bg-muted text-lg"
- >
- llama <span className="text-muted-foreground">3.1-8B</span>
- <ChevronDownIcon className="w-4 h-4 text-muted-foreground" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="max-w-[300px]">
- <DropdownMenuItem className="items-start gap-2">
- <SparkleIcon className="w-4 h-4 mr-2 translate-y-1 shrink-0" />
- <div>
- <div className="font-medium">GPT-4</div>
- <div className="text-muted-foreground/80">
- With DALL-E, browing and analysis. Limit 40 messages / 3
- hours
- </div>
- </div>
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem className="items-start gap-2">
- <ZapIcon className="w-4 h-4 mr-2 translate-y-1 shrink-0" />
- <div>
- <div className="font-medium">GPT-3</div>
- <div className="text-muted-foreground/80">
- Great for everyday tasks
- </div>
- </div>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- <div className="flex flex-col items-start flex-1 max-w-2xl gap-8 px-4 mx-auto">
- {isLoading && <p>Loading...</p>}
- {error && <p className="text-red-500">{error}</p>}
- {messages.map((msg, index) => (
- <ChatMessage key={index} message={msg} />
- ))}
- </div>
- <div className="max-w-2xl w-full sticky bottom-0 mx-auto py-2 flex flex-col gap-1.5 px-4 bg-background">
- <div className="relative">
- <Textarea
- placeholder="Message screenpipe..."
- name="message"
- id="message"
- rows={1}
- className="min-h-[48px] rounded-2xl resize-none p-4 border border-neutral-400 shadow-sm pr-16"
- value={inputMessage}
- onChange={(e) => setInputMessage(e.target.value)}
- onKeyPress={(e) => {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault();
- handleSendMessage();
- }
- }}
- />
- <Button
- type="submit"
- size="icon"
- className="absolute w-8 h-8 top-3 right-3"
- onClick={handleSendMessage}
- disabled={isLoading || !inputMessage.trim()}
- >
- <ArrowUpIcon className="w-4 h-4" />
- <span className="sr-only">Send</span>
- </Button>
- </div>
- <p className="text-xs font-medium text-center text-neutral-700">
- screenpipe canNOT make mistakes. Consider checking important
- information.
- </p>
- </div>
- </div>
- </div>
- );
-}
-
-function ArrowUpIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="m5 12 7-7 7 7" />
- <path d="M12 19V5" />
- </svg>
- );
-}
-
-function BotIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M12 8V4H8" />
- <rect width="16" height="12" x="4" y="8" rx="2" />
- <path d="M2 14h2" />
- <path d="M20 14h2" />
- <path d="M15 13v2" />
- <path d="M9 13v2" />
- </svg>
- );
-}
-
-function ChevronDownIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="m6 9 6 6 6-6" />
- </svg>
- );
-}
-
-function ClipboardIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <rect width="8" height="4" x="8" y="2" rx="1" ry="1" />
- <path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" />
- </svg>
- );
-}
-
-function PenIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" />
- </svg>
- );
-}
-
-function RefreshCcwIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
- <path d="M3 3v5h5" />
- <path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16" />
- <path d="M16 16h5v5" />
- </svg>
- );
-}
-
-function SparkleIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" />
- </svg>
- );
-}
-
-function ThumbsDownIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M17 14V2" />
- <path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22h0a3.13 3.13 0 0 1-3-3.88Z" />
- </svg>
- );
-}
-
-function ThumbsUpIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M7 10v12" />
- <path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2h0a3.13 3.13 0 0 1 3 3.88Z" />
- </svg>
- );
-}
-
-function XIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M18 6 6 18" />
- <path d="m6 6 12 12" />
- </svg>
- );
-}
-
-function ZapIcon(props) {
- return (
- <svg
- {...props}
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
- </svg>
- );
-}
diff --git a/examples/apps/screenpipe-app-tauri/components/chat-message.tsx b/examples/apps/screenpipe-app-tauri/components/chat-message.tsx
deleted file mode 100644
index bff39a3d3..000000000
--- a/examples/apps/screenpipe-app-tauri/components/chat-message.tsx
+++ /dev/null
@@ -1,154 +0,0 @@
-// ignore all file ts errors
-// @ts-nocheck
-
-
-// Inspired by Chatbot-UI and modified to fit the needs of this project
-// @see https://github.com/mckaywrigley/chatbot-ui/blob/main/components/Chat/ChatMessage.tsx
-
-// import { Message } from 'ai'
-import remarkGfm from "remark-gfm";
-import remarkMath from "remark-math";
-
-import { cn } from "@/lib/utils";
-import { CodeBlock } from "@/components/ui/codeblock";
-import { MemoizedReactMarkdown } from "@/components/markdown";
-import { IconLlama, IconOpenAI, IconUser } from "@/components/ui/icons";
-import { ChatMessageActions } from "@/components/chat-message-actions";
-import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
-import { oneDark } from "react-syntax-highlighter/dist/esm/styles/prism";
-
-import { Badge } from "@/components/ui/badge";
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
-import { Message } from 'ai'
-
-export interface ChatMessageProps {
- message: Message;
-}
-
-function FunctionCall({
- functionCall,
- result,
-}: {
- functionCall: any;
- result: any;
-}) {
- return (
- <div className="bg-muted rounded-md p-2 mt-2 text-sm">
- <Badge variant="secondary" className="mb-2">
- Function Call
- </Badge>
- <p className="font-semibold">{functionCall.name}</p>
- <pre className="text-xs overflow-x-auto">
- {JSON.stringify(JSON.parse(functionCall.arguments), null, 2)}
- </pre>
- {result && <QueryResult result={result} />}
- </div>
- );
-}
-
-function QueryResult({ result }: { result: any }) {
- return (
- <Card className="w-full mt-2">
- <CardHeader>
- <CardTitle className="text-sm font-medium">Query Result</CardTitle>
- </CardHeader>
- <CardContent>
- {result.data.length > 0 ? (
- <ul className="space-y-2">
- {result.data.map((item: any, index: number) => (
- <li key={index} className="text-sm">
- <strong>{item.title}</strong>
- <p className="text-muted-foreground">{item.snippet}</p>
- </li>
- ))}
- </ul>
- ) : (
- <p className="text-sm text-muted-foreground">No results found.</p>
- )}
- <div className="mt-2 text-xs text-muted-foreground">
- Total: {result.pagination.total}, Limit: {result.pagination.limit},
- Offset: {result.pagination.offset}
- </div>
- </CardContent>
- </Card>
- );
-}
-
-export function ChatMessage({ message, ...props }: ChatMessageProps) {
- const isFunctionCall = message.role === "assistant" && message.function_call;
- const functionCallResult =
- message.role === "function" ? message.content : undefined;
-
- console.log(message);
- return (
- <div
- className={cn("group relative mb-4 flex items-start md:-ml-12")}
- {...props}
- >
- <div
- className={cn(
- "flex size-8 shrink-0 select-none items-center justify-center rounded-md border shadow",
- message.role === "user"
- ? "bg-background"
- : "bg-primary text-primary-foreground"
- )}
- >
- {message.role === "user" ? <IconUser /> : <IconLlama />}
- </div>
- <div className="flex-1 px-1 ml-4 space-y-2 overflow-hidden">
- {isFunctionCall ? (
- <FunctionCall
- functionCall={message.function_call}
- result={functionCallResult}
- />
- ) : (
- <MemoizedReactMarkdown
- className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0"
- remarkPlugins={[remarkGfm, remarkMath]}
- components={{
- p({ children }) {
- return <p className="mb-2 last:mb-0">{children}</p>;
- },
- code({ node, inline, className, children, ...props }) {
- const match = /language-(\w+)/.exec(className || "");
- const language = match && match[1] ? match[1] : "";
-
- if (inline) {
- return (
- <code className={className} {...props}>
- {children}
- </code>
- );
- }
-
- const [fileName, ...codeParts] = children[0].split("\n");
- const codeContent = codeParts.join("\n");
-
- return (
- <div className="relative">
- {fileName && (
- <div className="absolute top-0 right-0 bg-gray-700 text-white text-xs px-2 py-1 rounded-bl">
- {fileName.trim()}
- </div>
- )}
- <SyntaxHighlighter
- language={language}
- style={oneDark}
- customStyle={{ marginTop: fileName ? "2rem" : "0" }}
- {...props}
- >
- {codeContent}
- </SyntaxHighlighter>
- </div>
- );
- },
- }}
- >
- {message.content}
- </MemoizedReactMarkdown>
- )}
- <ChatMessageActions message={message} />
- </div>
- </div>
- );
-}
diff --git a/examples/apps/screenpipe-app-tauri/components/meeting-summarized.tsx b/examples/apps/screenpipe-app-tauri/components/meeting-summarized.tsx
new file mode 100644
index 000000000..fe8ccd147
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/components/meeting-summarized.tsx
@@ -0,0 +1,398 @@
+import React, { useState, useEffect, useRef } from "react";
+import { Button } from "@/components/ui/button";
+import { useSettings } from "@/lib/hooks/use-settings";
+import { z } from "zod";
+import { Input } from "./ui/input";
+import { Card, CardContent } from "./ui/card";
+import { Separator } from "./ui/separator";
+import { Pipe } from "@/lib/hooks/use-pipes";
+import { CheckIcon, CopyIcon } from "lucide-react";
+import { spinner } from "./spinner";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs";
+import { useCopyToClipboard } from "@/lib/hooks/use-copy-to-clipboard";
+import { createOpenAI } from "@ai-sdk/openai";
+import { createOllama } from "ollama-ai-provider";
+import { streamText } from "ai";
+import { ChatMessage } from "./chat-message-v2";
+import { Switch } from "./ui/switch";
+import { Label } from "./ui/label";
+import { Badge } from "./ui/badge";
+
+const screenpipeQuery = z.object({
+ q: z
+ .string()
+ .describe(
+ "The search query matching exact keywords. Use a single keyword that best matches the user intent. This would match either audio transcription or OCR screen text. Example: do not use 'discuss' the user ask about conversation, this is dumb, won't return any result"
+ )
+ .optional(),
+ content_type: z
+ .enum(["ocr", "audio", "all"])
+ .default("all")
+ .describe(
+ "The type of content to search for: screenshot data or audio transcriptions"
+ ),
+ limit: z
+ .number()
+ .default(20)
+ .describe(
+ "Number of results to return (default: 20). Don't return more than 50 results as it will be fed to an LLM"
+ ),
+ offset: z.number().default(0).describe("Offset for pagination (default: 0)"),
+ start_time: z
+ .string()
+ .default(new Date(Date.now() - 3600000).toISOString())
+ .describe("Start time for search range in ISO 8601 format"),
+ end_time: z
+ .string()
+ .default(new Date().toISOString())
+ .describe("End time for search range in ISO 8601 format"),
+ app_name: z
+ .string()
+ .describe(
+ "The name of the app the user was using. This filter out all audio conversations. Only works with screen text. Use this to filter on the app context that would give context matching the user intent. For example 'cursor'. Use lower case. Browser is usually 'arc', 'chrome', 'safari', etc. Do not use thing like 'mail' because the user use the browser to read the mail."
+ )
+ .optional(),
+});
+
+async function queryScreenpipe(params: z.infer<typeof screenpipeQuery>) {
+ try {
+ console.log("params", params);
+ const queryParams = new URLSearchParams(
+ Object.entries({
+ q: params.q,
+ offset: params.offset.toString(),
+ limit: params.limit.toString(),
+ start_date: params.start_time,
+ end_date: params.end_time,
+ content_type: params.content_type,
+ app_name: params.app_name,
+ }).filter(([_, v]) => v != null) as [string, string][]
+ );
+ console.log("calling screenpipe", JSON.stringify(params));
+ const response = await fetch(`http://localhost:3030/search?${queryParams}`);
+ if (!response.ok) {
+ const text = await response.text();
+ throw new Error(`HTTP error! status: ${response.status} ${text}`);
+ }
+ const result = await response.json();
+ console.log("result", result);
+ return result;
+ } catch (error) {
+ console.error("Error querying screenpipe:", error);
+ return null;
+ }
+}
+
+export const MeetingSummarizer = ({ pipe }: { pipe: Pipe }) => {
+ const [meetingStartTime, setMeetingStartTime] = useState<Date | null>(null);
+ const [manualEndTime, setManualEndTime] = useState("");
+ const [transcript, setTranscript] = useState<string>("");
+ const [isStreaming, setIsStreaming] = useState(false);
+ const [processedTranscript, setProcessedTranscript] = useState<string>("");
+ const { settings } = useSettings();
+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });
+ const [lastProcessedTimestamp, setLastProcessedTimestamp] = useState<
+ string | null
+ >(null);
+ const [processedHashes, setProcessedHashes] = useState<Set<string>>(
+ new Set()
+ );
+
+ const [isProcessing, setIsProcessing] = useState(false);
+ const transcriptQueueRef = useRef<string[]>([]);
+ const processingPromiseRef = useRef<Promise<void> | null>(null);
+ const [useAi, setUseAi] = useState(false);
+
+ const handleStartMeeting = () => {
+ setMeetingStartTime(new Date());
+ setIsStreaming(true);
+ setTranscript("");
+ setProcessedTranscript("");
+ setManualEndTime("");
+ setLastProcessedTimestamp(null);
+ };
+
+ const handleStopMeeting = () => {
+ setIsStreaming(false);
+ setMeetingStartTime(null);
+ setManualEndTime("");
+ };
+
+ const processTranscriptChunk = async (chunk: string) => {
+ if (isProcessing) {
+ transcriptQueueRef.current.push(chunk);
+ return;
+ }
+
+ setIsProcessing(true);
+
+ const processChunk = async () => {
+ try {
+ const baseUrl = settings.ollamaUrl.includes("/api")
+ ? settings.ollamaUrl
+ : settings.ollamaUrl + "/api";
+ const provider = settings.useOllama
+ ? createOllama({ baseURL: baseUrl })
+ : createOpenAI({ apiKey: settings.openaiApiKey });
+
+ const { textStream } = await streamText({
+ model: provider(settings.aiModel),
+ messages: [
+ {
+ role: "system",
+ content: `You are an AI assistant that receive small chnuks of transcriptions from a meeting or audio.
+ It uses Whisper to transcribe the audio or other AI model that can make mistakes.
+
+ Remove noise and transcription errors from the following text, keeping the essential content.
+
+ Typical errors from Whisper model or other are:
+ - Thank you...
+ - Weird chinese characters ...
+ - Subscribe now ...
+ - etc.
+
+ Rules:
+ - DO NOT FUCKING SAY ANYTHING BUT THE FIXED TRANSCRIPT DO NOT FUCKING COMMENT ON IT OR THE UNIVERSE WILL COLLAPSE
+ - DO NOT FUCKING TRY TO SUMMARIZE THE TRANSCRIPT, JUST FIX THE TRANSCRIPT
+ - DO MINIMAL CHANGES, ONLY IF NECESSARY
+ `,
+ },
+ {
+ role: "user",
+ content: chunk,
+ },
+ ],
+ });
+
+ let processedChunk = "";
+ for await (const text of textStream) {
+ processedChunk += text;
+ setProcessedTranscript((prev) => prev + text);
+ }
+ // add linebreak at the end of the transcript
+ setProcessedTranscript((prev) => prev + "\n");
+ } catch (error) {
+ console.error("Error processing transcript chunk:", error);
+ } finally {
+ setIsProcessing(false);
+ }
+ };
+
+ processingPromiseRef.current = processChunk();
+ await processingPromiseRef.current;
+ processNextChunkInQueue();
+ };
+
+ const processNextChunkInQueue = () => {
+ if (transcriptQueueRef.current.length > 0) {
+ const nextChunk = transcriptQueueRef.current.shift();
+ if (nextChunk) {
+ processTranscriptChunk(nextChunk);
+ }
+ }
+ };
+
+ const hashTranscript = async (text: string): Promise<string> => {
+ const encoder = new TextEncoder();
+ const data = encoder.encode(text);
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data);
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
+ return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
+ };
+ useEffect(() => {
+ let intervalId: NodeJS.Timeout;
+
+ const pollTranscript = async () => {
+ if (isStreaming && meetingStartTime) {
+ try {
+ const endTime = new Date();
+ const screenpipeResults = await queryScreenpipe({
+ content_type: "audio",
+ start_time:
+ lastProcessedTimestamp || meetingStartTime.toISOString(),
+ end_time: endTime.toISOString(),
+ limit: 100,
+ offset: 0,
+ });
+
+ if (
+ screenpipeResults &&
+ screenpipeResults.data &&
+ screenpipeResults.data.length > 0
+ ) {
+ let newTranscriptText = "";
+
+ for (const result of screenpipeResults.data) {
+ const transcriptHash = await hashTranscript(
+ result.content.transcription
+ );
+ if (!processedHashes.has(transcriptHash)) {
+ newTranscriptText += result.content.transcription + "\n";
+ processedHashes.add(transcriptHash);
+ setProcessedHashes(processedHashes);
+ }
+ }
+
+ if (newTranscriptText) {
+ setTranscript((prev) => prev + newTranscriptText);
+ if (useAi) {
+ await processTranscriptChunk(newTranscriptText);
+ } else {
+ setProcessedTranscript(
+ (prev) => prev + newTranscriptText + "\n---\n"
+ );
+ }
+ }
+
+ // Update the last processed timestamp
+ const lastResult =
+ screenpipeResults.data[screenpipeResults.data.length - 1];
+ setLastProcessedTimestamp(lastResult.timestamp);
+ }
+ } catch (error) {
+ console.error("Error polling transcript:", error);
+ }
+ }
+ };
+
+ if (isStreaming) {
+ intervalId = setInterval(pollTranscript, 5000); // Poll every 2 seconds
+ }
+
+ return () => {
+ if (intervalId) {
+ clearInterval(intervalId);
+ }
+ };
+ // ignore eslint shit
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isStreaming, meetingStartTime, settings]);
+
+ return (
+ <div className="flex flex-col h-full w-full overflow-y-auto">
+ <h2 className="text-2xl font-bold mb-2">
+ Local First Meeting Summarizer
+ </h2>
+ <div className="flex flex-col space-y-2">
+ <Label>by: Screenpipe</Label>
+ <Label>version: 1.0.0</Label>
+ <div className="flex space-x-2 items-center ">
+ <Switch
+ checked={useAi}
+ onCheckedChange={setUseAi}
+ disabled={isStreaming}
+ />
+ <Label htmlFor="use-ai" className="mb-1">
+ Use AI processing
+ <Badge variant="outline" className="text-xs w-fit p-2">
+ experimental
+ </Badge>
+ </Label>
+ </div>
+ </div>
+ <p className="text-sm text-muted-foreground mb-4">
+ AI processing uses your configured{" "}
+ {settings.useOllama ? "Ollama" : "OpenAI"} settings
+ </p>
+ <Tabs defaultValue="controls" className="flex-grow flex flex-col w-3/4">
+ <TabsList className="bg-background flex justify-start">
+ <TabsTrigger value="controls">Controls</TabsTrigger>
+ <Separator orientation="vertical" />
+ <TabsTrigger value="transcript">Transcript</TabsTrigger>
+ {isStreaming && (
+ <div className="flex items-center space-x-2">
+ {spinner}
+ <span>Streaming transcript...</span>
+ </div>
+ )}
+ </TabsList>
+ <div className="flex-grow overflow-hidden">
+ <TabsContent value="controls" className="h-full overflow-y-auto p-4">
+ <p className="mb-4">{pipe.description}</p>
+ <div className="flex space-x-2 mb-4">
+ <Button onClick={handleStartMeeting} disabled={isStreaming}>
+ Start Meeting
+ </Button>
+ <Button onClick={handleStopMeeting} disabled={!isStreaming}>
+ Stop Meeting
+ </Button>
+ {/* <Input
+ type="datetime-local"
+ value={manualEndTime}
+ onChange={(e) => setManualEndTime(e.target.value)}
+ onKeyDown={(e) => {
+ const now = new Date();
+ const inputDate = new Date(e.currentTarget.value);
+ if (
+ inputDate < now &&
+ (e.key === "ArrowUp" || e.key === "ArrowDown")
+ ) {
+ e.preventDefault(); // Prevent navigating to past dates
+ }
+ }}
+ className="border rounded px-2 py-1"
+ placeholder="Manual End Time"
+ min={(() => {
+ const now = new Date();
+ return `${now.getFullYear()}-${String(
+ now.getMonth() + 1
+ ).padStart(2, "0")}-${String(now.getDate()).padStart(
+ 2,
+ "0"
+ )}T${String(now.getHours()).padStart(2, "0")}:${String(
+ now.getMinutes()
+ ).padStart(2, "0")}`;
+ })()}
+ /> */}
+ </div>
+ {meetingStartTime && (
+ <p className="mb-4">
+ Meeting started at: {meetingStartTime.toLocaleTimeString()}
+ </p>
+ )}
+ </TabsContent>
+ <TabsContent
+ value="transcript"
+ className="h-full overflow-y-auto p-4 "
+ >
+ <div className="space-y-4 space-x-4">
+ <Button
+ variant="outline"
+ onClick={() => copyToClipboard(processedTranscript)}
+ disabled={!processedTranscript}
+ >
+ {isCopied ? (
+ <CheckIcon className="mr-2 h-4 w-4" />
+ ) : (
+ <CopyIcon className="mr-2 h-4 w-4" />
+ )}
+ {isCopied ? "Copied" : "Copy Transcript"}
+ </Button>
+ {useAi && (
+ <Button
+ variant="outline"
+ onClick={() => copyToClipboard(transcript)}
+ disabled={!transcript}
+ >
+ {isCopied ? (
+ <CheckIcon className="mr-2 h-4 w-4" />
+ ) : (
+ <CopyIcon className="mr-2 h-4 w-4" />
+ )}
+ {isCopied ? "Copied" : "Copy Raw Transcript"}
+ </Button>
+ )}
+ <ChatMessage
+ message={{
+ id: "1",
+ role: "assistant",
+ content: processedTranscript,
+ }}
+ />
+ </div>
+ </TabsContent>
+ </div>
+ </Tabs>
+ </div>
+ );
+};
diff --git a/examples/apps/screenpipe-app-tauri/components/pipe-store.tsx b/examples/apps/screenpipe-app-tauri/components/pipe-store.tsx
index 45691439a..b6450479f 100644
--- a/examples/apps/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/pipe-store.tsx
@@ -10,7 +10,7 @@ import {
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { Separator } from "@/components/ui/separator";
-import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
+import { Card } from "@/components/ui/card";
import { MemoizedReactMarkdown } from "@/components/markdown";
import { usePipes, Pipe } from "@/lib/hooks/use-pipes";
import { CodeBlock } from "@/components/ui/codeblock";
@@ -18,7 +18,9 @@ import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";
import { Skeleton } from "./ui/skeleton";
import { PrettyLink } from "@/components/pretty-link";
-
+import { MeetingSummarizer } from "./meeting-summarized";
+import { useSettings } from "@/lib/hooks/use-settings";
+import { open } from "@tauri-apps/plugin-shell";
const formatDate = (dateString: string) => {
const date = new Date(dateString);
return date.toLocaleDateString("en-US", {
@@ -60,6 +62,7 @@ const PipeDialog: React.FC = () => {
"https://github.com/different-ai/file-organizer-2000"
);
const [selectedPipe, setSelectedPipe] = useState<Pipe | null>(null);
+ const { settings, updateSettings } = useSettings();
const formatUpdatedTime = (date: string) => {
const now = new Date();
@@ -69,13 +72,164 @@ const PipeDialog: React.FC = () => {
return `${diffDays} day${diffDays > 1 ? "s" : ""} ago`;
};
+ const handleInstall = async (pipe: Pipe) => {
+ // if its file organizer, just open the github url in new tab
+ if (pipe.repository.includes("file-organizer")) {
+ console.log("opening file organizer", pipe.repository);
+ open(pipe.repository);
+ return;
+ }
+
+ const updatedInstalledPipes = [...settings.installedPipes, pipe.name];
+ await updateSettings({ installedPipes: updatedInstalledPipes });
+ setSelectedPipe({ ...pipe });
+ };
+
+ const renderPipeContent = () => {
+ if (!selectedPipe) {
+ return (
+ <div className="flex flex-col items-center justify-center h-full">
+ <p className="text-lg mb-4">no pipe selected</p>
+ <FeatureRequestLink />
+ </div>
+ );
+ }
+
+ if (
+ selectedPipe.name === "Local First Meeting Summarizer" &&
+ settings.installedPipes.includes(selectedPipe.name)
+ ) {
+ return <MeetingSummarizer pipe={selectedPipe} />;
+ }
+
+ const isInstalled = settings.installedPipes.includes(selectedPipe.name);
+
+ return (
+ <>
+ <h2 className="text-2xl font-bold mb-2">{selectedPipe.name}</h2>
+ <div className="flex justify-between items-center mb-4">
+ <div>
+ <p>downloads: {selectedPipe.downloads}</p>
+ <p>version: {selectedPipe.version}</p>
+ <p>
+ by:{" "}
+ <a
+ href={selectedPipe.authorLink}
+ className="text-blue-500 hover:underline"
+ >
+ {selectedPipe.author}
+ </a>
+ </p>
+ <p>
+ repository:{" "}
+ <a
+ href={selectedPipe.repository}
+ className="text-blue-500 hover:underline"
+ >
+ link
+ </a>
+ </p>
+ <p>
+ last update:{" "}
+ <a
+ href={selectedPipe.repository}
+ className="text-blue-500 hover:underline"
+ >
+ {formatDate(selectedPipe.lastUpdate)}
+ </a>
+ </p>
+ </div>
+ </div>
+ <p className="mb-4">{selectedPipe.description}</p>
+ <div className="flex space-x-2 mb-4">
+ <Button
+ onClick={() => handleInstall(selectedPipe)}
+ disabled={isInstalled}
+ >
+ {isInstalled ? "Installed" : "Install"}
+ </Button>
+ <Button disabled variant="outline">
+ copy share link
+ <Badge variant="secondary" className="ml-2">
+ soon
+ </Badge>
+ </Button>
+ <Button disabled variant="outline">
+ donate
+ <Badge variant="secondary" className="ml-2">
+ soon
+ </Badge>
+ </Button>
+ </div>
+ <Separator className="my-4" />
+ {isInstalled ? (
+ <div className="mt-4">
+ <h3 className="text-xl font-semibold mb-2">Controls</h3>
+ {/* Add controls for the installed pipe here */}
+ <p>Pipe controls will be displayed here.</p>
+ </div>
+ ) : (
+ <div className="mt-4">
+ <h3 className="text-xl font-semibold mb-2">About this pipe</h3>
+ <MemoizedReactMarkdown
+ className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 w-full"
+ remarkPlugins={[remarkGfm, remarkMath]}
+ components={{
+ p({ children }) {
+ return <p className="mb-2 last:mb-0">{children}</p>;
+ },
+ code({ node, className, children, ...props }) {
+ const content = String(children).replace(/\n$/, "");
+ const match = /language-(\w+)/.exec(className || "");
+
+ if (!match) {
+ return (
+ <code
+ className="px-1 py-0.5 rounded-sm bg-gray-100 dark:bg-gray-800 font-mono text-sm"
+ {...props}
+ >
+ {content}
+ </code>
+ );
+ }
+
+ return (
+ <CodeBlock
+ key={Math.random()}
+ language={(match && match[1]) || ""}
+ value={content}
+ {...props}
+ />
+ );
+ },
+ img({ src, alt }) {
+ return (
+ <img
+ src={src}
+ alt={alt}
+ className="max-w-full h-auto"
+ onError={(e) => {
+ const target = e.target as HTMLImageElement;
+ target.onerror = null;
+ target.src = "path/to/fallback/image.png"; // Replace with your fallback image
+ }}
+ />
+ );
+ },
+ }}
+ >
+ {selectedPipe.fullDescription.replace(/Â/g, "")}
+ </MemoizedReactMarkdown>
+ </div>
+ )}
+ </>
+ );
+ };
+
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="ghost">Pipe Store</Button>
- {/* <PrettyLink variant="outline" href="">
- Pipe Store
- </PrettyLink> */}
</DialogTrigger>
<DialogContent className="max-w-[90vw] w-full max-h-[90vh] h-full">
<DialogHeader>
@@ -99,7 +253,7 @@ const PipeDialog: React.FC = () => {
{selectedPipe && <FeatureRequestLink className="w-80" />}
</DialogHeader>
- <div className="flex h-[600px]">
+ <div className="flex h-[500px]">
<div className="w-1/3 pr-4 overflow-y-auto">
{loading &&
Array(5)
@@ -110,7 +264,7 @@ const PipeDialog: React.FC = () => {
</div>
))}
{error && <p>error: {error}</p>}
- {pipes.map((pipe: any) => (
+ {pipes.map((pipe: Pipe) => (
<Card
key={pipe.name}
className="cursor-pointer hover:bg-gray-100 mb-2 p-2"
@@ -146,127 +300,8 @@ const PipeDialog: React.FC = () => {
</Card>
))}
</div>
- <div className="w-1/2 pl-4 border-l overflow-y-auto">
- {selectedPipe ? (
- <>
- <h2 className="text-2xl font-bold mb-2">{selectedPipe.name}</h2>
- <div className="flex justify-between items-center mb-4">
- <div>
- <p>downloads: {selectedPipe.downloads}</p>
- <p>version: {selectedPipe.version}</p>
- <p>
- by:{" "}
- <a
- href={selectedPipe.authorLink}
- className="text-blue-500 hover:underline"
- >
- {selectedPipe.author}
- </a>
- </p>
- <p>
- repository:{" "}
- <a
- href={selectedPipe.repository}
- className="text-blue-500 hover:underline"
- >
- link
- </a>
- </p>
- <p>
- last update:{" "}
- <a
- href={selectedPipe.repository}
- className="text-blue-500 hover:underline"
- >
- {formatDate(selectedPipe.lastUpdate)}
- </a>
- </p>
- </div>
- </div>
- <p className="mb-4">{selectedPipe.description}</p>
- <div className="flex space-x-2 mb-4">
- <Button disabled variant="outline">
- install
- <Badge variant="secondary" className="ml-2">
- soon
- </Badge>
- </Button>
- <Button disabled variant="outline">
- copy share link
- <Badge variant="secondary" className="ml-2">
- soon
- </Badge>
- </Button>
- <Button disabled variant="outline">
- donate
- <Badge variant="secondary" className="ml-2">
- soon
- </Badge>
- </Button>
- </div>
- <Separator className="my-4" />
- <div className="mt-4">
- <h3 className="text-xl font-semibold mb-2">
- about this pipe
- </h3>
- <MemoizedReactMarkdown
- className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 w-full"
- remarkPlugins={[remarkGfm, remarkMath]}
- components={{
- p({ children }) {
- return <p className="mb-2 last:mb-0">{children}</p>;
- },
- code({ node, className, children, ...props }) {
- const content = String(children).replace(/\n$/, "");
- const match = /language-(\w+)/.exec(className || "");
-
- if (!match) {
- return (
- <code
- className="px-1 py-0.5 rounded-sm bg-gray-100 dark:bg-gray-800 font-mono text-sm"
- {...props}
- >
- {content}
- </code>
- );
- }
-
- return (
- <CodeBlock
- key={Math.random()}
- language={(match && match[1]) || ""}
- value={content}
- {...props}
- />
- );
- },
- img({ src, alt }) {
- return (
- // eslint-disable-next-line @next/next/no-img-element
- <img
- src={src}
- alt={alt}
- className="max-w-full h-auto"
- onError={(e) => {
- const target = e.target as HTMLImageElement;
- target.onerror = null;
- target.src = "path/to/fallback/image.png"; // Replace with your fallback image
- }}
- />
- );
- },
- }}
- >
- {selectedPipe.fullDescription.replace(/Â/g, "")}
- </MemoizedReactMarkdown>
- </div>
- </>
- ) : (
- <div className="flex flex-col items-center justify-center h-full">
- <p className="text-lg mb-4">no pipe selected</p>
- <FeatureRequestLink />
- </div>
- )}
+ <div className="w-full pl-4 border-l overflow-y-auto">
+ {renderPipeContent()}
</div>
</div>
</DialogContent>
diff --git a/examples/apps/screenpipe-app-tauri/components/settings.tsx b/examples/apps/screenpipe-app-tauri/components/settings.tsx
index 7bf88870b..fa41e32f4 100644
--- a/examples/apps/screenpipe-app-tauri/components/settings.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/settings.tsx
@@ -28,7 +28,6 @@ import { platform } from "@tauri-apps/plugin-os";
export function Settings({ className }: { className?: string }) {
const { settings, updateSettings } = useSettings();
const [localSettings, setLocalSettings] = React.useState(settings);
- const [isLoading, setIsLoading] = React.useState(false);
const [currentPlatform, setCurrentPlatform] = React.useState<string>("");
const handleApiKeyChange = (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -47,6 +46,11 @@ export function Settings({ className }: { className?: string }) {
updateSettings({ ...localSettings, ollamaUrl: e.target.value });
};
+ const handleModelChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+ setLocalSettings({ ...localSettings, aiModel: e.target.value });
+ updateSettings({ ...localSettings, aiModel: e.target.value });
+ };
+
React.useEffect(() => {
setLocalSettings(settings);
setCurrentPlatform(platform());
@@ -71,8 +75,51 @@ export function Settings({ className }: { className?: string }) {
<DialogDescription>
Choose your AI provider, enter necessary credentials, and more.
</DialogDescription>
+ {localSettings.useOllama ? (
+ <p className="text-sm font-medium text-grey-600 dark:text-grey-400">
+ you are now using ollama 🦙
+ </p>
+ ) : (
+ <p className="text-sm font-medium text-grey-600 dark:text-grey-400">
+ you are now using openai 🤖
+ </p>
+ )}
</DialogHeader>
<div className="mt-8 space-y-6">
+ <Card>
+ <CardHeader>
+ <CardTitle className="text-center">ai model selection</CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col items-center">
+ <div className="w-full max-w-md">
+ <div className="flex flex-col gap-2 mb-4">
+ <Label htmlFor="aiModel" className="text-sm font-medium">
+ {localSettings.useOllama
+ ? "enter your ollama model:"
+ : "enter your openai model:"}
+ </Label>
+ <Input
+ autoCorrect="off"
+ autoComplete="off"
+ id="aiModel"
+ value={localSettings.aiModel}
+ onChange={handleModelChange}
+ className="w-full"
+ placeholder={
+ localSettings.useOllama
+ ? "e.g., llama3.1"
+ : "e.g., gpt-4o"
+ }
+ />
+ </div>
+ <p className="text-sm text-muted-foreground text-center">
+ {localSettings.useOllama
+ ? "recommended: llama3.1 for ollama"
+ : "recommended: gpt-4o for openai"}
+ </p>
+ </div>
+ </CardContent>
+ </Card>
<Card>
<CardHeader>
<CardTitle className="text-center">OpenAI</CardTitle>
@@ -173,7 +220,8 @@ export function Settings({ className }: { className?: string }) {
</div>
{/* add small text to indicate only port 11434 is supported for security reasons */}
<p className="mt-1 text-sm text-muted-foreground text-center">
- For now only port 11434 is supported for security reasons.
+ For now only port 11434 is supported for security
+ reasons.
</p>
</div>
</div>
diff --git a/examples/apps/screenpipe-app-tauri/components/ui/tabs.tsx b/examples/apps/screenpipe-app-tauri/components/ui/tabs.tsx
new file mode 100644
index 000000000..26eb10912
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/components/ui/tabs.tsx
@@ -0,0 +1,55 @@
+"use client"
+
+import * as React from "react"
+import * as TabsPrimitive from "@radix-ui/react-tabs"
+
+import { cn } from "@/lib/utils"
+
+const Tabs = TabsPrimitive.Root
+
+const TabsList = React.forwardRef<
+ React.ElementRef<typeof TabsPrimitive.List>,
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
+>(({ className, ...props }, ref) => (
+ <TabsPrimitive.List
+ ref={ref}
+ className={cn(
+ "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
+ className
+ )}
+ {...props}
+ />
+))
+TabsList.displayName = TabsPrimitive.List.displayName
+
+const TabsTrigger = React.forwardRef<
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
+>(({ className, ...props }, ref) => (
+ <TabsPrimitive.Trigger
+ ref={ref}
+ className={cn(
+ "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
+ className
+ )}
+ {...props}
+ />
+))
+TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
+
+const TabsContent = React.forwardRef<
+ React.ElementRef<typeof TabsPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
+>(({ className, ...props }, ref) => (
+ <TabsPrimitive.Content
+ ref={ref}
+ className={cn(
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
+ className
+ )}
+ {...props}
+ />
+))
+TabsContent.displayName = TabsPrimitive.Content.displayName
+
+export { Tabs, TabsList, TabsTrigger, TabsContent }
diff --git a/examples/apps/screenpipe-app-tauri/lib/hooks/use-pipes.tsx b/examples/apps/screenpipe-app-tauri/lib/hooks/use-pipes.tsx
index 5f6b86b4a..c0e9a69c3 100644
--- a/examples/apps/screenpipe-app-tauri/lib/hooks/use-pipes.tsx
+++ b/examples/apps/screenpipe-app-tauri/lib/hooks/use-pipes.tsx
@@ -24,6 +24,7 @@ const convertHtmlToMarkdown = (html: string) => {
// Remove any remaining HTML tags
return convertedHtml.replace(/<[^>]*>/g, "");
};
+
const fetchReadme = async (fullName: string) => {
try {
const response = await fetch(
@@ -54,6 +55,52 @@ const fetchLatestRelease = async (fullName: string) => {
}
};
+const meetingSummarizerPipe: Pipe = {
+ name: "Local First Meeting Summarizer",
+ downloads: 42,
+ version: "1.0.0",
+ author: "Louis",
+ authorLink: "https://github.com/louis030195",
+ repository: "https://github.com/louis030195/screen-pipe",
+ lastUpdate: new Date().toISOString(),
+ description: "Summarize your meetings locally with AI",
+ fullDescription: `# Local First Meeting Summarizer
+
+This pipe allows you to summarize your meetings locally using AI. It provides a start and stop button to control the meeting duration, with an additional input for manually setting the end time if you forget to click stop.
+
+## Features
+
+- Start and stop buttons for meeting control
+- Manual end time input
+- Uses Ollama or OpenAI based on user settings
+- Removes noise from transcripts
+- Generates meeting summary with action items
+- Markdown output for easy reading and sharing
+
+## How to Use
+
+1. Click the "Start Meeting" button when your meeting begins.
+2. When the meeting ends, click the "Stop Meeting" button.
+3. If you forgot to stop the meeting, you can manually set the end time using the datetime input.
+4. The pipe will query Screenpipe for audio transcripts during the meeting duration.
+5. An AI model (Ollama or OpenAI, based on your settings) will generate a summary and extract action items.
+6. The summary will be displayed in markdown format, which you can easily copy and share.
+
+## Privacy and Security
+
+This pipe processes all data locally on your machine, ensuring your meeting content remains private and secure. No data is sent to external servers except for the AI model API calls.
+
+## Customization
+
+You can customize the AI model used for summarization in the settings. Choose between Ollama (for local processing) or OpenAI for cloud-based processing.
+
+## Feedback and Improvements
+
+We're constantly working to improve this pipe. If you have any feedback or suggestions, please open an issue on our GitHub repository.
+
+Happy summarizing!`,
+};
+
export const usePipes = (repoUrl: string) => {
const [pipes, setPipes] = useState<Pipe[]>([]);
const [loading, setLoading] = useState(true);
@@ -80,7 +127,8 @@ export const usePipes = (repoUrl: string) => {
description: data.description,
fullDescription: await fetchReadme(repoName),
};
- setPipes([pipe]);
+ setPipes([pipe, meetingSummarizerPipe]);
+
setError(null);
} catch (error) {
console.error("error fetching pipes:", error);
diff --git a/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index 326675f4e..ba1634ad3 100644
--- a/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/examples/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -10,6 +10,8 @@ interface Settings {
isLoading: boolean;
useCloudAudio: boolean;
useCloudOcr: boolean;
+ aiModel: string;
+ installedPipes: string[];
}
let store: Store | null = null;
@@ -22,6 +24,8 @@ export function useSettings() {
isLoading: true,
useCloudAudio: false,
useCloudOcr: false,
+ aiModel: "gpt-4o",
+ installedPipes: [],
});
useEffect(() => {
@@ -42,6 +46,10 @@ export function useSettings() {
const savedOllamaUrl =
((await store!.get("ollamaUrl")) as string) ||
"http://localhost:11434";
+ const savedAiModel =
+ ((await store!.get("aiModel")) as string) || "gpt-4o";
+ const savedInstalledPipes =
+ ((await store!.get("installedPipes")) as string[]) || [];
setSettings({
openaiApiKey: savedKey,
useOllama: savedUseOllama,
@@ -49,6 +57,8 @@ export function useSettings() {
useCloudAudio: savedUseCloudAudio,
useCloudOcr: savedUseCloudOcr,
ollamaUrl: savedOllamaUrl,
+ aiModel: savedAiModel,
+ installedPipes: savedInstalledPipes,
});
} catch (error) {
console.error("Failed to load settings:", error);
@@ -70,6 +80,8 @@ export function useSettings() {
await store!.set("useCloudAudio", updatedSettings.useCloudAudio);
await store!.set("useCloudOcr", updatedSettings.useCloudOcr);
await store!.set("ollamaUrl", updatedSettings.ollamaUrl);
+ await store!.set("aiModel", updatedSettings.aiModel);
+ await store!.set("installedPipes", updatedSettings.installedPipes);
await store!.save();
setSettings(updatedSettings);
} catch (error) {
diff --git a/examples/apps/screenpipe-app-tauri/package-lock.json b/examples/apps/screenpipe-app-tauri/package-lock.json
index aaaaebce5..fe451c3a2 100644
--- a/examples/apps/screenpipe-app-tauri/package-lock.json
+++ b/examples/apps/screenpipe-app-tauri/package-lock.json
@@ -17,6 +17,7 @@
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
+ "@radix-ui/react-tabs": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
"@sentry/nextjs": "^8.21.0",
"@tauri-apps/api": "^2.0.0-beta.15",
@@ -774,6 +775,126 @@
"node": ">= 10"
}
},
+ "node_modules/@next/swc-darwin-x64": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.4.tgz",
+ "integrity": "sha512-QVadW73sWIO6E2VroyUjuAxhWLZWEpiFqHdZdoQ/AMpN9YWGuHV8t2rChr0ahy+irKX5mlDU7OY68k3n4tAZTg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.4.tgz",
+ "integrity": "sha512-KT6GUrb3oyCfcfJ+WliXuJnD6pCpZiosx2X3k66HLR+DMoilRb76LpWPGb4tZprawTtcnyrv75ElD6VncVamUQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-musl": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.4.tgz",
+ "integrity": "sha512-Alv8/XGSs/ytwQcbCHwze1HmiIkIVhDHYLjczSVrf0Wi2MvKn/blt7+S6FJitj3yTlMwMxII1gIJ9WepI4aZ/A==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-gnu": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.4.tgz",
+ "integrity": "sha512-ze0ShQDBPCqxLImzw4sCdfnB3lRmN3qGMB2GWDRlq5Wqy4G36pxtNOo2usu/Nm9+V2Rh/QQnrRc2l94kYFXO6Q==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-musl": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.4.tgz",
+ "integrity": "sha512-8dwC0UJoc6fC7PX70csdaznVMNr16hQrTDAMPvLPloazlcaWfdPogq+UpZX6Drqb1OBlwowz8iG7WR0Tzk/diQ==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.4.tgz",
+ "integrity": "sha512-jxyg67NbEWkDyvM+O8UDbPAyYRZqGLQDTPwvrBBeOSyVWW/jFQkQKQ70JDqDSYg1ZDdl+E3nkbFbq8xM8E9x8A==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-ia32-msvc": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.4.tgz",
+ "integrity": "sha512-twrmN753hjXRdcrZmZttb/m5xaCBFa48Dt3FbeEItpJArxriYDunWxJn+QFXdJ3hPkm4u7CKxncVvnmgQMY1ag==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-x64-msvc": {
+ "version": "14.2.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.4.tgz",
+ "integrity": "sha512-tkLrjBzqFTP8DVrAAQmZelEahfR9OxWpFR++vAI9FBhCiIxtwHwBHC23SBHCTURBtwB4kc/x44imVOnkKGNVGg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"license": "MIT",
@@ -1756,6 +1877,35 @@
}
}
},
+ "node_modules/@radix-ui/react-tabs": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.1.0.tgz",
+ "integrity": "sha512-bZgOKB/LtZIij75FSuPzyEti/XBhJH52ExgtdVqjCIh+Nx/FW+LhnbXtbCzIi34ccyMsyOja8T0thCzoHFXNKA==",
+ "dependencies": {
+ "@radix-ui/primitive": "1.1.0",
+ "@radix-ui/react-context": "1.1.0",
+ "@radix-ui/react-direction": "1.1.0",
+ "@radix-ui/react-id": "1.1.0",
+ "@radix-ui/react-presence": "1.1.0",
+ "@radix-ui/react-primitive": "2.0.0",
+ "@radix-ui/react-roving-focus": "1.1.0",
+ "@radix-ui/react-use-controllable-state": "1.1.0"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-tooltip": {
"version": "1.1.2",
"license": "MIT",
@@ -10022,126 +10172,6 @@
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
- },
- "node_modules/@next/swc-darwin-x64": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.4.tgz",
- "integrity": "sha512-QVadW73sWIO6E2VroyUjuAxhWLZWEpiFqHdZdoQ/AMpN9YWGuHV8t2rChr0ahy+irKX5mlDU7OY68k3n4tAZTg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-gnu": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.4.tgz",
- "integrity": "sha512-KT6GUrb3oyCfcfJ+WliXuJnD6pCpZiosx2X3k66HLR+DMoilRb76LpWPGb4tZprawTtcnyrv75ElD6VncVamUQ==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-musl": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.4.tgz",
- "integrity": "sha512-Alv8/XGSs/ytwQcbCHwze1HmiIkIVhDHYLjczSVrf0Wi2MvKn/blt7+S6FJitj3yTlMwMxII1gIJ9WepI4aZ/A==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-gnu": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.4.tgz",
- "integrity": "sha512-ze0ShQDBPCqxLImzw4sCdfnB3lRmN3qGMB2GWDRlq5Wqy4G36pxtNOo2usu/Nm9+V2Rh/QQnrRc2l94kYFXO6Q==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-musl": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.4.tgz",
- "integrity": "sha512-8dwC0UJoc6fC7PX70csdaznVMNr16hQrTDAMPvLPloazlcaWfdPogq+UpZX6Drqb1OBlwowz8iG7WR0Tzk/diQ==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-arm64-msvc": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.4.tgz",
- "integrity": "sha512-jxyg67NbEWkDyvM+O8UDbPAyYRZqGLQDTPwvrBBeOSyVWW/jFQkQKQ70JDqDSYg1ZDdl+E3nkbFbq8xM8E9x8A==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-ia32-msvc": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.4.tgz",
- "integrity": "sha512-twrmN753hjXRdcrZmZttb/m5xaCBFa48Dt3FbeEItpJArxriYDunWxJn+QFXdJ3hPkm4u7CKxncVvnmgQMY1ag==",
- "cpu": [
- "ia32"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-x64-msvc": {
- "version": "14.2.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.4.tgz",
- "integrity": "sha512-tkLrjBzqFTP8DVrAAQmZelEahfR9OxWpFR++vAI9FBhCiIxtwHwBHC23SBHCTURBtwB4kc/x44imVOnkKGNVGg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
}
}
}
diff --git a/examples/apps/screenpipe-app-tauri/package.json b/examples/apps/screenpipe-app-tauri/package.json
index f7af2e8fa..3baa438c0 100644
--- a/examples/apps/screenpipe-app-tauri/package.json
+++ b/examples/apps/screenpipe-app-tauri/package.json
@@ -21,6 +21,7 @@
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
+ "@radix-ui/react-tabs": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
"@sentry/nextjs": "^8.21.0",
"@tauri-apps/api": "^2.0.0-beta.15",
diff --git a/examples/typescript/perplexity-alike-asking-confirmation-rag-agent/screenpipe.ts b/examples/typescript/perplexity-alike-asking-confirmation-rag-agent/screenpipe.ts
index afd18e01e..cab8d20d1 100644
--- a/examples/typescript/perplexity-alike-asking-confirmation-rag-agent/screenpipe.ts
+++ b/examples/typescript/perplexity-alike-asking-confirmation-rag-agent/screenpipe.ts
@@ -19,9 +19,9 @@ const screenpipeQuery = z.object({
),
limit: z
.number()
- .default(100)
+ .default(20)
.describe(
- "Number of results to return (default: 5). Don't return more than 50 results as it will be fed to an LLM"
+ "Number of results to return (default: 20). Don't return more than 50 results as it will be fed to an LLM"
),
offset: z.number().default(0).describe("Offset for pagination (default: 0)"),
start_time: z