import { Button } from "@/components/ui/button"; import { Loader2 } from "lucide-react"; import { UseStream } from "@langchain/langgraph-sdk/react"; import { useCancelStream } from "@/hooks/useCancelStream"; interface CancelStreamButtonProps { stream: UseStream; threadId?: string; runId?: string; streamName: "Planner" | "Programmer"; } export function CancelStreamButton({ stream, threadId, runId, streamName, }: CancelStreamButtonProps) { const { cancelRun } = useCancelStream({ stream, threadId, runId, streamName, }); const shouldShow = stream.isLoading && threadId && runId; if (!shouldShow) { return null; } return ( ); }