File size: 875 Bytes
abb7588
 
66e93d1
abb7588
 
 
 
 
 
 
f80b091
abb7588
 
 
f80b091
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
abb7588
 
 
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
30
31
32
33
34
35
'use client';

import { MediaDetails } from '@/lib/fetch';
import useChatWithMedia from '@/lib/hooks/useChatWithMedia';
import React from 'react';
import { ChatList } from '../chat/ChatList';
import { ChatScrollAnchor } from '../chat/ChatScrollAnchor';
import { ChatPanel } from '../chat/ChatPanel';

export interface ChatProps {
  mediaList: MediaDetails[];
}

const Chat: React.FC<ChatProps> = ({ mediaList }) => {
  const { messages, append, reload, stop, isLoading, input, setInput } =
    useChatWithMedia(mediaList);
  return (
    <>
      <ChatList messages={messages} />
      <ChatScrollAnchor trackVisibility={isLoading} />
      <ChatPanel
        isLoading={isLoading}
        stop={stop}
        append={append}
        reload={reload}
        messages={messages}
        input={input}
        setInput={setInput}
      />
    </>
  );
};

export default Chat;