"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>
  );
}
