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: pipe store

Louis Beaumont18f714f4913c
diff --git a/examples/apps/screenpipe-app-tauri/app/page.tsx b/examples/apps/screenpipe-app-tauri/app/page.tsx
index 12a2dd44d..a5a34cdf6 100644
--- a/examples/apps/screenpipe-app-tauri/app/page.tsx
+++ b/examples/apps/screenpipe-app-tauri/app/page.tsx
@@ -43,6 +43,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import React from "react";
+import PipeDialog from "@/components/pipe-store";
function Header() {
return (
@@ -86,8 +87,9 @@ function Header() {
{/* Added margin-top for spacing */}
<HealthStatus className="mt-3" />
<Settings />
+ <PipeDialog />
{/* <LogViewer /> */}
- <PrettyLink href="https://github.com/louis030195/screen-pipe/tree/main/examples/ts">
+ {/* <PrettyLink href="https://github.com/louis030195/screen-pipe/tree/main/examples/ts">
<span className="mr-2">Examples</span>
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -104,8 +106,11 @@ function Header() {
<polyline points="15 3 21 3 21 9" />
<line x1="10" y1="14" x2="21" y2="3" />
</svg>
- </PrettyLink>
- <PrettyLink href="mailto:[email protected]?subject=Screenpipe%20Feedback&body=Please%20enter%20your%20feedback%20here...%0A%0A...%20or%20let's%20chat?%0Ahttps://cal.com/louis030195/screenpipe">
+ </PrettyLink> */}
+ <PrettyLink
+ variant="outline"
+ href="mailto:[email protected]?subject=Screenpipe%20Feedback&body=Please%20enter%20your%20feedback%20here...%0A%0A...%20or%20let's%20chat?%0Ahttps://cal.com/louis030195/screenpipe"
+ >
<span className="mr-2">Send feedback</span>
<svg
xmlns="http://www.w3.org/2000/svg"
diff --git a/examples/apps/screenpipe-app-tauri/bun.lockb b/examples/apps/screenpipe-app-tauri/bun.lockb
index a0fbf2e86..9d819fb83 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 765ba3bf1..89a076de7 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
@@ -20,7 +20,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ChatMessage } from "./chat-message-v2";
import { Message, generateText, nanoid, streamText, tool } from "ai";
import { createOpenAI, openai } from "@ai-sdk/openai";
-import { createOllama } from "ollama-ai-provider";
+import { ollama } from "ollama-ai-provider";
import { IconOpenAI } from "./ui/icons";
import { spinner } from "./spinner";
@@ -119,12 +119,12 @@ export function ChatList({
try {
const provider = useOllama
- ? createOllama()
+ ? ollama
: createOpenAI({
apiKey: apiKey,
});
- const model = useOllama ? "llama3" : "gpt-4o";
+ const model = useOllama ? "llama3.1" : "gpt-4o";
// Test Ollama connection
if (useOllama) {
@@ -140,7 +140,7 @@ export function ChatList({
console.log("model", model);
const text = await generateText({
- model: provider("gpt-4o"),
+ model: useOllama ? ollama(model) : provider(model),
tools: {
query_screenpipe: {
description:
diff --git a/examples/apps/screenpipe-app-tauri/components/pipe-store.tsx b/examples/apps/screenpipe-app-tauri/components/pipe-store.tsx
new file mode 100644
index 000000000..e272adc54
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/components/pipe-store.tsx
@@ -0,0 +1,222 @@
+import React, { useState } from "react";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "@/components/ui/dialog";
+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 { MemoizedReactMarkdown } from "@/components/markdown";
+import { usePipes, Pipe } from "@/lib/hooks/use-pipes";
+import { CodeBlock } from "@/components/ui/codeblock";
+import remarkGfm from "remark-gfm";
+import remarkMath from "remark-math";
+import { Skeleton } from "./ui/skeleton";
+const formatDate = (dateString: string) => {
+ const date = new Date(dateString);
+ return date.toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ });
+};
+const PipeDialog: React.FC = () => {
+ const { pipes, loading, error } = usePipes(
+ "https://github.com/different-ai/file-organizer-2000"
+ );
+ const [selectedPipe, setSelectedPipe] = useState<Pipe | null>(null);
+
+ const formatUpdatedTime = (date: string) => {
+ const now = new Date();
+ const updated = new Date(date);
+ const diffTime = Math.abs(now.getTime() - updated.getTime());
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
+ return `${diffDays} day${diffDays > 1 ? "s" : ""} ago`;
+ };
+
+ return (
+ <Dialog>
+ <DialogTrigger asChild>
+ <Button variant="ghost">Pipe Store</Button>
+ </DialogTrigger>
+ <DialogContent className="max-w-[90vw] w-full max-h-[90vh] h-full">
+ <DialogHeader>
+ <DialogTitle>Pipes</DialogTitle>
+ </DialogHeader>
+ <div className="flex h-[600px]">
+ <div className="w-1/3 pr-4 overflow-y-auto">
+ {loading &&
+ Array(5)
+ .fill(0)
+ .map((_, index) => (
+ <div key={index} className="mb-2">
+ <Skeleton className="h-24 w-full" />
+ </div>
+ ))}
+ {error && <p>Error: {error}</p>}
+ {pipes.map((pipe: any) => (
+ <Card
+ key={pipe.name}
+ className="cursor-pointer hover:bg-gray-100 mb-2 p-2"
+ onClick={() => setSelectedPipe(pipe)}
+ >
+ <div className="flex justify-between items-start">
+ <div>
+ <h3 className="text-sm font-semibold">{pipe.name}</h3>
+ <p className="text-xs text-gray-500">by {pipe.author}</p>
+ </div>
+ <div className="text-xs text-gray-500 flex items-center">
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ className="h-3 w-3 mr-1"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ >
+ <path
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth={2}
+ d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
+ />
+ </svg>
+ {pipe.downloads}
+ </div>
+ </div>
+ <p className="text-xs mt-1 line-clamp-2">{pipe.description}</p>
+ <p className="text-xs text-gray-500 mt-1">
+ Updated {formatUpdatedTime(pipe.lastUpdate)}
+ </p>
+ </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 }) {
+ console.log("YOOOO SOME PP", 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 }) {
+ console.log("YOOOO", src);
+ 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>
+ </>
+ )}
+ </div>
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+};
+
+export default PipeDialog;
diff --git a/examples/apps/screenpipe-app-tauri/components/pretty-link.tsx b/examples/apps/screenpipe-app-tauri/components/pretty-link.tsx
index 6e721dc3f..02b4d108d 100644
--- a/examples/apps/screenpipe-app-tauri/components/pretty-link.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/pretty-link.tsx
@@ -3,9 +3,11 @@ import { cn } from "@/lib/utils";
export function PrettyLink({
href,
children,
+ variant = "filled",
}: {
href: string;
children: React.ReactNode;
+ variant?: "filled" | "outline";
}) {
return (
<a
@@ -13,10 +15,13 @@ export function PrettyLink({
target="_blank"
rel="noopener noreferrer"
className={cn(
- "inline-flex items-center rounded-md bg-gray-600 px-4 py-2",
- "text-sm font-medium text-white shadow-sm",
- "hover:bg-gray-700 focus:outline-none focus:ring-2",
- "focus:ring-gray-500 focus:ring-offset-2 transition-colors duration-200"
+ "inline-flex items-center rounded-md px-4 py-2",
+ "text-sm font-medium shadow-sm",
+ "focus:outline-none focus:ring-2",
+ "focus:ring-gray-500 focus:ring-offset-2 transition-colors duration-200",
+ variant === "filled"
+ ? "bg-gray-600 text-white hover:bg-gray-700"
+ : "bg-transparent text-gray-600 border border-gray-600 hover:bg-gray-100"
)}
>
{children}
diff --git a/examples/apps/screenpipe-app-tauri/components/settings.tsx b/examples/apps/screenpipe-app-tauri/components/settings.tsx
index 000e8729b..4fb7614cd 100644
--- a/examples/apps/screenpipe-app-tauri/components/settings.tsx
+++ b/examples/apps/screenpipe-app-tauri/components/settings.tsx
@@ -22,11 +22,23 @@ import { Badge } from "@/components/ui/badge";
export function Settings({ className }: { className?: string }) {
const { settings, updateSettings } = useSettings();
+ const [localSettings, setLocalSettings] = React.useState(settings);
const handleApiKeyChange = (e: React.ChangeEvent<HTMLInputElement>) => {
- updateSettings({ openaiApiKey: e.target.value });
+ setLocalSettings({ ...localSettings, openaiApiKey: e.target.value });
+ updateSettings({ ...localSettings, openaiApiKey: e.target.value });
};
+ const handleOllamaToggle = (checked: boolean) => {
+ console.log("checked", checked);
+ setLocalSettings({ ...localSettings, useOllama: checked });
+ updateSettings({ ...localSettings, useOllama: checked });
+ };
+
+ React.useEffect(() => {
+ setLocalSettings(settings);
+ }, [settings]);
+
return (
<Dialog
onOpenChange={(open) => {
@@ -52,23 +64,23 @@ export function Settings({ className }: { className?: string }) {
<Tooltip>
<TooltipTrigger asChild>
<div className="flex items-center space-x-4">
- <Switch id="use-ollama" checked={false} disabled={true} />
+ <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">
- Soon
- </Badge>
</Label>
</div>
</TooltipTrigger>
<TooltipContent>
<p>
- Ollama support is coming soon. It currently doesn&apos;t
- support function calling, which is required for this
- application.
+ toggle to use ollama instead of openai api. make sure to have
+ ollama running locally.
</p>
</TooltipContent>
</Tooltip>
diff --git a/examples/apps/screenpipe-app-tauri/components/ui/separator.tsx b/examples/apps/screenpipe-app-tauri/components/ui/separator.tsx
new file mode 100644
index 000000000..12d81c4a8
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/components/ui/separator.tsx
@@ -0,0 +1,31 @@
+"use client"
+
+import * as React from "react"
+import * as SeparatorPrimitive from "@radix-ui/react-separator"
+
+import { cn } from "@/lib/utils"
+
+const Separator = React.forwardRef<
+ React.ElementRef<typeof SeparatorPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
+>(
+ (
+ { className, orientation = "horizontal", decorative = true, ...props },
+ ref
+ ) => (
+ <SeparatorPrimitive.Root
+ ref={ref}
+ decorative={decorative}
+ orientation={orientation}
+ className={cn(
+ "shrink-0 bg-border",
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
+ className
+ )}
+ {...props}
+ />
+ )
+)
+Separator.displayName = SeparatorPrimitive.Root.displayName
+
+export { Separator }
diff --git a/examples/apps/screenpipe-app-tauri/lib/hooks/use-pipes.tsx b/examples/apps/screenpipe-app-tauri/lib/hooks/use-pipes.tsx
new file mode 100644
index 000000000..ed64f69c1
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/lib/hooks/use-pipes.tsx
@@ -0,0 +1,97 @@
+import { useState, useEffect } from "react";
+
+export type Pipe = {
+ name: string;
+ downloads: number;
+ version: string;
+ author: string;
+ authorLink: string;
+ repository: string;
+ lastUpdate: string;
+ description: string;
+ fullDescription: string;
+};
+
+const convertHtmlToMarkdown = (html: string) => {
+ // Convert <img> tags to Markdown
+ const convertedHtml = html.replace(
+ /<img\s+(?:[^>]*?\s+)?src="([^"]*)"(?:\s+(?:[^>]*?\s+)?alt="([^"]*)")?\s*\/?>/g,
+ (match, src, alt) => {
+ return `![${alt || ""}](${src})`;
+ }
+ );
+
+ // Remove any remaining HTML tags
+ return convertedHtml.replace(/<[^>]*>/g, "");
+};
+const fetchReadme = async (fullName: string) => {
+ try {
+ const response = await fetch(
+ `https://api.github.com/repos/${fullName}/readme`
+ );
+ const data = await response.json();
+ const decodedContent = atob(data.content);
+ console.log("YOOOO dd", decodedContent);
+ const markdown = convertHtmlToMarkdown(decodedContent);
+ console.log("YOOOO md", markdown);
+ return markdown;
+ } catch (error) {
+ console.error("error fetching readme:", error);
+ return "";
+ }
+};
+
+const fetchLatestRelease = async (fullName: string) => {
+ try {
+ const response = await fetch(
+ `https://api.github.com/repos/${fullName}/releases/latest`
+ );
+ const data = await response.json();
+ return data.tag_name;
+ } catch (error) {
+ console.error("error fetching latest release:", error);
+ return "";
+ }
+};
+
+export const usePipes = (repoUrl: string) => {
+ const [pipes, setPipes] = useState<Pipe[]>([]);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState<string | null>(null);
+
+ useEffect(() => {
+ const fetchPipes = async () => {
+ try {
+ setLoading(true);
+ const repoName = repoUrl.split("/").slice(-2).join("/");
+ const response = await fetch(
+ `https://api.github.com/repos/${repoName}`
+ );
+ const data = await response.json();
+ const latestVersion = await fetchLatestRelease(repoName);
+ const pipe: Pipe = {
+ name: data.name,
+ downloads: data.stargazers_count,
+ version: latestVersion || data.default_branch,
+ author: data.owner.login,
+ authorLink: data.owner.html_url,
+ repository: data.html_url,
+ lastUpdate: data.updated_at,
+ description: data.description,
+ fullDescription: await fetchReadme(repoName),
+ };
+ setPipes([pipe]);
+ setError(null);
+ } catch (error) {
+ console.error("error fetching pipes:", error);
+ setError("Failed to fetch pipes");
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ fetchPipes();
+ }, [repoUrl]);
+
+ return { pipes, loading, error };
+};
diff --git a/examples/apps/screenpipe-app-tauri/package.json b/examples/apps/screenpipe-app-tauri/package.json
index 191868aab..65b174d9f 100644
--- a/examples/apps/screenpipe-app-tauri/package.json
+++ b/examples/apps/screenpipe-app-tauri/package.json
@@ -8,7 +8,7 @@
"lint": "next lint",
"build": "next build",
"tauri": "tauri",
- "clean": "rm -rf out && cargo clean && rm -rf src-tauri/{screenpipe,tesseract,ffmpeg}"
+ "clean": "rm -rf out && cargo clean && rm -rf src-tauri/{screenpipe,tesseract,ffmpeg} node_modules"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.39",
@@ -19,6 +19,7 @@
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
+ "@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
diff --git a/examples/apps/screenpipe-app-tauri/pnpm-lock.yaml b/examples/apps/screenpipe-app-tauri/pnpm-lock.yaml
index b2f90cb0f..e6fe8dc86 100644
--- a/examples/apps/screenpipe-app-tauri/pnpm-lock.yaml
+++ b/examples/apps/screenpipe-app-tauri/pnpm-lock.yaml
@@ -32,6 +32,9 @@ dependencies:
'@radix-ui/react-slot':
specifier: ^1.1.0
version: 1.1.0(@types/[email protected])([email protected])
+ '@radix-ui/react-switch':
+ specifier: ^1.1.0
'@radix-ui/react-tooltip':
specifier: ^1.1.2
@@ -1069,6 +1072,32 @@ packages:
react: 18.3.1
dev: false
+ resolution: {integrity: sha512-OBzy5WAj641k0AOSpKQtreDMe+isX0MQJ1IVyF03ucdF3DunOnROVrjWs8zsXUxC3zfZ6JL9HFVCUlMghz9dJw==}
+ 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
+ dependencies:
+ '@radix-ui/primitive': 1.1.0
+ '@radix-ui/react-compose-refs': 1.1.0(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.0(@types/[email protected])([email protected])
+ '@radix-ui/react-primitive': 2.0.0(@types/[email protected])(@types/[email protected])([email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.1.0(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.0(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.0(@types/[email protected])([email protected])
+ '@types/react': 18.3.3
+ '@types/react-dom': 18.3.0
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ dev: false
+
resolution: {integrity: sha512-9XRsLwe6Yb9B/tlnYCPVUd/TFS4J7HuOZW345DCeC6vKIxQGMZdx21RK4VoZauPD5frgkXTYVS5y90L+3YBn4w==}
peerDependencies:
@@ -1154,6 +1183,19 @@ packages:
react: 18.3.1
dev: false
+ resolution: {integrity: sha512-Z/e78qg2YFnnXcW88A4JmTtm4ADckLno6F7OXotmkQfeuCVaKuYzqAATPhVzl3delXE7CxIV8shofPn3jPc5Og==}
+ peerDependencies:
+ '@types/react': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ dependencies:
+ '@types/react': 18.3.3
+ react: 18.3.1
+ dev: false
+
resolution: {integrity: sha512-0Fmkebhr6PiseyZlYAOtLS+nb7jLmpqTrJyv61Pe68MKYW6OWdRE2kI70TaYY27u7H0lajqM3hSMMLFq18Z7nQ==}
peerDependencies:
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.icns b/examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.icns
index 6aadc8307..56ddec9c8 100644
Binary files a/examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.icns and b/examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.icns differ