// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates // SPDX-License-Identifier: MIT import { Podcast } from "lucide-react"; import { useCallback, useRef, useState } from "react"; import { Button } from "~/components/ui/button"; import { listenToPodcast, useMessage } from "~/core/store"; import { cn } from "~/lib/utils"; import { LoadingAnimation } from "./loading-animation"; import { Markdown } from "./markdown"; import { Tooltip } from "./tooltip"; export function ResearchReportBlock({ className, researchId, messageId, }: { className?: string; researchId: string; messageId: string; }) { const message = useMessage(messageId); const contentRef = useRef(null); const [isGenerated, setGenerated] = useState(false); const handleListenToReport = useCallback(async () => { if (isGenerated) { return; } setGenerated(true); await listenToPodcast(researchId); }, [isGenerated, researchId]); return (
{message?.content && !message.isStreaming && ( )}
{message?.content} {message?.isStreaming && }
); }