Files
next-tjwater-drainage-frontend/features/agent/components/streaming-token-response.tsx
T

37 lines
728 B
TypeScript

"use client";
import { cn } from "@/lib/utils";
import { MessageResponse } from "@/shared/ai-elements/message";
type StreamingTokenResponseProps = {
content: string;
streaming: boolean;
streamDone?: boolean;
className?: string;
messageId?: string;
};
export function StreamingTokenResponse({
content,
streaming,
streamDone = !streaming,
className,
}: StreamingTokenResponseProps) {
if (!content) {
return null;
}
const isAnimating = streaming && !streamDone;
return (
<MessageResponse
className={cn("agent-streaming-response", className)}
isAnimating={isAnimating}
mode="streaming"
parseIncompleteMarkdown={true}
>
{content}
</MessageResponse>
);
}