"use client" import { useEffect, useRef } from "react" import { cn } from "@/lib/utils" import { User, Bot } from "lucide-react" export interface TranscriptMessage { id: string role: "user" | "agent" content: string timestamp: Date isStreaming?: boolean } interface TranscriptDisplayProps { messages: TranscriptMessage[] className?: string } export function TranscriptDisplay({ messages, className }: TranscriptDisplayProps) { const scrollRef = useRef(null) useEffect(() => { // Auto-scroll to bottom when new messages arrive if (scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight } }, [messages]) const formatTime = (date: Date) => { return new Intl.DateTimeFormat("en-US", { hour: "2-digit", minute: "2-digit", second: "2-digit", }).format(date) } return (
{messages.length === 0 ? (

Start speaking to see the conversation transcript

Your words will appear here in real-time

) : ( messages.map((message) => (
{message.role === "agent" && (
)}

{message.content} {message.isStreaming && ( )}

{formatTime(message.timestamp)}
{message.role === "user" && (
)}
)) )}
) }