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

chore: unify style + make ai model customisable

Louis Beaumont18659215684a
diff --git a/pipes/timeline/src/components/search-chat.tsx b/pipes/timeline/src/components/search-chat.tsx
deleted file mode 100644
index 7d4f0a983..000000000
--- a/pipes/timeline/src/components/search-chat.tsx
+++ /dev/null
@@ -1,1855 +0,0 @@
-"use client";
-
-import React, { JSX, useEffect, useRef, useState } from "react";
-import { Input } from "@/components/ui/input";
-import { Button } from "@/components/ui/button";
-import { Card, CardContent } from "@/components/ui/card";
-import { pipe, ContentItem } from "@screenpipe/js";
-import { Skeleton } from "@/components/ui/skeleton";
-import { Slider } from "@/components/ui/slider";
-import { Switch } from "@/components/ui/switch";
-import { Label } from "@/components/ui/label";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select";
-import { Progress } from "@/components/ui/progress";
-import { DateTimePicker } from "./date-time-picker";
-import { Badge } from "./ui/badge";
-import {
- ChevronDown,
- ChevronLeft,
- ChevronRight,
- HelpCircle,
- Laptop,
- Layers,
- Layout,
- Loader2,
- Search,
- Send,
- Square,
- Clock,
- Check,
- Plus,
- SpeechIcon,
- ChevronsUpDown,
-} from "lucide-react";
-import { useToast } from "@/components/ui/use-toast";
-import { AnimatePresence, motion } from "framer-motion";
-import { generateId, Message } from "ai";
-import { OpenAI } from "openai";
-import { ChatMessage } from "@/components/chat-message";
-import { spinner } from "@/components/spinner";
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
-} from "@/components/ui/accordion";
-import { VideoComponent } from "@/components/video";
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
- DialogFooter,
-} from "@/components/ui/dialog";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip";
-import { Separator } from "@/components/ui/separator";
-import { ContextUsageIndicator } from "@/components/context-usage-indicator";
-import { Checkbox } from "@/components/ui/checkbox";
-import { IconCode } from "@/components/ui/icons";
-import { CodeBlock } from "@/components/ui/codeblock";
-import { SqlAutocompleteInput } from "@/components/sql-autocomplete-input";
-import { cn, removeDuplicateSelections } from "@/lib/utils";
-import {
- ExampleSearch,
- ExampleSearchCards,
-} from "@/components/example-search-cards";
-import { useDebounce } from "@/lib/hooks/use-debounce";
-import { useHealthCheck } from "@/lib/hooks/use-health-check";
-import {
- SearchHistory,
- useSearchHistory,
-} from "@/lib/hooks/use-search-history";
-import {
- CommandInput,
- CommandList,
- CommandEmpty,
- CommandGroup,
- CommandItem,
- Command,
-} from "./ui/command";
-import { Speaker } from "@screenpipe/js";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/ui/popover";
-import { useSettings } from "@/lib/hooks/use-settings";
-
-interface Agent {
- id: string;
- name: string;
- description: string;
- dataSelector: (results: ContentItem[]) => any;
- systemPrompt: string;
-}
-
-const AGENTS: Agent[] = [
- {
- id: "context-master",
- name: "context master",
- description: "analyzes everything: apps, windows, text & audio",
- systemPrompt:
- "you analyze all types of data from screen recordings and audio transcriptions. provide comprehensive insights.",
- dataSelector: (results) => results,
- },
- {
- id: "window-detective",
- name: "window detective",
- description: "focuses on app usage patterns",
- systemPrompt:
- "you specialize in analyzing app usage patterns and window switching behavior. help users understand their app usage.",
- dataSelector: (results) =>
- results
- .filter(
- (item) =>
- item.type === "OCR" &&
- (item.content.appName || item.content.windowName)
- )
- .map((item) => ({
- timestamp: item.content.timestamp,
- // @ts-ignore
- appName: item.content.appName,
- // @ts-ignore
- windowName: item.content.windowName,
- })),
- },
- {
- id: "text-oracle",
- name: "text oracle",
- description: "analyzes screen text (OCR)",
- systemPrompt:
- "you focus on text extracted from screen recordings. help users find and understand text content.",
- dataSelector: (results) =>
- results
- .filter((item) => item.type === "OCR")
- .map((item) => ({
- timestamp: item.content.timestamp,
- text: item.content.text,
- appName: item.content.appName,
- })),
- },
- {
- id: "voice-sage",
- name: "voice sage",
- description: "focuses on audio transcriptions",
- systemPrompt:
- "you analyze audio transcriptions from recordings. help users understand spoken content.",
- dataSelector: (results) =>
- results
- .filter((item) => item.type === "Audio")
- .map((item) => ({
- timestamp: item.content.timestamp,
- transcription: item.content.transcription,
- })),
- },
-];
-
-// Add this helper function to highlight keywords in text
-const highlightKeyword = (text: string, keyword: string): JSX.Element => {
- if (!keyword || !text) return <>{text}</>;
-
- const parts = text.split(new RegExp(`(${keyword})`, "gi"));
- return (
- <>
- {parts.map((part, i) =>
- part.toLowerCase() === keyword.toLowerCase() ? (
- <span
- key={i}
- className="bg-yellow-200 dark:bg-yellow-800 rounded px-0.5"
- >
- {part}
- </span>
- ) : (
- part
- )
- )}
- </>
- );
-};
-
-// Update the getContextAroundKeyword function to return both text and positions
-const getContextAroundKeyword = (
- text: string,
- keyword: string,
- contextLength: number = 40
-): string => {
- if (!keyword || !text) return text;
-
- const index = text.toLowerCase().indexOf(keyword.toLowerCase());
- if (index === -1) return text;
-
- const start = Math.max(0, index - contextLength);
- const end = Math.min(text.length, index + keyword.length + contextLength);
-
- let result = text.slice(start, end);
- if (start > 0) result = "..." + result;
- if (end < text.length) result = result + "...";
-
- return result;
-};
-
-export function SearchChat() {
- const {
- searches,
- currentSearchId,
- setCurrentSearchId,
- addSearch,
- deleteSearch,
- isCollapsed,
- toggleCollapse,
- } = useSearchHistory();
- // Search state
- const { health } = useHealthCheck();
- const [query, setQuery] = useState("");
- const [results, setResults] = useState<ContentItem[]>([]);
- const [isLoading, setIsLoading] = useState(false);
- const [startDate, setStartDate] = useState<Date>(
- new Date(Date.now() - 24 * 3600000)
- );
- const [endDate, setEndDate] = useState<Date>(new Date());
- const [includeFrames, setIncludeFrames] = useState(false);
- const [limit, setLimit] = useState(30);
- const [appName, setAppName] = useState("");
- const [windowName, setWindowName] = useState("");
- const [contentType, setContentType] = useState("all");
- const [offset, setOffset] = useState(0);
- const [totalResults, setTotalResults] = useState(0);
- const { settings } = useSettings();
- const [isAiLoading, setIsAiLoading] = useState(false);
- const [minLength, setMinLength] = useState(50);
- const [maxLength, setMaxLength] = useState(10000);
- const [speakers, setSpeakers] = useState<Speaker[]>([]);
- const [selectedSpeakers, setSelectedSpeakers] = useState<{
- [key: number]: Speaker;
- }>({});
- const [openSpeakers, setOpenSpeakers] = useState(false);
- // Chat state
- const [chatMessages, setChatMessages] = useState<Array<Message>>([]);
-
- const { toast } = useToast();
- const [progress, setProgress] = useState(0);
-
- const [floatingInput, setFloatingInput] = useState("");
- const [isFloatingInputVisible, setIsFloatingInputVisible] = useState(false);
-
- const floatingInputRef = useRef<HTMLInputElement>(null);
- const [showScrollButton, setShowScrollButton] = useState(false);
-
- const [isUserScrolling, setIsUserScrolling] = useState(false);
- const lastScrollPosition = useRef(0);
-
- const MAX_CONTENT_LENGTH = settings.aiMaxContextChars;
-
- const [selectedResults, setSelectedResults] = useState<Set<number>>(
- new Set()
- );
- const [similarityThreshold, setSimilarityThreshold] = useState(1);
- const [hoveredResult, setHoveredResult] = useState<number | null>(null);
-
- const [isCurlDialogOpen, setIsCurlDialogOpen] = useState(false);
-
- const [isStreaming, setIsStreaming] = useState(false);
- const abortControllerRef = useRef<AbortController | null>(null);
-
- const [selectAll, setSelectAll] = useState(true);
-
- const [showExamples, setShowExamples] = useState(true);
-
- const [hasSearched, setHasSearched] = useState(false);
-
- const [isFiltering, setIsFiltering] = useState(false);
- const debouncedThreshold = useDebounce(similarityThreshold, 300);
-
- const [isQueryParamsDialogOpen, setIsQueryParamsDialogOpen] = useState(false);
-
- // Add state for individual content types
- const [selectedTypes, setSelectedTypes] = useState({
- ocr: false,
- audio: false,
- ui: false,
- });
-
- // Add new state near the top with other state declarations
- const [hideDeselected, setHideDeselected] = useState(false);
-
- const [currentPlatform, setCurrentPlatform] = useState<string | null>(null);
-
- const [speakerSearchQuery, setSpeakerSearchQuery] = useState("");
-
- useEffect(() => {
- if (Object.keys(selectedSpeakers).length > 0) {
- setSelectedTypes({
- ocr: false,
- ui: false,
- audio: true,
- });
- setContentType("audio");
- }
- }, [selectedSpeakers]);
-
- useEffect(() => {
- // More reliable OS detection
- const platform = window.navigator.platform.toLowerCase();
- const os = platform.includes("mac")
- ? "macos"
- : platform.includes("win")
- ? "windows"
- : platform.includes("linux")
- ? "linux"
- : "unknown";
-
- setCurrentPlatform(os);
- }, []);
-
- const handleSpeakerChange = (speaker: Speaker) => {
- setSelectedSpeakers((prev) => {
- const newSpeakers = { ...prev, [speaker.id]: speaker };
-
- if (prev[speaker.id]) {
- delete newSpeakers[speaker.id];
- }
-
- return newSpeakers;
- });
- };
-
- useEffect(() => {
- if (isQueryParamsDialogOpen && !speakers.length) {
- loadSpeakers();
- }
- }, [isQueryParamsDialogOpen]);
-
- useEffect(() => {
- loadSpeakers();
- }, [speakerSearchQuery]);
-
- const loadSpeakers = async () => {
- try {
- const getSpeakers = await fetch(
- `http://localhost:3030/speakers/search?name=${speakerSearchQuery}`
- );
- const speakers = await getSpeakers.json();
- setSpeakers(speakers);
- } catch (error) {
- console.error("Error loading speakers:", error);
- setSpeakers([]);
- }
- };
-
- // Update content type when checkboxes change
- const handleContentTypeChange = (type: "ocr" | "audio" | "ui") => {
- const newTypes = { ...selectedTypes, [type]: !selectedTypes[type] };
- setSelectedTypes(newTypes);
-
- if (Object.keys(selectedSpeakers).length > 0) {
- setSelectedTypes({
- ocr: false,
- ui: false,
- audio: true,
- });
- setContentType("audio");
- }
-
- // Convert checkbox state to content type
- if (!newTypes.ocr && !newTypes.audio && !newTypes.ui) {
- setContentType("all"); // fallback to all if nothing selected
- } else if (newTypes.audio && newTypes.ui && !newTypes.ocr) {
- setContentType("audio+ui");
- } else if (newTypes.ocr && newTypes.ui && !newTypes.audio) {
- setContentType("ocr+ui");
- } else if (newTypes.audio && newTypes.ocr && !newTypes.ui) {
- setContentType("audio+ocr");
- } else if (newTypes.audio) {
- setContentType("audio");
- } else if (newTypes.ocr) {
- setContentType("ocr");
- } else if (newTypes.ui) {
- setContentType("ui"); // This was missing - single UI type
- } else {
- setContentType("all");
- }
- };
-
- const [selectedAgent, setSelectedAgent] = useState<Agent>(AGENTS[0]);
-
- useEffect(() => {
- const updateDates = () => {
- const now = new Date();
- setEndDate(now);
- // Optionally update startDate if you want to maintain a rolling time window
- // setStartDate(new Date(now.getTime() - 24 * 3600000)); // 24 hours ago
- };
-
- // Update dates immediately
- updateDates();
-
- // Set up interval to update dates every 5 minutes
- const intervalId = setInterval(updateDates, 5 * 60 * 1000);
-
- // Add event listener for when the page becomes visible
- document.addEventListener("visibilitychange", () => {
- if (!document.hidden) {
- updateDates();
- }
- });
-
- // Clean up on component unmount
- return () => {
- clearInterval(intervalId);
- document.removeEventListener("visibilitychange", updateDates);
- };
- }, []);
-
- const handleExampleSelect = async (example: ExampleSearch) => {
- const newWindowName = example.windowName || "";
- const newAppName = example.appName || "";
- const newLimit = example.limit || limit;
- const newMinLength = example.minLength || minLength;
- const newContentType =
- (example.contentType as "all" | "ocr" | "audio") || contentType;
- const newStartDate = example.startDate;
-
- setWindowName(newWindowName);
- setAppName(newAppName);
- setLimit(newLimit);
- setMinLength(newMinLength);
- setContentType(newContentType);
- setStartDate(newStartDate);
- setShowExamples(false);
-
- handleSearch(0, {
- windowName: newWindowName,
- appName: newAppName,
- limit: newLimit,
- minLength: newMinLength,
- contentType: newContentType,
- startDate: newStartDate,
- });
- };
-
- const generateCurlCommand = () => {
- const baseUrl = "http://localhost:3030";
- const params = {
- content_type: contentType,
- limit: limit.toString(),
- offset: offset.toString(),
- start_time: startDate.toISOString(),
- end_time: endDate.toISOString(),
- min_length: minLength.toString(),
- max_length: maxLength.toString(),
- q: query,
- app_name: appName,
- window_name: windowName,
- include_frames: includeFrames ? "true" : undefined,
- };
-
- const queryParams = Object.entries(params)
- .filter(([_, value]) => value !== undefined && value !== "")
- .map(([key, value]) => `${key}=${encodeURIComponent(value!)}`)
- .join("&");
-
- return `curl "${baseUrl}/search?${queryParams}" | jq`;
- };
-
- useEffect(() => {
- if (results.length > 0) {
- setSelectedResults(new Set(results.map((_, index) => index)));
- setSelectAll(true);
- }
- }, [results]);
-
- useEffect(() => {
- handleFilterDuplicates();
- }, [debouncedThreshold, results]);
-
- const handleFilterDuplicates = async () => {
- if (similarityThreshold === 1) {
- setSelectedResults(new Set(results.map((_, index) => index)));
- setSelectAll(true);
- return;
- }
- setIsFiltering(true);
- // simulate a delay to show loading state
- await new Promise((resolve) => setTimeout(resolve, 100));
-
- const allIndices = new Set(results.map((_, index) => index));
- setSelectedResults(
- removeDuplicateSelections(results, allIndices, debouncedThreshold)
- );
- setSelectAll(false);
- setIsFiltering(false);
- };
-
- useEffect(() => {
- const handleScroll = () => {
- const currentScrollPosition = window.scrollY;
- const scrollPercentage =
- (currentScrollPosition /
- (document.documentElement.scrollHeight - window.innerHeight)) *
- 100;
- const shouldShow = scrollPercentage < 90; // Show when scrolled up more than 10%
-
- setShowScrollButton(shouldShow);
-
- // Check if user is scrolling up while AI is loading
- if (isAiLoading && currentScrollPosition < lastScrollPosition.current) {
- setIsUserScrolling(true);
- }
-
- lastScrollPosition.current = currentScrollPosition;
- };
-
- window.addEventListener("scroll", handleScroll);
-
- return () => window.removeEventListener("scroll", handleScroll);
- }, [isAiLoading]);
-
- const scrollToBottom = () => {
- if (!isUserScrolling) {
- window.scrollTo({
- top: document.documentElement.scrollHeight,
- behavior: "smooth",
- });
- }
- };
-
- useEffect(() => {
- const handleKeyDown = (event: KeyboardEvent) => {
- if (event.key === "/") {
- event.preventDefault();
- setIsFloatingInputVisible(true);
- } else if (event.key === "Escape") {
- setIsFloatingInputVisible(false);
- }
- };
-
- window.addEventListener("keydown", handleKeyDown);
- return () => window.removeEventListener("keydown", handleKeyDown);
- }, []);
-
- useEffect(() => {
- if (isFloatingInputVisible && floatingInputRef.current) {
- floatingInputRef.current.focus();
- }
- }, [isFloatingInputVisible]);
-
- const handleResultSelection = (index: number) => {
- setSelectedResults((prev) => {
- const newSet = new Set(prev);
- if (newSet.has(index)) {
- newSet.delete(index);
- } else {
- newSet.add(index);
- }
- return newSet;
- });
- };
-
- const calculateSelectedContentLength = () => {
- return Array.from(selectedResults).reduce((total, index) => {
- const item = results[index];
- if (!item || !item.type) return total; // Add this check
-
- const contentLength =
- item.type === "OCR"
- ? item.content.text.length
- : item.type === "Audio"
- ? item.content.transcription.length
- : item.type === "UI"
- ? item.content.text.length
- : 0;
- return total + contentLength;
- }, 0);
- };
-
- const handleFloatingInputSubmit = async (e: React.FormEvent) => {
- e.preventDefault();
- if (!floatingInput.trim() && !isStreaming) return;
-
- if (isStreaming) {
- handleStopStreaming();
- return;
- }
-
- scrollToBottom();
-
- const selectedContentLength = calculateSelectedContentLength();
- if (selectedContentLength > MAX_CONTENT_LENGTH) {
- toast({
- title: "Content too large",
- description: `The selected content length (${selectedContentLength} characters) exceeds the maximum allowed (${MAX_CONTENT_LENGTH} characters). Please unselect some items to reduce the amount of content.`,
- variant: "destructive",
- });
- return;
- }
-
- const userMessage = {
- id: generateId(),
- role: "user" as const,
- content: floatingInput,
- };
- setChatMessages((prevMessages) => [
- ...prevMessages,
- userMessage,
- { id: generateId(), role: "assistant", content: "" },
- ]);
- setFloatingInput("");
- setIsAiLoading(true);
-
- try {
- const openai = new OpenAI({
- apiKey: settings.openaiApiKey,
- baseURL: settings.aiUrl,
- dangerouslyAllowBrowser: true,
- });
- console.log("openai", settings.openaiApiKey, settings.aiUrl);
-
- const model = settings.aiModel;
- const customPrompt = settings.customPrompt || "";
-
- const messages = [
- {
- role: "system" as const,
- content: `You are a helpful assistant specialized as a "${
- selectedAgent.name
- }". ${selectedAgent.systemPrompt}
- Rules:
- - Current time (JavaScript Date.prototype.toString): ${new Date().toString()}
- - User timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}
- - User timezone offset: ${new Date().getTimezoneOffset()}
- - ${customPrompt ? `Custom prompt: ${customPrompt}` : ""}
- `,
- },
- ...chatMessages.map((msg) => ({
- role: msg.role as "user" | "assistant" | "system",
- content: msg.content,
- })),
- {
- role: "user" as const,
- content: `Context data: ${JSON.stringify(
- selectedAgent.dataSelector(
- results.filter((_, index) => selectedResults.has(index))
- )
- )}
-
- User query: ${floatingInput}`,
- },
- ];
-
- console.log("messages", messages);
-
- abortControllerRef.current = new AbortController();
- setIsStreaming(true);
-
- const stream = await openai.chat.completions.create(
- {
- model: model,
- messages: messages,
- stream: true,
- },
- {
- signal: abortControllerRef.current.signal,
- }
- );
-
- let fullResponse = "";
- // @ts-ignore
- setChatMessages((prevMessages) => [
- ...prevMessages.slice(0, -1),
- { id: generateId(), role: "assistant", content: fullResponse },
- ]);
-
- setIsUserScrolling(false);
- lastScrollPosition.current = window.scrollY;
- scrollToBottom();
-
- for await (const chunk of stream) {
- const content = chunk.choices[0]?.delta?.content || "";
- fullResponse += content;
- // @ts-ignore
- setChatMessages((prevMessages) => [
- ...prevMessages.slice(0, -1),
- { id: generateId(), role: "assistant", content: fullResponse },
- ]);
- scrollToBottom();
- }
- } catch (error: any) {
- if (error.toString().includes("aborted")) {
- console.log("Streaming was aborted");
- } else {
- console.error("Error generating AI response:", error);
- toast({
- title: "Error",
- description: "Failed to generate AI response. Please try again.",
- variant: "destructive",
- });
- }
- } finally {
- setIsAiLoading(false);
- setIsFloatingInputVisible(false);
- setIsStreaming(false);
- if (!isUserScrolling) {
- scrollToBottom();
- }
- }
- };
-
- const handleStopStreaming = () => {
- if (abortControllerRef.current) {
- abortControllerRef.current.abort();
- setIsStreaming(false);
- setIsAiLoading(false);
- }
- };
-
- const handleSearch = async (newOffset = 0, overrides: any = {}) => {
- setHasSearched(true);
- setShowExamples(false);
- setIsLoading(true);
- setOffset(newOffset);
- setProgress(0);
- setChatMessages([]);
- scrollToBottom();
- setResults([]);
- setSimilarityThreshold(1); // Reset similarity threshold to 1
-
- try {
- const searchParams = {
- q: query || undefined,
- contentType: overrides.contentType || contentType,
- limit: overrides.limit || limit,
- offset: newOffset,
- startTime:
- overrides.startDate?.toISOString() || startDate.toISOString(),
- endTime: endDate.toISOString(),
- appName: overrides.appName || appName || undefined,
- windowName: overrides.windowName || windowName || undefined,
- includeFrames: includeFrames,
- minLength: overrides.minLength || minLength,
- maxLength: maxLength,
- speakerIds: Object.values(selectedSpeakers).map(
- (speaker) => speaker.id
- ),
- };
-
- const response = await pipe.queryScreenpipe(searchParams);
-
- // Add debug logging
- console.log("search response:", response);
-
- if (!response || !Array.isArray(response.data)) {
- throw new Error("invalid response data");
- }
-
- setResults(response.data);
- setTotalResults(response.pagination.total);
-
- // Save search to history
- // await onAddSearch(searchParams, response.data);
- } catch (error) {
- console.error("search error:", error);
- toast({
- title: "error",
- description: "failed to fetch search results. please try again.",
- variant: "destructive",
- });
- setResults([]);
- setTotalResults(0);
- } finally {
- setIsLoading(false);
- }
- };
-
- const handleNextPage = () => {
- if (offset + limit < totalResults) {
- handleSearch(offset + limit);
- }
- };
-
- const handlePrevPage = () => {
- if (offset - limit >= 0) {
- handleSearch(offset - limit);
- }
- };
-
- const handleBadgeClick = (value: string, type: "app" | "window") => {
- if (type === "app") {
- setAppName(value);
- } else {
- setWindowName(value);
- }
- };
-
- const handleSelectAll = (checked: boolean) => {
- setSelectAll(checked);
- if (checked) {
- setSelectedResults(new Set(results.map((_, index) => index)));
- } else {
- setSelectedResults(new Set());
- }
- };
-
- const handleQuickTimeFilter = (minutes: number) => {
- const now = new Date();
- const newStartDate = new Date(now.getTime() - minutes * 60000);
- setStartDate(newStartDate);
- setEndDate(now);
- };
-
- const renderSearchResults = () => {
- if (isLoading) {
- return Array(3)
- .fill(0)
- .map((_, index) => (
- <Card key={index}>
- <CardContent className="p-4">
- <Skeleton className="h-4 w-1/4 mb-2" />
- <Skeleton className="h-4 w-full mb-2" />
- <Skeleton className="h-4 w-full mb-2" />
- <Skeleton className="h-4 w-3/4" />
- </CardContent>
- </Card>
- ));
- }
-
- if (hasSearched && results.length === 0) {
- return <p className="text-center">no results found</p>;
- }
-
- if (!hasSearched || results.length === 0) {
- return null;
- }
-
- // First filter results based on hideDeselected setting
- const visibleResults = results
- .map((item, index) => ({ item, originalIndex: index }))
- .filter(
- ({ originalIndex }) =>
- !hideDeselected || selectedResults.has(originalIndex)
- );
-
- return visibleResults.map(({ item, originalIndex }) => (
- <motion.div
- key={originalIndex}
- className="flex items-center mb-4 relative pl-8"
- >
- <div className="absolute left-0 top-1/2 transform -translate-y-1/2">
- <Checkbox
- checked={selectedResults.has(originalIndex)}
- onCheckedChange={() => handleResultSelection(originalIndex)}
- />
- </div>
- <Card className="w-full">
- <CardContent className="p-4">
- <Accordion type="single" collapsible className="w-full">
- <AccordionItem value={`item-${originalIndex}`}>
- <AccordionTrigger className="flex flex-col w-full py-2">
- {/* Main content */}
- <div className="flex w-full items-center gap-2">
- <span className="text-left truncate">
- {item.type === "OCR" &&
- highlightKeyword(
- getContextAroundKeyword(item.content.text, query),
- query
- )}
- {item.type === "Audio" &&
- highlightKeyword(
- getContextAroundKeyword(
- item.content.transcription,
- query
- ),
- query
- )}
- {item.type === "UI" &&
- highlightKeyword(
- getContextAroundKeyword(item.content.text, query),
- query
- )}
- </span>
- </div>
- </AccordionTrigger>
- <AccordionContent>
- {item.type === "UI" && (
- <>
- <div className="max-h-[400px] overflow-y-auto rounded border border-gray-100 dark:border-gray-800 p-4">
- <p className="whitespace-pre-line">
- {highlightKeyword(item.content.text, query)}
- </p>
- </div>
- <div className="flex justify-center mt-4">
- <VideoComponent filePath={item.content.filePath} />
- </div>
- <div className="flex flex-wrap items-center gap-2 mt-2">
- {item.content.appName && (
- <Badge
- className="text-xs cursor-pointer"
- onClick={() =>
- handleBadgeClick(item.content.appName, "app")
- }
- >
- {item.content.appName}
- </Badge>
- )}
- {item.content.windowName && (
- <Badge
- className="text-xs cursor-pointer"
- onClick={() =>
- handleBadgeClick(
- item.content.windowName,
- "window"
- )
- }
- >
- {item.content.windowName}
- </Badge>
- )}
- </div>
- </>
- )}
- {item.type === "OCR" && (
- <>
- <div className="max-h-[400px] overflow-y-auto rounded border border-gray-100 dark:border-gray-800 p-4">
- <p className="whitespace-pre-line">
- {highlightKeyword(item.content.text, query)}
- </p>
- </div>
- <div className="flex justify-center mt-4">
- <VideoComponent filePath={item.content.filePath} />
- </div>
- {includeFrames && item.content.frame && (
- <div className="mt-2 flex items-center">
- <Dialog>
- <DialogTrigger asChild>
- <img
- src={`data:image/jpeg;base64,${item.content.frame}`}
- alt="Frame"
- className="w-24 h-auto cursor-pointer"
- />
- </DialogTrigger>
- <DialogContent className="sm:max-w-[80vw]">
- <img
- src={`data:image/jpeg;base64,${item.content.frame}`}
- alt="Frame"
- className="w-full h-auto"
- />
- </DialogContent>
- </Dialog>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>this is the frame where the text appeared</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- )}
- </>
- )}
- {item.type === "Audio" && (
- <>
- <div className="max-h-[400px] overflow-y-auto rounded border border-gray-100 dark:border-gray-800 p-4">
- <p className="whitespace-pre-line">
- {highlightKeyword(item.content.transcription, query)}
- </p>
- </div>
- {item.content.filePath &&
- item.content.filePath.trim() !== "" ? (
- <div className="flex justify-center mt-4">
- <VideoComponent filePath={item.content.filePath} />
- </div>
- ) : (
- <p className="text-gray-500 italic mt-2">
- no file path available for this audio.
- </p>
- )}
- </>
- )}
- </AccordionContent>
- </AccordionItem>
- </Accordion>
- <div className="flex flex-wrap items-center gap-2 mt-2">
- <Badge variant="outline" className="text-xs">
- {item.type}
- </Badge>
- <p className="text-xs text-gray-400">
- {new Date(item.content.timestamp).toLocaleString()}{" "}
- {/* Display local time */}
- </p>
- {item.type === "Audio" && item.content.speaker?.name && (
- <p className="text-xs text-gray-400">
- {item.content.speaker.name}
- </p>
- )}
- {item.type === "OCR" && item.content.appName && (
- <div className="flex items-center gap-1">
- <span className="text-xs text-muted-foreground">app:</span>
- <Badge
- className="text-xs cursor-pointer"
- onClick={() =>
- handleBadgeClick(item.content.appName, "app")
- }
- >
- {item.content.appName}
- </Badge>
- </div>
- )}
- {item.type === "OCR" && item.content.windowName && (
- <div className="flex items-center gap-1">
- <span className="text-xs text-muted-foreground">window:</span>
- <Badge
- className="text-xs cursor-pointer"
- onClick={() =>
- handleBadgeClick(item.content.windowName, "window")
- }
- >
- {item.content.windowName}
- </Badge>
- </div>
- )}
- {"tags" in item.content &&
- item.content.tags &&
- item.content.tags.map((tag, index) => (
- <Badge key={index} className="text-xs">
- {tag}
- </Badge>
- ))}
- </div>
- </CardContent>
- </Card>
- </motion.div>
- ));
- };
-
- // Add effect to restore search when currentSearchId changes
- useEffect(() => {
- // if (currentSearchId) {
- const selectedSearch = searches.find((s) => s.id === currentSearchId);
- if (selectedSearch) {
- // Restore search parameters
- setQuery(selectedSearch.searchParams.q || "");
- setContentType(selectedSearch.searchParams.content_type);
- setLimit(selectedSearch.searchParams.limit);
- setStartDate(new Date(selectedSearch.searchParams.start_time));
- setEndDate(new Date(selectedSearch.searchParams.end_time));
- setAppName(selectedSearch.searchParams.app_name || "");
- setWindowName(selectedSearch.searchParams.window_name || "");
- setIncludeFrames(selectedSearch.searchParams.include_frames);
- setMinLength(selectedSearch.searchParams.min_length);
- setMaxLength(selectedSearch.searchParams.max_length);
-
- // Restore results
- setResults(selectedSearch.results);
- setTotalResults(selectedSearch.results.length);
- setHasSearched(true);
- setShowExamples(false);
-
- // Restore messages if any
- if (selectedSearch.messages) {
- setChatMessages(
- selectedSearch.messages.map((msg) => ({
- id: msg.id,
- role: msg.type === "ai" ? "assistant" : "user",
- content: msg.content,
- }))
- );
- }
- }
- // }
- }, [currentSearchId, searches]);
-
- const handleNewSearch = () => {
- // setCurrentSearchId(null);
- location.reload();
- // Add any other reset logic you need
- };
- return (
- <div className="w-full max-w-4xl mx-auto p-4 mt-12">
- <div className="fixed top-4 left-4 z-50 flex items-center gap-2">
- {/* <SidebarTrigger className="h-8 w-8" /> */}
- <Button
- variant="ghost"
- size="icon"
- onClick={handleNewSearch}
- className="h-8 w-8"
- >
- <Plus className="h-4 w-4" />
- </Button>
- </div>
- {/* Content Type Checkboxes and Code Button */}
- <div className="flex items-center justify-between mb-2">
- <div className="flex items-center space-x-4">
- <div className="flex items-center space-x-1">
- <Checkbox
- id="audio-type"
- checked={selectedTypes.audio}
- onCheckedChange={() => handleContentTypeChange("audio")}
- className="h-4 w-4"
- />
- <Label htmlFor="audio-type" className="text-xs">
- speech
- </Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-3 w-3 text-muted-foreground ml-0.5" />
- </TooltipTrigger>
- <TooltipContent>
- <p>audio transcripts</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- {currentPlatform === "macos" && (
- <div className="flex items-center space-x-1">
- <Checkbox
- id="ui-type"
- checked={selectedTypes.ui}
- onCheckedChange={() => handleContentTypeChange("ui")}
- className="h-4 w-4"
- />
- <Label htmlFor="ui-type" className="text-xs">
- screen UI
- </Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-3 w-3 text-muted-foreground ml-0.5" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- text emitted directly from the source code of the desktop
- applications
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- )}
- <div className="flex items-center space-x-1">
- <Checkbox
- id="ocr-type"
- checked={selectedTypes.ocr}
- onCheckedChange={() => handleContentTypeChange("ocr")}
- className="h-4 w-4"
- />
- <Label htmlFor="ocr-type" className="text-xs">
- screen capture
- </Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-3 w-3 text-muted-foreground ml-0.5" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- recognized text from screenshots taken every 5s by default
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </div>
-
- <Dialog open={isCurlDialogOpen} onOpenChange={setIsCurlDialogOpen}>
- <DialogTrigger asChild>
- <Button variant="outline" className="text-sm">
- <IconCode className="h-4 w-4 mx-2" />
- </Button>
- </DialogTrigger>
- <DialogContent className="max-w-2xl">
- <DialogHeader>
- <DialogTitle>curl command</DialogTitle>
- <DialogDescription>
- you can use this curl command to make the same search request
- from the command line.
- <br />
- <br />
- <span className="text-xs text-gray-500">
- note: you need to have `jq` installed to use the command.
- </span>{" "}
- </DialogDescription>
- </DialogHeader>
- <div className="overflow-x-auto">
- <CodeBlock language="bash" value={generateCurlCommand()} />
- </div>
- </DialogContent>
- </Dialog>
- </div>
-
- {/* Existing search bar and other controls */}
- <div className="flex items-center gap-4 mb-4">
- {/* Keyword search - smaller width */}
- <Input
- type="text"
- value={query}
- onChange={(e) => setQuery(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- handleSearch(0);
- }
- }}
- placeholder="keyword search, you may leave it blank"
- className="w-[350px]"
- autoCorrect="off"
- autoComplete="off"
- />
-
- {/* Window name filter - increased width */}
- <SqlAutocompleteInput
- id="window-name"
- type="window"
- value={windowName}
- onChange={setWindowName}
- placeholder="filter by window"
- className="w-[300px]"
- icon={<Layout className="h-4 w-4" />}
- />
-
- {/* Advanced button */}
- <Button
- variant="outline"
- onClick={() => setIsQueryParamsDialogOpen(true)}
- >
- advanced
- </Button>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- <Button
- onClick={() => handleSearch(0)}
- disabled={isLoading || !health || health?.status === "error"}
- >
- {isLoading ? (
- <>
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
- searching...
- </>
- ) : (
- <>
- <Search className="mr-2 h-4 w-4" />
- search
- </>
- )}
- </Button>
- </span>
- </TooltipTrigger>
- {health?.status === "error" && (
- <TooltipContent>
- <p>screenpipe is not running...</p>
- </TooltipContent>
- )}
- </Tooltip>
- </TooltipProvider>
- </div>
-
- <div className="flex flex-wrap items-center gap-4 mb-4">
- <div className="flex-grow space-y-2">
- <div className="flex items-center space-x-2">
- <Label htmlFor="start-date">start date</Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400" />
- </TooltipTrigger>
- <TooltipContent>
- <p>select the start date to search for content</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- <DateTimePicker
- date={startDate}
- setDate={setStartDate}
- className="w-full"
- />
- </div>
-
- <div className="flex-grow space-y-2">
- <div className="flex items-center space-x-2">
- <Label htmlFor="end-date">end date</Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400" />
- </TooltipTrigger>
- <TooltipContent>
- <p>select the end date to search for content</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- <DateTimePicker
- date={endDate}
- setDate={setEndDate}
- className="w-full"
- />
- </div>
- </div>
-
- <div className="flex mt-4 space-x-2 justify-center">
- <Badge
- variant="outline"
- className="cursor-pointer hover:bg-secondary"
- onClick={() => handleQuickTimeFilter(30)}
- >
- <Clock className="mr-2 h-4 w-4" />
- last 30m
- </Badge>
- <Badge
- variant="outline"
- className="cursor-pointer hover:bg-secondary"
- onClick={() => handleQuickTimeFilter(60)}
- >
- <Clock className="mr-2 h-4 w-4" />
- last 60m
- </Badge>
- <Badge
- variant="outline"
- className="cursor-pointer hover:bg-secondary"
- onClick={() => handleQuickTimeFilter(24 * 60)}
- >
- <Clock className="mr-2 h-4 w-4" />
- last 24h
- </Badge>
- <Badge
- variant="outline"
- className="cursor-pointer hover:bg-secondary"
- onClick={() => handleQuickTimeFilter(7 * 24 * 60)}
- >
- <Clock className="mr-2 h-4 w-4" />
- last 7d
- </Badge>
- <Badge
- variant="outline"
- className="cursor-pointer hover:bg-secondary"
- onClick={() => handleQuickTimeFilter(30 * 24 * 60)}
- >
- <Clock className="mr-2 h-4 w-4" />
- last 30d
- </Badge>
- </div>
-
- <Dialog
- open={isQueryParamsDialogOpen}
- onOpenChange={setIsQueryParamsDialogOpen}
- >
- <DialogContent className="sm:max-w-[605px]">
- <DialogHeader>
- <DialogTitle>advanced search parameters</DialogTitle>
- <DialogDescription>
- adjust additional search parameters here.
- </DialogDescription>
- </DialogHeader>
- <div className="grid gap-4 py-4">
- {/* Remove the query section */}
- {/* <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="query" className="text-right">
- query
- </Label>
- ... query input ...
- </div> */}
-
- {/* Keep other advanced search options */}
- <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="app-name" className="text-right">
- app name
- </Label>
- <div className="col-span-3 flex items-center">
- <SqlAutocompleteInput
- id="app-name"
- type="app"
- icon={<Laptop className="h-4 w-4" />}
- value={appName}
- onChange={setAppName}
- placeholder="filter by app name"
- className="flex-grow"
- />
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>filter results by specific application names</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </div>
- <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="min-length" className="text-right">
- min length
- </Label>
- <div className="col-span-3 flex items-center">
- <Input
- id="min-length"
- type="number"
- value={minLength}
- onChange={(e) => setMinLength(Number(e.target.value))}
- className="flex-grow"
- />
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- enter the minimum length of the content to search for
- <br />
- usually transcriptions are short while text extracted
- from images can be long.
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </div>
- <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="max-length" className="text-right">
- max length
- </Label>
- <div className="col-span-3 flex items-center">
- <Input
- id="max-length"
- type="number"
- value={maxLength}
- onChange={(e) => setMaxLength(Number(e.target.value))}
- className="flex-grow"
- />
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- enter the maximum length of the content to search for
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </div>
-
- <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="limit-slider" className="text-right">
- page size: {limit}
- </Label>
- <div className="col-span-3 flex items-center">
- <Slider
- id="limit-slider"
- value={[limit]}
- onValueChange={(value: number[]) => setLimit(value[0])}
- min={10}
- max={15000}
- step={10}
- className="flex-grow"
- />
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- select the number of results to display. usually ai
- cannot ingest more than 30 OCR results at a time and
- 1000 audio results at a time.
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </div>
- </div>
- <div className="flex items-center justify-center space-x-2">
- <Switch
- id="include-frames"
- checked={includeFrames}
- onCheckedChange={setIncludeFrames}
- />
- <Label htmlFor="include-frames">include frames</Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- include frames in the search results. this shows the frame
- where the text appeared. only works for ocr. this may slow
- down the search.
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- <div className="flex items-center justify-center space-x-2">
- <Label htmlFor="speakers" className="flex items-center space-x-2">
- <SpeechIcon className="h-4 w-4" />
- <span>speakers</span>
- </Label>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>
- select the speakers to include in the search results. this
- will only show results from the selected speakers. note:
- only audio results can be returned
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <Popover open={openSpeakers} onOpenChange={setOpenSpeakers}>
- <PopoverTrigger asChild>
- <Button
- variant="outline"
- role="combobox"
- aria-expanded={openSpeakers}
- className="w-full justify-between"
- >
- {Object.values(selectedSpeakers).length > 0
- ? `${Object.values(selectedSpeakers)
- .map((s) => s.name)
- .join(", ")}`
- : "select speakers"}
- <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-full p-0">
- <Command>
- <CommandInput
- placeholder="search speakers..."
- value={speakerSearchQuery}
- onValueChange={setSpeakerSearchQuery}
- />
- <CommandList>
- <CommandEmpty>no speakers found.</CommandEmpty>
- <CommandGroup>
- {[...new Set(speakers)].map((speaker: Speaker) => (
- <CommandItem
- key={speaker.id}
- value={speaker.name}
- onSelect={() => handleSpeakerChange(speaker)}
- >
- <div className="flex items-center">
- <Check
- className={cn(
- "mr-2 h-4 w-4",
- selectedSpeakers[speaker.id]
- ? "opacity-100"
- : "opacity-0"
- )}
- />
- <span
- style={{
- userSelect: "none",
- WebkitUserSelect: "none",
- MozUserSelect: "none",
- msUserSelect: "none",
- }}
- >
- {speaker.name}
- </span>
- </div>
- </CommandItem>
- ))}
- </CommandGroup>
- </CommandList>
- </Command>
- </PopoverContent>
- </Popover>
- </div>
- <DialogFooter>
- <Button onClick={() => setIsQueryParamsDialogOpen(false)}>
- done
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
-
- {isLoading ? (
- <div className="my-8 flex justify-center">
- <Loader2 className="h-8 w-8 animate-spin" />
- </div>
- ) : (
- showExamples &&
- results.length === 0 && (
- <div className="my-8 flex justify-center">
- <ExampleSearchCards onSelect={handleExampleSelect} />
- </div>
- )
- )}
- {isLoading && (
- <div className="my-2">
- <Progress value={progress} className="w-full" />
- </div>
- )}
- {results.length > 0 && (
- <div className="flex flex-col space-y-4 mb-4 my-8">
- <div className="flex justify-between items-center">
- <div className="flex items-center space-x-4">
- <div className="flex items-center space-x-2">
- <Checkbox
- id="select-all"
- checked={selectAll}
- onCheckedChange={handleSelectAll}
- />
- <Label htmlFor="select-all">select all results</Label>
- </div>
-
- <Separator orientation="vertical" className="h-4" />
-
- <div className="flex items-center space-x-2">
- <Switch
- id="hide-deselected"
- checked={hideDeselected}
- onCheckedChange={setHideDeselected}
- />
- <Label htmlFor="hide-deselected">hide unselected</Label>
- </div>
- </div>
-
- <div className="flex items-center space-x-2">
- <Button
- variant="outline"
- size="sm"
- onClick={() => {
- setSimilarityThreshold(similarityThreshold === 0.5 ? 1 : 0.5);
- if (similarityThreshold === 0.5) {
- setSelectedResults(
- new Set(results.map((_, index) => index))
- );
- setSelectAll(true);
- }
- }}
- disabled={isFiltering}
- className="flex items-center gap-2 disabled:opacity-100"
- >
- {isFiltering ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : similarityThreshold === 0.5 ? (
- <Check className="h-4 w-4" />
- ) : (
- <Layers className="h-4 w-4" />
- )}
- {similarityThreshold === 0.5
- ? "duplicates removed"
- : "remove duplicates"}
- </Button>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p>automatically unselect similar or duplicate results</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </div>
- </div>
- )}
- <div className="space-y-4">
- {renderSearchResults()}
- {totalResults > 0 && (
- <div className="flex justify-between items-center mt-4">
- <Button
- onClick={handlePrevPage}
- disabled={offset === 0}
- variant="outline"
- size="sm"
- >
- <ChevronLeft className="mr-2 h-4 w-4" /> Previous
- </Button>
- <span className="text-sm text-gray-500">
- Showing {offset + 1} - {Math.min(offset + limit, totalResults)} of{" "}
- {totalResults}
- </span>
- <Button
- onClick={handleNextPage}
- disabled={offset + limit >= totalResults}
- variant="outline"
- size="sm"
- >
- Next <ChevronRight className="ml-2 h-4 w-4" />
- </Button>
- </div>
- )}
- </div>
-
- <AnimatePresence>
- {results.length > 0 && (
- <motion.div
- initial={{ opacity: 0, y: 50 }}
- animate={{ opacity: 1, y: 0 }}
- exit={{ opacity: 0, y: 50 }}
- className="fixed bottom-4 left-0 right-0 mx-auto w-full max-w-2xl z-50"
- >
- <form
- onSubmit={handleFloatingInputSubmit}
- className="flex flex-col space-y-2 bg-white dark:bg-gray-800 shadow-lg rounded-lg overflow-hidden p-4 border border-gray-200 dark:border-gray-700"
- >
- <div className="relative flex-grow flex items-center space-x-2">
- <Input
- ref={floatingInputRef}
- type="text"
- placeholder="ask a question about the results..."
- value={floatingInput}
- disabled={
- calculateSelectedContentLength() > MAX_CONTENT_LENGTH
- }
- onChange={(e) => setFloatingInput(e.target.value)}
- className="flex-1 h-12 focus:outline-none focus:ring-0 border-0 focus:border-black dark:focus:border-white focus:border-b transition-all duration-200"
- />
-
- <Select
- value={selectedAgent.id}
- onValueChange={(value) =>
- setSelectedAgent(
- AGENTS.find((a) => a.id === value) || AGENTS[0]
- )
- }
- >
- <SelectTrigger className="w-[170px] h-12">
- <SelectValue placeholder="select agent" />
- </SelectTrigger>
- <SelectContent>
- {AGENTS.map((agent) => (
- <SelectItem key={agent.id} value={agent.id}>
- <span className="font-mono text-sm">{agent.name}</span>
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-gray-400" />
- </TooltipTrigger>
- <TooltipContent>
- <p>{selectedAgent.description}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <Button
- type="submit"
- className="w-12"
- disabled={
- calculateSelectedContentLength() > MAX_CONTENT_LENGTH
- }
- >
- {isStreaming ? (
- <Square className="h-4 w-4" />
- ) : (
- <Send className="h-4 w-4" />
- )}
- </Button>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- <ContextUsageIndicator
- currentSize={calculateSelectedContentLength()}
- maxSize={MAX_CONTENT_LENGTH}
- />
- </span>
- </TooltipTrigger>
- <TooltipContent>
- <p>
- {calculateSelectedContentLength() > MAX_CONTENT_LENGTH
- ? `selected content exceeds maximum allowed: ${calculateSelectedContentLength()} / ${MAX_CONTENT_LENGTH} characters. unselect some items to use AI.`
- : `${calculateSelectedContentLength()} / ${MAX_CONTENT_LENGTH} characters used for AI message`}
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
-
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <HelpCircle className="h-4 w-4 text-muted-foreground ml-1 cursor-help" />
- </TooltipTrigger>
- <TooltipContent>
- <p className="text-sm">
- ai models can only process a limited amount of text at
- once.
- <br />
- this circle shows how much of that limit you arere
- using.
- <br />! the exclamation mark indicates when you exceed
- the limit.
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- </form>
- </motion.div>
- )}
- </AnimatePresence>
-
- {results.length > 0 && <Separator className="my-8" />}
-
- {/* Display chat messages - Update this section */}
- {(chatMessages.length > 0 || isAiLoading) && (
- <>
- <div className="flex flex-col items-start flex-1 max-w-2xl gap-8 px-4 mx-auto">
- {chatMessages.map((msg, index) => (
- <ChatMessage key={index} message={msg} />
- ))}
- {isAiLoading && spinner}
- </div>
- </>
- )}
-
- {/* Scroll to Bottom Button */}
- {showScrollButton && (
- <Button
- className="fixed bottom-4 right-4 rounded-full p-2"
- onClick={scrollToBottom}
- >
- <ChevronDown className="h-6 w-6" />
- </Button>
- )}
- {results.length > 0 && <div className="h-32" />}
- </div>
- );
-}
diff --git a/pipes/timeline/src/components/sql-autocomplete-input.tsx b/pipes/timeline/src/components/sql-autocomplete-input.tsx
deleted file mode 100644
index 55807bebf..000000000
--- a/pipes/timeline/src/components/sql-autocomplete-input.tsx
+++ /dev/null
@@ -1,150 +0,0 @@
-import React, { useState, useRef, useCallback, useEffect } from "react";
-import { useSqlAutocomplete } from "@/lib/hooks/use-sql-autocomplete";
-import { Command } from "cmdk";
-import { Input } from "@/components/ui/input";
-import { Loader2, Search, X } from "lucide-react";
-import { cn } from "@/lib/utils";
-
-interface SqlAutocompleteInputProps {
- id: string;
- placeholder: string;
- value: string;
- onChange: (value: string) => void;
- type: "app" | "window";
- icon?: React.ReactNode;
- className?: string;
- onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
-}
-
-export function SqlAutocompleteInput({
- id,
- placeholder,
- value,
- onChange,
- type,
- icon,
- className,
- onKeyDown,
-}: SqlAutocompleteInputProps) {
- const { items, isLoading } = useSqlAutocomplete(type);
- const [open, setOpen] = useState(false);
- const [inputValue, setInputValue] = useState(value);
- const inputRef = useRef<HTMLInputElement>(null);
- const commandRef = useRef<HTMLDivElement>(null);
-
- // update local state when prop changes
- useEffect(() => {
- setInputValue(value);
- }, [value]);
-
- const handleSelect = (selectedValue: string) => {
- onChange(selectedValue);
- setInputValue(selectedValue);
- setOpen(false);
- inputRef.current?.focus();
- };
-
- const handleInputChange = useCallback(
- (e: React.ChangeEvent<HTMLInputElement>) => {
- const newValue = e.target.value;
- setInputValue(newValue);
- onChange(newValue);
- },
- [onChange]
- );
-
- const handleClearInput = useCallback(() => {
- setInputValue("");
- onChange("");
- inputRef.current?.focus();
- }, [onChange]);
-
- useEffect(() => {
- const handleClickOutside = (event: MouseEvent) => {
- if (
- commandRef.current &&
- !commandRef.current.contains(event.target as Node)
- ) {
- setOpen(false);
- }
- };
-
- document.addEventListener("mousedown", handleClickOutside);
- return () => {
- document.removeEventListener("mousedown", handleClickOutside);
- };
- }, []);
-
- return (
- <div className={cn("relative", className)} ref={commandRef}>
- <div className="absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 z-10 flex items-center">
- {icon}
- <span className="w-2" />
- </div>
- <Command className="relative w-full" shouldFilter={false}>
- <div className="relative">
- <Input
- ref={inputRef}
- id={id}
- type="text"
- placeholder={placeholder}
- value={inputValue}
- onChange={handleInputChange}
- onFocus={() => setOpen(true)}
- className={cn("pr-8 w-full", icon ? "pl-7" : "pl-3")}
- autoCorrect="off"
- aria-autocomplete="none"
- onKeyDown={onKeyDown}
- />
- {inputValue && (
- <button
- onClick={handleClearInput}
- className="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600"
- >
- <X className="h-4 w-4" />
- </button>
- )}
- </div>
- {open && (
- <Command.List className="absolute z-20 w-full bg-white border border-gray-300 rounded-md mt-1 max-h-60 overflow-auto shadow-lg text-sm">
- <div className="flex items-center px-3 py-2 border-b border-gray-200">
- <Search className="mr-2 h-4 w-4 text-gray-400" />
- <Command.Input
- placeholder="search..."
- value={inputValue}
- onValueChange={setInputValue}
- className="border-none focus:ring-0 outline-none w-full"
- />
- </div>
- {isLoading ? (
- <Command.Loading>
- <div className="px-4 py-2 text-gray-500 flex items-center">
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
- loading...
- </div>
- </Command.Loading>
- ) : (
- items
- .filter((item) =>
- item.name.toLowerCase().includes(inputValue.toLowerCase())
- )
- .map((item: any) => (
- <Command.Item
- key={item.name}
- value={item.name}
- onSelect={handleSelect}
- className="px-4 py-2 hover:bg-gray-100 cursor-pointer border-b border-gray-200 last:border-b-0"
- >
- {item.name} ({item.count})
- </Command.Item>
- ))
- )}
- {!isLoading && items.length === 0 && (
- <div className="px-4 py-2 text-gray-500">no results found</div>
- )}
- </Command.List>
- )}
- </Command>
- </div>
- );
-}
diff --git a/screenpipe-app-tauri/components/header.tsx b/screenpipe-app-tauri/components/header.tsx
index e9c19a020..65f4870bf 100644
--- a/screenpipe-app-tauri/components/header.tsx
+++ b/screenpipe-app-tauri/components/header.tsx
@@ -38,21 +38,17 @@ import { useHealthCheck } from "@/lib/hooks/use-health-check";
import { Skeleton } from "@/components/ui/skeleton";
import { useChangelogDialog } from "@/lib/hooks/use-changelog-dialog";
import { useSettings } from "@/lib/hooks/use-settings";
-import { invoke } from "@tauri-apps/api/core";
-import { Clock } from "lucide-react";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip";
-import { Calendar } from "lucide-react";
import { useUser } from "@/lib/hooks/use-user";
-import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "@/components/ui/dialog";
export default function Header() {
const [showInbox, setShowInbox] = useState(false);
- const [showSettings, setShowSettings] = useState(false);
const [messages, setMessages] = useState<Message[]>([]);
const { health } = useHealthCheck();
const { settings } = useSettings();
@@ -170,13 +166,15 @@ export default function Header() {
className="cursor-pointer p-1.5"
>
<Settings2 className="mr-2 h-4 w-4" />
- <span>Settings</span>
+ <span>settings</span>
</DropdownMenuItem>
</DialogTrigger>
+
<DialogContent
className="max-w-[80vw] w-full max-h-[80vh] h-full overflow-hidden p-0 [&>button]:hidden"
onClick={(e) => e.stopPropagation()}
>
+
<Settings />
</DialogContent>
</Dialog>
diff --git a/screenpipe-app-tauri/components/recording-settings.tsx b/screenpipe-app-tauri/components/recording-settings.tsx
index 72a75b0e7..fa6950170 100644
--- a/screenpipe-app-tauri/components/recording-settings.tsx
+++ b/screenpipe-app-tauri/components/recording-settings.tsx
@@ -688,13 +688,13 @@ export function RecordingSettings() {
return (
<div className="w-full space-y-6 py-4">
- <h1 className="text-2xl font-bold mb-4">Recording</h1>
+ <h1 className="text-2xl font-bold mb-4">recording</h1>
{settings.devMode || (!isUpdating && isDisabled) ? (
<Alert>
<Terminal className="h-4 w-4" />
- <AlertTitle>Heads up!</AlertTitle>
+ <AlertTitle>heads up!</AlertTitle>
<AlertDescription>
- Make sure to turn off dev mode and start screenpipe recorder first
+ make sure to turn off dev mode and start screenpipe recorder first
(go to status)
</AlertDescription>
</Alert>
@@ -706,12 +706,12 @@ export function RecordingSettings() {
isDisabled && "opacity-50 pointer-events-none cursor-not-allowed"
)}
>
- <h4 className="text-lg font-semibold my-4">Video</h4>
+ <h4 className="text-lg font-semibold my-4">video</h4>
<div className="flex flex-col space-y-6">
<div className="flex flex-col space-y-2">
<Label htmlFor="monitorIds" className="flex items-center space-x-2">
<Monitor className="h-4 w-4" />
- <span>Monitors</span>
+ <span>monitors</span>
</Label>
<Popover open={openMonitors} onOpenChange={setOpenMonitors}>
<PopoverTrigger asChild>
@@ -778,7 +778,7 @@ export function RecordingSettings() {
<div className="flex flex-col space-y-2">
<Label htmlFor="ocrModel" className="flex items-center space-x-2">
<Eye className="h-4 w-4" />
- <span>OCR Model</span>
+ <span>ocr model</span>
</Label>
<Select
onValueChange={handleOcrModelChange}
@@ -797,7 +797,7 @@ export function RecordingSettings() {
</div>
<div className="flex flex-col space-y-2">
<Label htmlFor="fps" className="flex items-center space-x-2">
- <span>Frames per second (FPS)</span>
+ <span>frames per second (fps)</span>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
@@ -836,7 +836,7 @@ export function RecordingSettings() {
htmlFor="ignoredWindows"
className="flex items-center space-x-2"
>
- <span>Ignored Windows</span>
+ <span>ignored windows</span>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
@@ -875,7 +875,7 @@ export function RecordingSettings() {
htmlFor="includedWindows"
className="flex items-center space-x-2"
>
- <span>Included Windows</span>
+ <span>included windows</span>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
@@ -914,14 +914,14 @@ export function RecordingSettings() {
</div>
<Separator className="my-6" />
- <h4 className="text-lg font-semibold my-4">Audio</h4>
+ <h4 className="text-lg font-semibold my-4">audio</h4>
<div className="space-y-6">
<div className="flex items-center justify-between">
<div className="space-y-1">
- <h4 className="font-medium">Disable Audio Recording</h4>
+ <h4 className="font-medium">disable audio recording</h4>
<p className="text-sm text-muted-foreground">
- Useful if you don&apos;t need audio or if you have memory/CPU
+ useful if you don&apos;t need audio or if you have memory/cpu
issues
</p>
</div>
@@ -938,7 +938,7 @@ export function RecordingSettings() {
className="flex items-center"
>
<Mic className="h-4 w-4" />
- <span>Audio transcription model</span>
+ <span>audio transcription model</span>
</Label>
<Select
onValueChange={handleAudioTranscriptionModelChange}
@@ -984,7 +984,7 @@ export function RecordingSettings() {
className="flex items-center space-x-2"
>
<Key className="h-4 w-4" />
- API key
+ api key
</Label>
<div className="flex-grow relative">
<Input
@@ -1019,7 +1019,7 @@ export function RecordingSettings() {
</div>
</div>
<p className="text-sm text-muted-foreground text-left mt-1">
- Don&apos;t have an api key? get one from{" "}
+ don&apos;t have an api key? get one from{" "}
<a
href="https://console.deepgram.com/"
target="_blank"
@@ -1163,7 +1163,7 @@ export function RecordingSettings() {
htmlFor="vadSensitivity"
className="flex items-center space-x-2"
>
- <span>Voice Activity Detection sensitivity</span>
+ <span>voice activity detection sensitivity</span>
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
@@ -1249,18 +1249,18 @@ export function RecordingSettings() {
<Separator className="my-6" />
- <h4 className="text-lg font-semibold my-4">Misc</h4>
+ <h4 className="text-lg font-semibold my-4">misc</h4>
<div className="space-y-8 py-4">
<div className="space-y-6">
<div className="flex items-center justify-between">
<div className="space-y-1">
<h4 className="font-medium">
- Remove Personal Information (PII)
+ remove personal information (pii)
</h4>
<p className="text-sm text-muted-foreground">
- Removes sensitive data like credit cards, emails, and phone
- numbers from OCR text
+ removes sensitive data like credit cards, emails, and phone
+ numbers from ocr text
</p>
</div>
<div className="flex items-center gap-2">
@@ -1275,9 +1275,9 @@ export function RecordingSettings() {
<div className="flex items-center justify-between">
<div className="space-y-1">
- <h4 className="font-medium">Enable Telemetry</h4>
+ <h4 className="font-medium">enable telemetry</h4>
<p className="text-sm text-muted-foreground">
- Help improve Screenpipe with anonymous usage data
+ help improve screenpipe with anonymous usage data
</p>
</div>
<Switch
@@ -1289,10 +1289,10 @@ export function RecordingSettings() {
<div className="flex items-center justify-between">
<div className="space-y-1">
- <h4 className="font-medium">Use Chinese Mirror</h4>
+ <h4 className="font-medium">use chinese mirror</h4>
<p className="text-sm text-muted-foreground">
- Alternative download source for Hugging Face models in
- mainland China
+ alternative download source for hugging face models in
+ mainland china
</p>
</div>
<Switch
@@ -1304,10 +1304,10 @@ export function RecordingSettings() {
<div className="flex items-center justify-between">
<div className="space-y-1">
- <h4 className="font-medium">Enable Timeline UI</h4>
+ <h4 className="font-medium">enable timeline ui</h4>
<p className="text-sm text-muted-foreground">
- Experimental feature that provides a timeline interface like
- Rewind.ai
+ experimental feature that provides a timeline interface like
+ rewind.ai
</p>
</div>
<Switch
@@ -1320,9 +1320,9 @@ export function RecordingSettings() {
{isMacOS && (
<div className="flex items-center justify-between">
<div className="space-y-1">
- <h4 className="font-medium">Enable UI Monitoring</h4>
+ <h4 className="font-medium">enable ui monitoring</h4>
<p className="text-sm text-muted-foreground">
- Monitor UI elements for better search context (requires
+ monitor ui elements for better search context (requires
accessibility permission)
</p>
</div>
@@ -1339,7 +1339,7 @@ export function RecordingSettings() {
<div className="space-y-2">
<div className="flex items-center gap-2 mb-2">
<Folder className="h-5 w-5" />
- <h3 className="text-lg font-semibold">Data Directory</h3>
+ <h3 className="text-lg font-semibold">data directory</h3>
</div>
{!dataDirInputVisible ? (
@@ -1351,15 +1351,15 @@ export function RecordingSettings() {
>
<div className="flex gap-4">
{!!settings.dataDir
- ? "Change Directory"
- : "Select Directory"}
+ ? "change directory"
+ : "select directory"}
<span className="text-muted-foreground">
{settings.dataDir === settings.dataDir
- ? `Current at: ${
- settings.dataDir || "Default Directory"
+ ? `current at: ${
+ settings.dataDir || "default directory"
}`
- : `Change to: ${
- settings.dataDir || "Default Directory"
+ : `change to: ${
+ settings.dataDir || "default directory"
}`}
</span>
</div>
diff --git a/screenpipe-app-tauri/components/settings.tsx b/screenpipe-app-tauri/components/settings.tsx
index ce2386e48..a50c1fbed 100644
--- a/screenpipe-app-tauri/components/settings.tsx
+++ b/screenpipe-app-tauri/components/settings.tsx
@@ -2,8 +2,21 @@
import React, { useState } from "react";
import { useSettings } from "@/lib/hooks/use-settings";
-import { Settings2, Brain, Video, Keyboard, User, ArrowLeft } from "lucide-react";
-import { Dialog, DialogContent, DialogTrigger } from "./ui/dialog";
+import {
+ Settings2,
+ Brain,
+ Video,
+ Keyboard,
+ User,
+ ArrowLeft,
+} from "lucide-react";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "./ui/dialog";
import { cn } from "@/lib/utils";
import { RecordingSettings } from "./recording-settings";
import { AccountSection } from "./settings/account-section";
@@ -13,7 +26,8 @@ import AISection from "./settings/ai-section";
type SettingsSection = "ai" | "shortcuts" | "recording" | "account";
export function Settings() {
- const [activeSection, setActiveSection] = useState<SettingsSection>("account");
+ const [activeSection, setActiveSection] =
+ useState<SettingsSection>("account");
const renderSection = () => {
switch (activeSection) {
@@ -29,60 +43,59 @@ export function Settings() {
};
return (
- <div className="flex h-full">
- {/* Sidebar */}
- <div className="w-64 border-r bg-[#f3f3f3]">
- <div className="flex items-center gap-4 ml-6 mt-4">
- <h1 className="text-2xl font-bold">Settings</h1>
- </div>
- <div className="flex flex-col space-y-1 p-4">
- {[
- {
- id: "account",
- label: "Account",
- icon: <User className="h-4 w-4" />,
- },
- {
- id: "ai",
- label: "AI Settings",
- icon: <Brain className="h-4 w-4" />,
- },
- {
- id: "recording",
- label: "Recording",
- icon: <Video className="h-4 w-4" />,
- },
- {
- id: "shortcuts",
- label: "Shortcuts",
- icon: <Keyboard className="h-4 w-4" />,
- },
- ].map((section) => (
- <button
- key={section.id}
- onClick={() =>
- setActiveSection(section.id as SettingsSection)
- }
- className={cn(
- "flex items-center space-x-2 px-4 py-1.5 rounded-lg transition-colors",
- activeSection === section.id
- ? "bg-black/90 text-white"
- : "hover:bg-black/10"
- )}
- >
- {section.icon}
- <span>{section.label}</span>
- </button>
- ))}
- </div>
- </div>
+ <div className="flex h-full">
+ {/* Sidebar */}
+ <div className="w-64 border-r bg-[#f3f3f3]">
+ <DialogHeader className="flex items-center gap-4 ml-6 mt-4">
+ <DialogTitle className="text-2xl font-bold">settings</DialogTitle>
+ </DialogHeader>
- {/* Content - Updated styles */}
- <div className="flex-1 flex flex-col h-full max-h-[80vh]">
- <div className="flex-1 overflow-y-auto px-4">
- <div className="max-h-full">{renderSection()}</div>
- </div>
- </div>
+ <div className="flex flex-col space-y-1 p-4">
+ {[
+ {
+ id: "account",
+ label: "account",
+ icon: <User className="h-4 w-4" />,
+ },
+ {
+ id: "ai",
+ label: "ai settings",
+ icon: <Brain className="h-4 w-4" />,
+ },
+ {
+ id: "recording",
+ label: "recording",
+ icon: <Video className="h-4 w-4" />,
+ },
+ {
+ id: "shortcuts",
+ label: "shortcuts",
+ icon: <Keyboard className="h-4 w-4" />,
+ },
+ ].map((section) => (
+ <button
+ key={section.id}
+ onClick={() => setActiveSection(section.id as SettingsSection)}
+ className={cn(
+ "flex items-center space-x-2 px-4 py-1.5 rounded-lg transition-colors",
+ activeSection === section.id
+ ? "bg-black/90 text-white"
+ : "hover:bg-black/10"
+ )}
+ >
+ {section.icon}
+ <span>{section.label}</span>
+ </button>
+ ))}
</div>
+ </div>
+
+ {/* Content - Updated styles */}
+ <div className="flex-1 flex flex-col h-full max-h-[80vh]">
+ <div className="flex-1 overflow-y-auto px-4">
+ <div className="max-h-full">{renderSection()}</div>
+ </div>
+ </div>
+ </div>
);
}
diff --git a/screenpipe-app-tauri/components/settings/account-section.tsx b/screenpipe-app-tauri/components/settings/account-section.tsx
index 3fde7421f..f93dadde7 100644
--- a/screenpipe-app-tauri/components/settings/account-section.tsx
+++ b/screenpipe-app-tauri/components/settings/account-section.tsx
@@ -112,28 +112,29 @@ export function AccountSection() {
const plans = [
{
- title: "Monthly",
+ title: "monthly",
price: "$20/mo",
features: [
"15 credits/mo",
- "Unlimited ScreenPipe cloud",
- "Priority support",
+ "unlimited screenpipe cloud",
+ "priority support",
],
url: `https://buy.stripe.com/5kA6p79qefweacg5kJ?client_reference_id=${clientRefId}`,
},
{
- title: "One-time",
+ title: "one-time",
price: "$50",
- features: ["50 credits", "Bever expires", "Basic OCR & STT"],
+ features: ["50 credits", "never expires", "priority support"],
url: `https://buy.stripe.com/eVaeVD45UbfYeswcNd?client_reference_id=${clientRefId}`,
},
{
- title: "Enterprise",
- price: "Book a call",
+ title: "enterprise",
+ price: "book a call",
features: [
- "Custom credits allocation",
- "Dedicated support",
- "Custom features",
+ "enterprise process intelligence & process mining",
+ "dedicated support",
+ "consulting",
+ "custom features",
],
url: "https://cal.com/louis030195/screenpipe-for-businesses",
},
@@ -142,14 +143,14 @@ export function AccountSection() {
return (
<div className="w-full space-y-6 py-4">
<div className="flex items-center justify-between">
- <h1 className="text-2xl font-bold">Account Settings</h1>
+ <h1 className="text-2xl font-bold">account settings</h1>
<Button
variant="outline"
size="sm"
onClick={() => invoke("open_auth_window")}
className="hover:bg-secondary/80"
>
- Manage Account <ExternalLinkIcon className="w-4 h-4 ml-2" />
+ manage account <ExternalLinkIcon className="w-4 h-4 ml-2" />
</Button>
</div>
@@ -158,7 +159,7 @@ export function AccountSection() {
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<Coins className="w-4 h-4 text-muted-foreground" />
- <h4 className="text-sm font-medium">Credits & Usage</h4>
+ <h4 className="text-sm font-medium">credits & usage</h4>
<Badge variant="secondary" className="rounded-full px-2.5 py-0.5">
{user?.credits?.amount || 0} available
</Badge>
@@ -179,7 +180,7 @@ export function AccountSection() {
<div className="space-y-3">
<div className="flex items-center gap-2">
<Label className="text-sm font-medium text-muted-foreground">
- ScreenPipe API Key
+ screenpipe api key
</Label>
<TooltipProvider>
<Tooltip>
@@ -188,7 +189,7 @@ export function AccountSection() {
</TooltipTrigger>
<TooltipContent side="right" className="max-w-[280px]">
<p className="text-xs leading-relaxed">
- Your key syncs credits and settings across devices. you
+ your key syncs credits and settings across devices. you
can find it in your dashboard.{" "}
<span className="text-destructive font-medium">
keep it private.
@@ -207,7 +208,7 @@ export function AccountSection() {
user: { token: e.target.value },
});
}}
- placeholder="Enter your API key"
+ placeholder="enter your api key"
className="font-mono text-sm bg-secondary/30"
/>
<Button
@@ -218,7 +219,7 @@ export function AccountSection() {
toast({ title: "key updated" });
}}
>
- Verify
+ verify
</Button>
</div>
</div>
@@ -227,7 +228,7 @@ export function AccountSection() {
<div className="grid gap-4">
<div className="space-y-6">
- <h4 className="text-lg font-medium">Active plan</h4>
+ <h4 className="text-lg font-medium">active plan</h4>
<div className="flex flex-col gap-4">
{plans.map((plan) => (
@@ -261,9 +262,9 @@ export function AccountSection() {
<div className="flex items-center justify-between">
<div className="space-y-1.5">
- <h4 className="text-lg font-medium">Developer Tools</h4>
+ <h4 className="text-lg font-medium">developer tools</h4>
<p className="text-sm text-muted-foreground">
- Build and sell custom pipes
+ build and sell custom pipes
</p>
</div>
<Badge
@@ -287,9 +288,9 @@ export function AccountSection() {
/>
</div>
<div className="space-y-1">
- <div className="text-sm font-medium">Stripe Connect</div>
+ <div className="text-sm font-medium">stripe connect</div>
<p className="text-xs text-muted-foreground">
- Set up payments to receive earnings from your pipes
+ set up payments to receive earnings from your pipes
</p>
</div>
</div>
@@ -304,14 +305,14 @@ export function AccountSection() {
className="h-9"
disabled
>
- Connect
+ connect
</Button>
</div>
</div>
<div className="space-y-2">
<Label className="text-xs text-muted-foreground">
- Publish your pipe with CLI
+ publish your pipe with cli
</Label>
<div className="font-mono text-xs bg-gray-50 rounded-lg p-4 border border-border/50">
$ screenpipe publish my-awesome-pipe
diff --git a/screenpipe-app-tauri/components/settings/ai-section.tsx b/screenpipe-app-tauri/components/settings/ai-section.tsx
index 0f9613dec..1c6037eb4 100644
--- a/screenpipe-app-tauri/components/settings/ai-section.tsx
+++ b/screenpipe-app-tauri/components/settings/ai-section.tsx
@@ -304,16 +304,16 @@ const AISection = () => {
return (
<div className="w-full space-y-6 py-4">
- <h1 className="text-2xl font-bold">AI Settings</h1>
+ <h1 className="text-2xl font-bold">ai settings</h1>
<div className="w-full">
<Label htmlFor="aiUrl" className="min-w-[80px]">
- AI Provider
+ ai provider
</Label>
<div className="grid grid-cols-2 gap-4 mb-4 mt-4">
<AIProviderCard
type="screenpipe-cloud"
- title="Screenpipe Cloud"
- description="Fastest with built-in context awareness and streaming support"
+ title="screenpipe cloud"
+ description="use openai or anthropic models without worrying about api keys or usage"
imageSrc="/images/screenpipe.png"
selected={settings.aiProviderType === "screenpipe-cloud"}
onClick={() => handleAiProviderChange("screenpipe-cloud")}
@@ -322,8 +322,8 @@ const AISection = () => {
<AIProviderCard
type="openai"
- title="OpenAI"
- description="Use your own OpenAI API key for GPT-4 and other models"
+ title="openai"
+ description="use your own openai api key for gpt-4 and other models"
imageSrc="/images/openai.png"
selected={settings.aiProviderType === "openai"}
onClick={() => handleAiProviderChange("openai")}
@@ -331,8 +331,8 @@ const AISection = () => {
<AIProviderCard
type="native-ollama"
- title="Ollama"
- description="Run AI models locally using your existing ollama installation"
+ title="ollama"
+ description="run ai models locally using your existing ollama installation"
imageSrc="/images/ollama.png"
selected={settings.aiProviderType === "native-ollama"}
onClick={() => handleAiProviderChange("native-ollama")}
@@ -340,8 +340,8 @@ const AISection = () => {
<AIProviderCard
type="custom"
- title="Custom"
- description="Connect to your own AI provider or self-hosted models"
+ title="custom"
+ description="connect to your own ai provider or self-hosted models"
imageSrc="/images/custom.png"
selected={settings.aiProviderType === "custom"}
onClick={() => handleAiProviderChange("custom")}
@@ -362,7 +362,7 @@ const AISection = () => {
{settings.aiProviderType === "custom" && (
<div className="w-full">
<div className="flex flex-col gap-4 mb-4">
- <Label htmlFor="customAiUrl">Custom URL</Label>
+ <Label htmlFor="customAiUrl">custom url</Label>
<Input
id="customAiUrl"
value={settings.aiUrl}
@@ -416,7 +416,7 @@ const AISection = () => {
{settings.aiProviderType !== "embedded" && (
<div className="w-full">
<div className="flex flex-col gap-4 mb-4 w-full">
- <Label htmlFor="aiModel">AI model</Label>
+ <Label htmlFor="aiModel">ai model</Label>
<Popover>
<PopoverTrigger asChild>
<Button
@@ -430,9 +430,18 @@ const AISection = () => {
</PopoverTrigger>
<PopoverContent className="w-full p-0">
<Command>
- <CommandInput placeholder="select model" />
+ <CommandInput
+ placeholder="select or type model name"
+ onValueChange={(value) => {
+ if (value) {
+ updateSettings({ aiModel: value });
+ }
+ }}
+ />
<CommandList>
- <CommandEmpty>No results found.</CommandEmpty>
+ <CommandEmpty>
+ press enter to use "{settings.aiModel}"
+ </CommandEmpty>
<CommandGroup heading="Suggestions">
{getModelSuggestions(settings.aiProviderType)?.map(
(model) => (
@@ -458,7 +467,7 @@ const AISection = () => {
<div className="w-full">
<div className="flex flex-col gap-4 mb-4 w-full">
- <Label htmlFor="customPrompt">Prompt</Label>
+ <Label htmlFor="customPrompt">prompt</Label>
<div className="flex-grow relative">
<Textarea
id="customPrompt"
@@ -484,7 +493,7 @@ const AISection = () => {
<div className="w-full">
<div className="flex flex-col gap-4 mb-4 w-full">
<Label htmlFor="aiMaxContextChars" className="flex items-center">
- Max Context{" "}
+ max context{" "}
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
@@ -507,7 +516,7 @@ const AISection = () => {
<Slider
id="aiMaxContextChars"
min={1000}
- max={128000}
+ max={512000}
step={1000}
value={[settings.aiMaxContextChars]}
onValueChange={handleMaxContextCharsChange}
@@ -523,9 +532,9 @@ const AISection = () => {
<div className="flex items-center gap-4 mb-4 w-full">
<div className="flex items-center justify-between w-full">
<div className="space-y-1">
- <h4 className="font-medium">Embedded AI</h4>
+ <h4 className="font-medium">embedded ai</h4>
<p className="text-sm text-muted-foreground">
- Enable this to use local ai features in screenpipe.
+ enable this to use local ai features in screenpipe.
</p>
</div>
<div className="flex items-center gap-2">
diff --git a/screenpipe-app-tauri/components/settings/shortcut-section.tsx b/screenpipe-app-tauri/components/settings/shortcut-section.tsx
index e7794c140..4a088eac4 100644
--- a/screenpipe-app-tauri/components/settings/shortcut-section.tsx
+++ b/screenpipe-app-tauri/components/settings/shortcut-section.tsx
@@ -131,12 +131,12 @@ const ShortcutSection = () => {
return (
<div className="w-full space-y-6 py-4">
- <h1 className="text-2xl font-bold">Shortcuts</h1>
+ <h1 className="text-2xl font-bold">shortcuts</h1>
<div className="flex items-center justify-between">
<div className="space-y-1">
- <h4 className="font-medium">Toggle Screenpipe Overlay</h4>
+ <h4 className="font-medium">toggle screenpipe overlay</h4>
<p className="text-sm text-muted-foreground">
- Global shortcut to show/hide the main interface
+ global shortcut to show/hide the main interface
</p>
</div>
<div className="flex items-center gap-4">
diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index 5a7a33526..e6025e680 100644
--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -113,7 +113,7 @@ const DEFAULT_SETTINGS: Settings = {
includedWindows: [],
aiProviderType: "openai",
aiUrl: "https://api.openai.com/v1",
- aiMaxContextChars: 30000,
+ aiMaxContextChars: 100000,
fps: 0.5,
vadSensitivity: "high",
analyticsEnabled: true,
diff --git a/screenpipe-app-tauri/lib/language.ts b/screenpipe-app-tauri/lib/language.ts
index 05914ce78..c754a925d 100644
--- a/screenpipe-app-tauri/lib/language.ts
+++ b/screenpipe-app-tauri/lib/language.ts
@@ -1,77 +1,77 @@
export enum Language {
-English = "english",
-Chinese = "chinese",
-German = "german",
-Spanish = "spanish",
-Russian = "russian",
-Korean = "korean",
-French = "french",
-Japanese = "japanese",
-Portuguese = "portuguese",
-Turkish = "turkish",
-Polish = "polish",
-Catalan = "catalan",
-Dutch = "dutch",
-Arabic = "arabic",
-Swedish = "swedish",
-Italian = "italian",
-Indonesian = "indonesian",
-Hindi = "hindi",
-Finnish = "finnish",
-Hebrew = "hebrew",
-Ukrainian = "ukrainian",
-Greek = "greek",
-Malay = "malay",
-Czech = "czech",
-Romanian = "romanian",
-Danish = "danish",
-Hungarian = "hungarian",
-Norwegian = "norwegian",
-Thai = "thai",
-Urdu = "urdu",
-Croatian = "croatian",
-Bulgarian = "bulgarian",
-Lithuanian = "lithuanian",
-Latin = "latin",
-Malayalam = "malayalam",
-Welsh = "welsh",
-Slovak = "slovak",
-Persian = "persian",
-Latvian = "latvian",
-Bengali = "bengali",
-Serbian = "serbian",
-Azerbaijani = "azerbaijani",
-Slovenian = "slovenian",
-Estonian = "estonian",
-Macedonian = "macedonian",
-Nepali = "nepali",
-Mongolian = "mongolian",
-Bosnian = "bosnian",
-Kazakh = "kazakh",
-Albanian = "albanian",
-Swahili = "swahili",
-Galician = "galician",
-Marathi = "marathi",
-Punjabi = "punjabi",
-Sinhala = "sinhala",
-Khmer = "khmer",
-Afrikaans = "afrikaans",
-Belarusian = "belarusian",
-Gujarati = "gujarati",
-Amharic = "amharic",
-Yiddish = "yiddish",
-Lao = "lao",
-Uzbek = "uzbek",
-Faroese = "faroese",
-Pashto = "pashto",
-Maltese = "maltese",
-Sanskrit = "sanskrit",
-Luxembourgish = "luxembourgish",
-Myanmar = "myanmar",
-Tibetan = "tibetan",
-Tagalog = "tagalog",
-Assamese = "assamese",
-Tatar = "tatar",
-Hausa = "hausa",
-Javanese = "javanese"
-}
\ No newline at end of file
+ english = "english",
+ chinese = "chinese",
+ german = "german",
+ spanish = "spanish",
+ russian = "russian",
+ korean = "korean",
+ french = "french",
+ japanese = "japanese",
+ portuguese = "portuguese",
+ turkish = "turkish",
+ polish = "polish",
+ catalan = "catalan",
+ dutch = "dutch",
+ arabic = "arabic",
+ swedish = "swedish",
+ italian = "italian",
+ indonesian = "indonesian",
+ hindi = "hindi",
+ finnish = "finnish",
+ hebrew = "hebrew",
+ ukrainian = "ukrainian",
+ greek = "greek",
+ malay = "malay",
+ czech = "czech",
+ romanian = "romanian",
+ danish = "danish",
+ hungarian = "hungarian",
+ norwegian = "norwegian",
+ thai = "thai",
+ urdu = "urdu",
+ croatian = "croatian",
+ bulgarian = "bulgarian",
+ lithuanian = "lithuanian",
+ latin = "latin",
+ malayalam = "malayalam",
+ welsh = "welsh",
+ slovak = "slovak",
+ persian = "persian",
+ latvian = "latvian",
+ bengali = "bengali",
+ serbian = "serbian",
+ azerbaijani = "azerbaijani",
+ slovenian = "slovenian",
+ estonian = "estonian",
+ macedonian = "macedonian",
+ nepali = "nepali",
+ mongolian = "mongolian",
+ bosnian = "bosnian",
+ kazakh = "kazakh",
+ albanian = "albanian",
+ swahili = "swahili",
+ galician = "galician",
+ marathi = "marathi",
+ punjabi = "punjabi",
+ sinhala = "sinhala",
+ khmer = "khmer",
+ afrikaans = "afrikaans",
+ belarusian = "belarusian",
+ gujarati = "gujarati",
+ amharic = "amharic",
+ yiddish = "yiddish",
+ lao = "lao",
+ uzbek = "uzbek",
+ faroese = "faroese",
+ pashto = "pashto",
+ maltese = "maltese",
+ sanskrit = "sanskrit",
+ luxembourgish = "luxembourgish",
+ myanmar = "myanmar",
+ tibetan = "tibetan",
+ tagalog = "tagalog",
+ assamese = "assamese",
+ tatar = "tatar",
+ hausa = "hausa",
+ javanese = "javanese",
+}
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index fa9353506..946af4d58 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -4966,7 +4966,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.19.1"
+version = "0.19.4"
dependencies = [
"anyhow",
"axum",