diff --git a/pipes/search/bun.lockb b/pipes/search/bun.lockb index 4d9d0181b..4514d2088 100755 Binary files a/pipes/search/bun.lockb and b/pipes/search/bun.lockb differ diff --git a/pipes/search/src/app/layout.tsx b/pipes/search/src/app/layout.tsx index 7fef7d66a..917144a62 100644 --- a/pipes/search/src/app/layout.tsx +++ b/pipes/search/src/app/layout.tsx @@ -1,6 +1,7 @@ import type { Metadata } from "next"; import { Geist, Geist_Mono } from "next/font/google"; import "./globals.css"; +import { Toaster } from "@/components/ui/toaster"; const geistSans = Geist({ variable: "--font-geist-sans", @@ -29,6 +30,8 @@ export default function RootLayout({ className={`${geistSans.variable} ${geistMono.variable} antialiased`} > {children} + + ); diff --git a/pipes/search/src/components/example-search-cards.tsx b/pipes/search/src/components/example-search-cards.tsx index c8ff98209..ddbc293c2 100644 --- a/pipes/search/src/components/example-search-cards.tsx +++ b/pipes/search/src/components/example-search-cards.tsx @@ -68,7 +68,7 @@ export function ExampleSearchCards({ onSelect }: ExampleSearchCardsProps) { } }; - const isHealthError = health?.status === "error"; + const isHealthError = !health || health === null || health?.status === "error"; return (
diff --git a/pipes/search/src/components/search-chat.tsx b/pipes/search/src/components/search-chat.tsx index 99c615cfe..9cf3b5dae 100644 --- a/pipes/search/src/components/search-chat.tsx +++ b/pipes/search/src/components/search-chat.tsx @@ -37,7 +37,7 @@ import { SpeechIcon, ChevronsUpDown, } from "lucide-react"; -import { useToast } from "@/components/ui/use-toast"; +import { useToast } from "@/lib/use-toast"; import { AnimatePresence, motion } from "framer-motion"; import { generateId, Message } from "ai"; import { OpenAI } from "openai"; @@ -423,7 +423,18 @@ export function SearchChat() { }; }, []); + const isAiDisabled = + !settings.user?.token && settings.aiProviderType === "screenpipe-cloud"; + const handleExampleSelect = async (example: ExampleSearch) => { + if (isAiDisabled){ + toast({ + title: "error", + description: "your selected ai provider is screenpipe-cloud. consider login in app to use screenpipe-cloud", + variant: "destructive", + }); + return; + } const newWindowName = example.windowName || ""; const newAppName = example.appName || ""; const newLimit = example.limit || limit; @@ -736,6 +747,15 @@ export function SearchChat() { }; const handleSearch = async (newOffset = 0, overrides: any = {}) => { + if (isAiDisabled){ + toast({ + title: "error", + description: "your ai provider is screenpipe-cloud. consider login in app to use screenpipe-cloud", + duration: 3000, + variant: "destructive", + }); + return; + } await pipe.captureMainFeatureEvent("search", { contentType: overrides.contentType || contentType, limit: overrides.limit || limit, @@ -1109,8 +1129,6 @@ export function SearchChat() { // Add any other reset logic you need }; - const isAiDisabled = - !settings.user?.token && settings.aiProviderType === "screenpipe-cloud"; return (
@@ -1269,7 +1287,9 @@ export function SearchChat() { - {health?.status === "error" && ( + {!health || health === null + || health?.status === "error" && (

screenpipe is not running...

diff --git a/pipes/search/src/components/ui/toaster.tsx b/pipes/search/src/components/ui/toaster.tsx index fe7103d70..813223577 100644 --- a/pipes/search/src/components/ui/toaster.tsx +++ b/pipes/search/src/components/ui/toaster.tsx @@ -1,6 +1,6 @@ "use client" -import { useToast } from "@/components/ui/use-toast" +import { useToast } from "@/lib/use-toast" import { Toast, ToastClose, diff --git a/pipes/search/src/components/ui/use-toast.ts b/pipes/search/src/lib/use-toast.ts similarity index 100% rename from pipes/search/src/components/ui/use-toast.ts rename to pipes/search/src/lib/use-toast.ts