- {isLoadingChats ? (
+ {isLoading ? (
- ) : chatsError ? (
+ ) : error ? (
{t("error_loading_chats") || "Error loading chats"}
diff --git a/surfsense_web/components/ui/display-cards.tsx b/surfsense_web/components/ui/display-cards.tsx
deleted file mode 100644
index e7134d5ee..000000000
--- a/surfsense_web/components/ui/display-cards.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-"use client";
-
-import { Sparkles } from "lucide-react";
-import { cn } from "@/lib/utils";
-
-interface DisplayCardProps {
- className?: string;
- icon?: React.ReactNode;
- title?: string;
- description?: string;
- date?: string;
- iconClassName?: string;
- titleClassName?: string;
-}
-
-function DisplayCard({
- className,
- icon =
,
- title = "Featured",
- description = "Discover amazing content",
- date = "Just now",
- iconClassName = "text-blue-500",
- titleClassName = "text-blue-500",
-}: DisplayCardProps) {
- return (
-
*]:flex [&>*]:items-center [&>*]:gap-2",
- className
- )}
- >
-
-
{description}
-
{date}
-
- );
-}
-
-interface DisplayCardsProps {
- cards?: DisplayCardProps[];
-}
-
-export default function DisplayCards({ cards }: DisplayCardsProps) {
- const defaultCards = [
- {
- className:
- "[grid-area:stack] hover:-translate-y-10 before:absolute before:w-[100%] before:outline-1 before:rounded-xl before:outline-border before:h-[100%] before:content-[''] before:bg-blend-overlay before:bg-background/50 grayscale-[100%] hover:before:opacity-0 before:transition-opacity before:duration:700 hover:grayscale-0 before:left-0 before:top-0",
- },
- {
- className:
- "[grid-area:stack] translate-x-16 translate-y-10 hover:-translate-y-1 before:absolute before:w-[100%] before:outline-1 before:rounded-xl before:outline-border before:h-[100%] before:content-[''] before:bg-blend-overlay before:bg-background/50 grayscale-[100%] hover:before:opacity-0 before:transition-opacity before:duration:700 hover:grayscale-0 before:left-0 before:top-0",
- },
- {
- className: "[grid-area:stack] translate-x-32 translate-y-20 hover:translate-y-10",
- },
- ];
-
- const displayCards = cards || defaultCards;
-
- return (
-
- {displayCards.map((cardProps, index) => (
-
- ))}
-
- );
-}
diff --git a/surfsense_web/contracts/enums/connector.ts b/surfsense_web/contracts/enums/connector.ts
index 6f709f687..6cdbc5656 100644
--- a/surfsense_web/contracts/enums/connector.ts
+++ b/surfsense_web/contracts/enums/connector.ts
@@ -1,5 +1,4 @@
export enum EnumConnectorName {
- SERPER_API = "SERPER_API",
TAVILY_API = "TAVILY_API",
SEARXNG_API = "SEARXNG_API",
LINKUP_API = "LINKUP_API",
diff --git a/surfsense_web/contracts/enums/connectorIcons.tsx b/surfsense_web/contracts/enums/connectorIcons.tsx
index a12d26197..87840d7e4 100644
--- a/surfsense_web/contracts/enums/connectorIcons.tsx
+++ b/surfsense_web/contracts/enums/connectorIcons.tsx
@@ -21,7 +21,6 @@ import {
File,
FileText,
Globe,
- Link,
Microscope,
Search,
Sparkles,
@@ -40,8 +39,6 @@ export const getConnectorIcon = (connectorType: EnumConnectorName | string, clas
return
;
case EnumConnectorName.GITHUB_CONNECTOR:
return
;
- case EnumConnectorName.SERPER_API:
- return
;
case EnumConnectorName.TAVILY_API:
return
;
case EnumConnectorName.SEARXNG_API:
diff --git a/surfsense_web/contracts/types/chat.types.ts b/surfsense_web/contracts/types/chat.types.ts
index a4e5b8f5b..a8d9a7cd2 100644
--- a/surfsense_web/contracts/types/chat.types.ts
+++ b/surfsense_web/contracts/types/chat.types.ts
@@ -28,6 +28,13 @@ export const getChatsRequest = z.object({
.nullish(),
});
+export const searchChatsRequest = z.object({
+ queryParams: paginationQueryParams.extend({
+ title: z.string(),
+ search_space_id: z.number().or(z.string()).optional(),
+ }),
+});
+
export const deleteChatResponse = z.object({
message: z.literal("Chat deleted successfully"),
});
@@ -49,6 +56,7 @@ export type ChatSummary = z.infer
;
export type ChatDetails = z.infer & { messages: Message[] };
export type GetChatDetailsRequest = z.infer;
export type GetChatsRequest = z.infer;
+export type SearchChatsRequest = z.infer;
export type DeleteChatResponse = z.infer;
export type DeleteChatRequest = z.infer;
export type CreateChatRequest = z.infer;
diff --git a/surfsense_web/hooks/use-connector-edit-page.ts b/surfsense_web/hooks/use-connector-edit-page.ts
index f116d4170..80a7b4add 100644
--- a/surfsense_web/hooks/use-connector-edit-page.ts
+++ b/surfsense_web/hooks/use-connector-edit-page.ts
@@ -79,7 +79,6 @@ export function useConnectorEditPage(connectorId: number, searchSpaceId: string)
name: "",
SLACK_BOT_TOKEN: "",
NOTION_INTEGRATION_TOKEN: "",
- SERPER_API_KEY: "",
TAVILY_API_KEY: "",
SEARXNG_HOST: "",
SEARXNG_API_KEY: "",
@@ -118,7 +117,6 @@ export function useConnectorEditPage(connectorId: number, searchSpaceId: string)
name: currentConnector.name,
SLACK_BOT_TOKEN: config.SLACK_BOT_TOKEN || "",
NOTION_INTEGRATION_TOKEN: config.NOTION_INTEGRATION_TOKEN || "",
- SERPER_API_KEY: config.SERPER_API_KEY || "",
TAVILY_API_KEY: config.TAVILY_API_KEY || "",
SEARXNG_HOST: config.SEARXNG_HOST || "",
SEARXNG_API_KEY: config.SEARXNG_API_KEY || "",
@@ -282,16 +280,6 @@ export function useConnectorEditPage(connectorId: number, searchSpaceId: string)
};
}
break;
- case "SERPER_API":
- if (formData.SERPER_API_KEY !== originalConfig.SERPER_API_KEY) {
- if (!formData.SERPER_API_KEY) {
- toast.error("Serper Key empty.");
- setIsSaving(false);
- return;
- }
- newConfig = { SERPER_API_KEY: formData.SERPER_API_KEY };
- }
- break;
case "TAVILY_API":
if (formData.TAVILY_API_KEY !== originalConfig.TAVILY_API_KEY) {
if (!formData.TAVILY_API_KEY) {
@@ -570,8 +558,6 @@ export function useConnectorEditPage(connectorId: number, searchSpaceId: string)
"NOTION_INTEGRATION_TOKEN",
newlySavedConfig.NOTION_INTEGRATION_TOKEN || ""
);
- } else if (connector.connector_type === "SERPER_API") {
- editForm.setValue("SERPER_API_KEY", newlySavedConfig.SERPER_API_KEY || "");
} else if (connector.connector_type === "TAVILY_API") {
editForm.setValue("TAVILY_API_KEY", newlySavedConfig.TAVILY_API_KEY || "");
} else if (connector.connector_type === "SEARXNG_API") {
diff --git a/surfsense_web/hooks/use-connectors.ts b/surfsense_web/hooks/use-connectors.ts
index 830677ea5..211a5e815 100644
--- a/surfsense_web/hooks/use-connectors.ts
+++ b/surfsense_web/hooks/use-connectors.ts
@@ -23,7 +23,6 @@ export interface CreateConnectorRequest {
// Get connector type display name
export const getConnectorTypeDisplay = (type: string): string => {
const typeMap: Record = {
- SERPER_API: "Serper API",
TAVILY_API: "Tavily API",
SEARXNG_API: "SearxNG",
};
diff --git a/surfsense_web/lib/apis/chats-api.service.ts b/surfsense_web/lib/apis/chats-api.service.ts
index 7c53815a4..58cad48b0 100644
--- a/surfsense_web/lib/apis/chats-api.service.ts
+++ b/surfsense_web/lib/apis/chats-api.service.ts
@@ -11,6 +11,8 @@ import {
type GetChatsRequest,
getChatDetailsRequest,
getChatsRequest,
+ type SearchChatsRequest,
+ searchChatsRequest,
type UpdateChatRequest,
updateChatRequest,
} from "@/contracts/types/chat.types";
@@ -59,6 +61,28 @@ class ChatApiService {
return baseApiService.get(`/api/v1/chats?${queryParams}`, z.array(chatSummary));
};
+ searchChats = async (request: SearchChatsRequest) => {
+ // Validate the request
+ const parsedRequest = searchChatsRequest.safeParse(request);
+
+ if (!parsedRequest.success) {
+ console.error("Invalid request:", parsedRequest.error);
+
+ // Format a user frendly error message
+ const errorMessage = parsedRequest.error.errors.map((err) => err.message).join(", ");
+ throw new ValidationError(`Invalid request: ${errorMessage}`);
+ }
+
+ // Transform queries params to be string values
+ const transformedQueryParams = Object.fromEntries(
+ Object.entries(parsedRequest.data.queryParams).map(([k, v]) => [k, String(v)])
+ );
+
+ const queryParams = new URLSearchParams(transformedQueryParams).toString();
+
+ return baseApiService.get(`/api/v1/chats/search?${queryParams}`, z.array(chatSummary));
+ };
+
deleteChat = async (request: DeleteChatRequest) => {
// Validate the request
const parsedRequest = deleteChatRequest.safeParse(request);
diff --git a/surfsense_web/lib/connectors/utils.ts b/surfsense_web/lib/connectors/utils.ts
index c921bd1a8..648175332 100644
--- a/surfsense_web/lib/connectors/utils.ts
+++ b/surfsense_web/lib/connectors/utils.ts
@@ -1,7 +1,6 @@
// Helper function to get connector type display name
export const getConnectorTypeDisplay = (type: string): string => {
const typeMap: Record = {
- SERPER_API: "Serper API",
TAVILY_API: "Tavily API",
SEARXNG_API: "SearxNG",
SLACK_CONNECTOR: "Slack",