mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
Add use podcasts
This commit is contained in:
parent
666ea87a9d
commit
13342eb823
3 changed files with 43 additions and 1 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue