diff --git a/surfsense_web/components/chat/ChatPanel/ConfigModal.tsx b/surfsense_web/components/chat/ChatPanel/ConfigModal.tsx new file mode 100644 index 000000000..77b617f5f --- /dev/null +++ b/surfsense_web/components/chat/ChatPanel/ConfigModal.tsx @@ -0,0 +1,66 @@ +"use client"; + +import { Pencil } from "lucide-react"; +import { useCallback, useContext } from "react"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { chatInterfaceContext } from "../ChatInterface"; +import type { GeneratePodcastRequest } from "./actions"; + +interface ConfigModalProps { + generatePodcast: (request: GeneratePodcastRequest) => Promise; +} + +export function ConfigModal(props: ConfigModalProps) { + const context = useContext(chatInterfaceContext); + + if (!context) { + throw new Error("chatInterfaceContext must be used within a ChatProvider"); + } + const { chatDetails } = context; + const { generatePodcast } = props; + + const handleGeneratePost = useCallback(async () => { + if (!chatDetails) return; + await generatePodcast({ + type: "CHAT", + ids: [chatDetails.id], + search_space_id: chatDetails.search_space_id, + podcast_title: chatDetails.title, + }); + }, [chatDetails]); + return ( + + + + + +
+ + + + + +
+
+
+ ); +}