mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
refactor podcast api calls
This commit is contained in:
parent
7223a7b04d
commit
5361290315
10 changed files with 288 additions and 377 deletions
|
|
@ -4,18 +4,11 @@ import { LoaderIcon, PanelRight, TriangleAlert } from "lucide-react";
|
|||
import { toast } from "sonner";
|
||||
import { activeChatAtom, activeChatIdAtom } from "@/atoms/chats/chat-querie.atoms";
|
||||
import { activeChathatUIAtom } from "@/atoms/chats/ui.atoms";
|
||||
import { generatePodcast } from "@/lib/apis/podcasts.api";
|
||||
import type { GeneratePodcastRequest } from "@/contracts/types/podcast.types";
|
||||
import { podcastsApiService } from "@/lib/apis/podcasts-api.service";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ChatPanelView } from "./ChatPanelView";
|
||||
|
||||
export interface GeneratePodcastRequest {
|
||||
type: "CHAT" | "DOCUMENT";
|
||||
ids: number[];
|
||||
search_space_id: number;
|
||||
podcast_title?: string;
|
||||
user_prompt?: string;
|
||||
}
|
||||
|
||||
export function ChatPanelContainer() {
|
||||
const {
|
||||
data: activeChatState,
|
||||
|
|
@ -31,7 +24,7 @@ export function ChatPanelContainer() {
|
|||
if (!authToken) {
|
||||
throw new Error("Authentication error. Please log in again.");
|
||||
}
|
||||
await generatePodcast(request, authToken);
|
||||
await podcastsApiService.generatePodcast(request);
|
||||
toast.success(`Podcast generation started!`);
|
||||
} catch (error) {
|
||||
toast.error("Error generating podcast. Please log in again.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue