diff --git a/surfsense_web/components/chat/ChatInterface.tsx b/surfsense_web/components/chat/ChatInterface.tsx index b865c36e7..377d141b4 100644 --- a/surfsense_web/components/chat/ChatInterface.tsx +++ b/surfsense_web/components/chat/ChatInterface.tsx @@ -10,6 +10,7 @@ import { ChatInputUI } from "@/components/chat/ChatInputGroup"; import { ChatMessagesUI } from "@/components/chat/ChatMessages"; import { useChatAPI } from "@/hooks/use-chat"; import type { Document } from "@/hooks/use-documents"; +import { usePodcast } from "@/hooks/use-podcast"; import { ChatPanelContainer } from "./ChatPanel/ChatPanelContainer"; interface ChatInterfaceProps { @@ -55,11 +56,21 @@ export default function ChatInterface({ chatDetails, }; + const { getPodcastByChatId } = usePodcast(); + const { fetchChatDetails } = useChatAPI({ token: localStorage.getItem("surfsense_bearer_token"), search_space_id: search_space_id as string, }); + const getPodcast = useCallback( + async (id: string) => { + const podcast = await getPodcastByChatId(Number(id)); + setPodcast(podcast); + }, + [getPodcastByChatId] + ); + const getChat = useCallback( async (id: string) => { const chat = await fetchChatDetails(id); @@ -72,6 +83,7 @@ export default function ChatInterface({ const id = typeof chat_id === "string" ? chat_id : chat_id ? chat_id[0] : ""; if (!id) return; getChat(id); + getPodcast(id); }, [chat_id, search_space_id]); return ( diff --git a/surfsense_web/components/chat/ChatPanel/ConfigModal.tsx b/surfsense_web/components/chat/ChatPanel/ConfigModal.tsx index 98b163212..d0caeab5e 100644 --- a/surfsense_web/components/chat/ChatPanel/ConfigModal.tsx +++ b/surfsense_web/components/chat/ChatPanel/ConfigModal.tsx @@ -39,7 +39,7 @@ export function ConfigModal(props: ConfigModalProps) { > - + e.stopPropagation()} align="end" className="bg-sidebar w-96 ">