返回 presentation-ai
useClearPresentationChat.ts
根目录 / src / hooks / presentation / useClearPresentationChat.ts
1 import { useMutation } from "@tanstack/react-query";
2 import { toast } from "sonner";
3
4 import { clearPresentationChat } from "@/app/_actions/notebook/presentation/clearPresentationChat";
5
6 export function useClearPresentationChat() {
7 const { mutate: clearChatMutation, isPending } = useMutation({
8 mutationFn: (presentationId: string) =>
9 clearPresentationChat(presentationId),
10 onError: () => {
11 toast.error("Failed to clear presentation chat");
12 },
13 });
14 return { clearChat: clearChatMutation, isPending };
15 }
16
16 lines TYPESCRIPT