40 |
41 | {messages.length === 0 && (
42 |
{
43 | setPrompt(text);
44 | handleSubmit(new Event('submit') as any);
45 | }} />
46 | )}
47 | {messages.map(msg => (
48 |
49 |
50 | {msg.text}
51 |
52 |
53 | ))}
54 |
55 |
56 |
75 |
76 |
77 | );
78 | };
79 |
80 | export default ChatContainer;
81 |
--------------------------------------------------------------------------------
/chatui/src/components/ChatList.tsx:
--------------------------------------------------------------------------------
1 | import { useNavigate, useParams } from 'react-router-dom';
2 | import { Chat } from '../types/ChatTypes';
3 |
4 | interface ChatListProps {
5 | chats: Chat[];
6 | selectedChat: Chat | null;
7 | setSelectedChat: (chat: Chat) => void;
8 | }
9 |
10 | function ChatList({ chats, selectedChat, setSelectedChat }: ChatListProps) {
11 | const navigate = useNavigate();
12 | const params = useParams();
13 |
14 | return (
15 |
16 | {
17 | chats.map(chat => (
18 |
29 | ))
30 | }
31 |
32 | );
33 | }
34 |
35 | export default ChatList;
36 |
--------------------------------------------------------------------------------
/chatui/src/components/LandingPage.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | interface LandingPageProps {
4 | onExampleClick: (text: string) => void;
5 | }
6 |
7 | const examples = [
8 | "Explain quantum computing in simple terms",
9 | "Got any creative ideas for a 10 year old's birthday?",
10 | "How do I make an HTTP request in Javascript?"
11 | ];
12 |
13 | const LandingPage: React.FC