diff --git a/surfsense_web/components/chat/ChatPanel/ChatPanelView.tsx b/surfsense_web/components/chat/ChatPanel/ChatPanelView.tsx new file mode 100644 index 000000000..0d2b86ab8 --- /dev/null +++ b/surfsense_web/components/chat/ChatPanel/ChatPanelView.tsx @@ -0,0 +1,63 @@ +"use client"; + +import { Pencil, Podcast } from "lucide-react"; +import { useContext, useTransition } from "react"; +import { cn } from "@/lib/utils"; +import { chatInterfaceContext } from "../ChatInterface"; +import type { GeneratePodcastRequest } from "./actions"; +import { ConfigModal } from "./ConfigModal"; + +interface ChatPanelViewProps { + generatePodcast: (request: GeneratePodcastRequest) => Promise; +} + +export function ChatPanelView(props: ChatPanelViewProps) { + const context = useContext(chatInterfaceContext); + if (!context) { + throw new Error("chatInterfaceContext must be used within a ChatProvider"); + } + + const { isChatPannelOpen, setIsChatPannelOpen } = context; + const { generatePodcast } = props; + + const [isGeneratingPodcast, startGeneratingPodcast] = useTransition(); + + const handleGeneratePodcast = () => { + startGeneratingPodcast(() => { + generatePodcast({ + type: "CHAT", + ids: [1], + search_space_id: 1, + }); + }); + }; + + return ( +
+
+ {isChatPannelOpen ? ( +
+
+ + +
+

Generate Podcast

+
+ ) : ( + + )} +
+
+ ); +}