Download src/components/chat-messages.tsx from IOE-IFAD/test: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/spaces/IOE-IFAD/test/resolve/main/src/components/chat-messages.tsx
- Command line
-
hf download hf://spaces/IOE-IFAD/test/src/components/chat-messages.tsx
-
curl -L -o chat-messages.tsx https://huggingface.co/spaces/IOE-IFAD/test/resolve/main/src/components/chat-messages.tsx
1.59 kB
| import { ScrollArea } from "@/components/ui/scroll-area"; | |
| import MessageBlock from "@/components/message"; | |
| import { Loader2 } from "lucide-react"; | |
| import type { Chat, Transcript } from "@/lib/types"; | |
| interface ChatMessagesProps { | |
| selectedChat: Chat | null; | |
| isLoading: boolean; | |
| scrollRef: React.RefObject<HTMLDivElement | null>; | |
| onTranscriptClick: (transcript: Transcript) => Promise<void>; | |
| onEvaluate: (messageIndex: number) => void; | |
| } | |
| export default function ChatMessages({ | |
| selectedChat, | |
| isLoading, | |
| scrollRef, | |
| onTranscriptClick, | |
| onEvaluate, | |
| }: ChatMessagesProps) { | |
| if (!selectedChat) { | |
| return null; | |
| } | |
| return ( | |
| <ScrollArea className="flex-1 custom-scrollbar" ref={scrollRef}> | |
| <div className="p-3 sm:p-6 space-y-4 sm:space-y-6 min-h-full max-w-4xl mx-auto"> | |
| {selectedChat.messages.map((message, index) => | |
| message.role !== "system" ? ( | |
| <div key={message.id} className="message-animate"> | |
| <MessageBlock | |
| message={message} | |
| handleTranscriptClick={onTranscriptClick} | |
| onEvaluate={() => onEvaluate(index)} | |
| /> | |
| </div> | |
| ) : null | |
| )} | |
| {isLoading && ( | |
| <div className="flex justify-center py-6 sm:py-8"> | |
| <div className="flex items-center space-x-2 text-muted-foreground"> | |
| <Loader2 className="h-4 w-4 sm:h-5 sm:w-5 animate-spin" /> | |
| <span className="text-sm">Analyzing transcripts...</span> | |
| </div> | |
| </div> | |
| )} | |
| </div> | |
| </ScrollArea> | |
| ); | |
| } | |