-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
111 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
singleQuote: true, | ||
jsxSingleQuote: true, | ||
semi: false, | ||
trailingComma: 'es5', | ||
tabWidth: 2, | ||
useTabs: false, | ||
quoteProps: 'consistent', | ||
bracketSpacing: true, | ||
printWidth: 120, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import * as React from 'react'; | ||
import Container from '@mui/material/Container'; | ||
import ChatHistory, {MessageItem} from "@/components/ChatHistory"; | ||
import * as React from 'react' | ||
import Container from '@mui/material/Container' | ||
import ChatHistory, { MessageItem } from '@/components/ChatHistory' | ||
|
||
export default function Home() { | ||
const messages: MessageItem[] = [ | ||
{message: 'Hello', timestamp: 123, role: 'user'}, | ||
{message: 'Hello from bot', timestamp: 123, role: 'assistant'} | ||
]; | ||
const messages: MessageItem[] = [ | ||
{ message: 'Hello', timestamp: 123, role: 'user' }, | ||
{ message: 'Hello from bot', timestamp: 123, role: 'assistant' }, | ||
] | ||
return ( | ||
<Container maxWidth="lg"> | ||
<ChatHistory messages={messages}/> | ||
<Container maxWidth='lg'> | ||
<ChatHistory messages={messages} /> | ||
</Container> | ||
); | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
import Message from "@/components/Message"; | ||
import Message from '@/components/Message' | ||
|
||
export interface MessageItem { | ||
message: string | ||
timestamp: number | ||
role: 'user' | 'assistant' | ||
message: string | ||
timestamp: number | ||
role: 'user' | 'assistant' | ||
} | ||
|
||
export interface ChatHistoryProps { | ||
messages: MessageItem[] | ||
messages: MessageItem[] | ||
} | ||
|
||
export default function ChatHistory({messages}: ChatHistoryProps) { | ||
return ( | ||
<div> | ||
{messages.map((message, index) => ( | ||
<Message message={message.message} avatar={message.role === 'user' ? '👤' : '🤖'} key={index} | ||
role={message.role}/> | ||
))} | ||
</div> | ||
) | ||
export default function ChatHistory({ messages }: ChatHistoryProps) { | ||
return ( | ||
<div> | ||
{messages.map((message, index) => ( | ||
<Message | ||
message={message.message} | ||
avatar={message.role === 'user' ? '👤' : '🤖'} | ||
key={index} | ||
role={message.role} | ||
/> | ||
))} | ||
</div> | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
import * as React from 'react'; | ||
import AppBar from '@mui/material/AppBar'; | ||
import Box from '@mui/material/Box'; | ||
import Toolbar from '@mui/material/Toolbar'; | ||
import Typography from '@mui/material/Typography'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import MenuIcon from '@mui/icons-material/Menu'; | ||
import * as React from 'react' | ||
import AppBar from '@mui/material/AppBar' | ||
import Box from '@mui/material/Box' | ||
import Toolbar from '@mui/material/Toolbar' | ||
import Typography from '@mui/material/Typography' | ||
import IconButton from '@mui/material/IconButton' | ||
import MenuIcon from '@mui/icons-material/Menu' | ||
|
||
export default function Header() { | ||
return ( | ||
<Box sx={{ flexGrow: 1 }}> | ||
<AppBar position="static"> | ||
<Toolbar> | ||
<IconButton | ||
size="large" | ||
edge="start" | ||
color="inherit" | ||
aria-label="menu" | ||
sx={{ mr: 2 }} | ||
> | ||
<MenuIcon /> | ||
</IconButton> | ||
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}> | ||
LX01 | ||
</Typography> | ||
</Toolbar> | ||
</AppBar> | ||
</Box> | ||
); | ||
return ( | ||
<Box sx={{ flexGrow: 1 }}> | ||
<AppBar position='static'> | ||
<Toolbar> | ||
<IconButton size='large' edge='start' color='inherit' aria-label='menu' sx={{ mr: 2 }}> | ||
<MenuIcon /> | ||
</IconButton> | ||
<Typography variant='h6' component='div' sx={{ flexGrow: 1 }}> | ||
LX01 | ||
</Typography> | ||
</Toolbar> | ||
</AppBar> | ||
</Box> | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
import {ReactNode} from "react"; | ||
import { ReactNode } from 'react' | ||
|
||
export interface MessageProps { | ||
message: string | ||
avatar: ReactNode | ||
role: string | ||
message: string | ||
avatar: ReactNode | ||
role: string | ||
} | ||
|
||
export default function Message(props: MessageProps) { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: props.role === 'user' ? 'row' : 'row-reverse', | ||
alignItems: 'center', | ||
}} | ||
> | ||
{props.avatar} | ||
<div | ||
style={{ | ||
margin: '10px', | ||
}} | ||
>{props.message}</div> | ||
</div> | ||
) | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: props.role === 'user' ? 'row' : 'row-reverse', | ||
alignItems: 'center', | ||
}} | ||
> | ||
{props.avatar} | ||
<div | ||
style={{ | ||
margin: '10px', | ||
}} | ||
> | ||
{props.message} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import * as React from 'react'; | ||
import Link from '@mui/material/Link'; | ||
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; | ||
import Typography from '@mui/material/Typography'; | ||
import * as React from 'react' | ||
import Link from '@mui/material/Link' | ||
import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon' | ||
import Typography from '@mui/material/Typography' | ||
|
||
function LightBulbIcon(props: SvgIconProps) { | ||
return ( | ||
<SvgIcon {...props}> | ||
<path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z" /> | ||
<path d='M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z' /> | ||
</SvgIcon> | ||
); | ||
) | ||
} | ||
|
||
export default function ProTip() { | ||
return ( | ||
<Typography sx={{ mt: 6, mb: 3, color: 'text.secondary' }}> | ||
<LightBulbIcon sx={{ mr: 1, verticalAlign: 'middle' }} /> | ||
{'Pro tip: See more '} | ||
<Link href="https://mui.com/material-ui/getting-started/templates/">templates</Link> | ||
<Link href='https://mui.com/material-ui/getting-started/templates/'>templates</Link> | ||
{' in the Material UI documentation.'} | ||
</Typography> | ||
); | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters