Skip to content

Commit

Permalink
feat: add open data folder button, tooltip + fix include frame +
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Sep 16, 2024
1 parent 6cacc64 commit de558a4
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 24 deletions.
44 changes: 38 additions & 6 deletions screenpipe-app-tauri/components/screenpipe-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import { Separator } from "./ui/separator";
import { Card, CardContent, CardFooter } from "./ui/card";
import { useHealthCheck } from "@/lib/hooks/use-health-check";
import { DevSettings } from "./dev-dialog";
import { Lock } from "lucide-react";
import { Lock, Folder } from "lucide-react";
import { open } from "@tauri-apps/plugin-shell";
import { homeDir } from "@tauri-apps/api/path";

const getDebuggingCommands = (os: string | null) => {
let cliInstructions = "";
Expand All @@ -50,7 +52,7 @@ ${cliInstructions}
# 3. Run: screenpipe -h
# 4. Choose your preferred setup and start Screenpipe:
# (Replace [YOUR_ARGS] with your chosen arguments)
# Example: screenpipe --data-dir `;
# Example: screenpipe --fps 1 `;

const dataDir =
os === "windows" ? "%USERPROFILE%\\.screenpipe" : "$HOME/.screenpipe";
Expand Down Expand Up @@ -208,8 +210,8 @@ const DevModeSettings = () => {
<p className="text-sm text-muted-foreground mb-4">
on = use CLI for more control
<br />
in dev mode, backend won&apos;t <br />auto start when starting the
app
in dev mode, backend won&apos;t <br />
auto start when starting the app
</p>
</div>
</CardContent>
Expand Down Expand Up @@ -357,6 +359,26 @@ const HealthStatus = ({ className }: { className?: string }) => {
}
};

const handleOpenDataDir = async () => {
try {
const homeDirPath = await homeDir();

const dataDir =
platform() === "macos" || platform() === "linux"
? `${homeDirPath}/.screenpipe`
: `${homeDirPath}\\.screenpipe`;
await open(dataDir as string);
} catch (error) {
console.error("failed to open data directory:", error);
toast({
title: "error",
description: "failed to open data directory.",
variant: "destructive",
duration: 3000,
});
}
};

const getStatusColor = (status: string) => {
switch (status) {
case "Healthy":
Expand Down Expand Up @@ -397,11 +419,21 @@ const HealthStatus = ({ className }: { className?: string }) => {
</Badge>
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
<DialogContent
className="max-w-3xl max-h-[80vh] flex flex-col"
className="max-w-3xl max-h-[80vh] flex flex-col p-8"
aria-describedby="status-dialog-description"
>
<DialogHeader>
<DialogHeader className="flex flex-row items-center justify-between">
<DialogTitle>{health.status.toLowerCase()} status</DialogTitle>

<Button
variant="outline"
size="sm"
onClick={handleOpenDataDir}
className="flex-shrink-0"
>
<Folder className="h-4 w-4 mr-2" />
open data dir
</Button>
</DialogHeader>
<div className="flex-grow overflow-auto">
<p className="text-sm mb-2">
Expand Down
49 changes: 31 additions & 18 deletions screenpipe-app-tauri/components/search-chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,22 +360,34 @@ export function SearchChat() {
<VideoComponent filePath={item.content.file_path} />
</div>
{includeFrames && item.content.frame && (
<Dialog>
<DialogTrigger asChild>
<img
src={`data:image/jpeg;base64,${item.content.frame}`}
alt="Frame"
className="mt-2 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>
<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>
)}
</>
)}
Expand Down Expand Up @@ -626,8 +638,9 @@ export function SearchChat() {
</TooltipTrigger>
<TooltipContent>
<p>
include frames in the search results. this will only show
frames for ocr. this slows down the search.
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>
Expand Down
1 change: 1 addition & 0 deletions screenpipe-app-tauri/lib/screenpipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export async function queryScreenpipe(
content_type: params.content_type,
app_name: params.app_name,
window_name: params.window_name, // Add window_name to query parameters
include_frames: params.include_frames.toString(),
min_length: params.min_length.toString(),
max_length: params.max_length.toString(),
}).filter(([_, v]) => v != null) as [string, string][]
Expand Down

0 comments on commit de558a4

Please sign in to comment.