File size: 702 Bytes
e7c4a86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react'

import { Separator } from '@/components/ui/separator'
import { ChatMessage } from '@/components/chat-message'
import { ChatMessageModel } from '@/lib/bots/bing/types'

export interface ChatList {
  messages: ChatMessageModel[]
}

export function ChatList({ messages }: ChatList) {
  if (!messages.length) {
    return null
  }

  return (
    <div className="chat-container relative flex flex-col">
      {messages.map((message, index) => (
        <React.Fragment key={index}>
          <ChatMessage message={message} />
          {index < messages.length - 1 && (
            <Separator className="my-2" />
          )}
        </React.Fragment>
      ))}
    </div>
  )
}