* Make thread screen as default screen * Blank state when user have not any model * Cleanup topbar thread screen * Improve style right panel * Add instructions right panel * Styling thread list history * Resolve conflict * Default title new thread * Fix trigger panel sidebar * Make default right panel false when no activethread * Fix CI test * chore: assistant instruction with system prompt * Fix title and blank state explore the hub * Claenup style thread screen and add buble message for assitant * Remove unused import * Styling more menus on thread list and right panel, and make max height textarea 400 pixel * Finished revamp ui thread * Finished system monitor UI * Style box running models * Make animate right panel more smooth * Add status arround textarea for starting model info * Temporary disable hide left panel * chore: system resource monitoring update * copy nits * chore: typo * Reverse icon chevron accordion * Move my models into setting page --------- Co-authored-by: Louis <louis@jan.ai> Co-authored-by: 0xSage <n@pragmatic.vc>
67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
import { Fragment } from 'react'
|
|
|
|
import ScrollToBottom from 'react-scroll-to-bottom'
|
|
|
|
import { Button } from '@janhq/uikit'
|
|
import { useAtomValue } from 'jotai'
|
|
|
|
import LogoMark from '@/containers/Brand/Logo/Mark'
|
|
|
|
import { MainViewState } from '@/constants/screens'
|
|
|
|
import { useGetDownloadedModels } from '@/hooks/useGetDownloadedModels'
|
|
|
|
import { useMainViewState } from '@/hooks/useMainViewState'
|
|
|
|
import ChatItem from '../ChatItem'
|
|
|
|
import { getCurrentChatMessagesAtom } from '@/helpers/atoms/ChatMessage.atom'
|
|
|
|
const ChatBody: React.FC = () => {
|
|
const messages = useAtomValue(getCurrentChatMessagesAtom)
|
|
const { downloadedModels } = useGetDownloadedModels()
|
|
const { setMainViewState } = useMainViewState()
|
|
|
|
if (downloadedModels.length === 0)
|
|
return (
|
|
<div className="mx-auto flex h-full w-3/4 flex-col items-center justify-center text-center">
|
|
<LogoMark
|
|
className="mx-auto mb-4 animate-wave"
|
|
width={56}
|
|
height={56}
|
|
/>
|
|
<h1 className="text-2xl font-bold">Welcome!</h1>
|
|
<p className="mt-1 text-base">You need to download your first model</p>
|
|
<Button
|
|
className="mt-4"
|
|
onClick={() => setMainViewState(MainViewState.Hub)}
|
|
>
|
|
Explore The Hub
|
|
</Button>
|
|
</div>
|
|
)
|
|
|
|
return (
|
|
<Fragment>
|
|
{messages.length === 0 ? (
|
|
<div className="mx-auto flex h-full w-3/4 flex-col items-center justify-center text-center">
|
|
<LogoMark
|
|
className="mx-auto mb-4 animate-wave"
|
|
width={56}
|
|
height={56}
|
|
/>
|
|
<p className="mt-1 text-base font-medium">How can I help you?</p>
|
|
</div>
|
|
) : (
|
|
<ScrollToBottom className="flex h-full w-full flex-col">
|
|
{messages.map((message) => (
|
|
<ChatItem {...message} key={message.id} />
|
|
))}
|
|
</ScrollToBottom>
|
|
)}
|
|
</Fragment>
|
|
)
|
|
}
|
|
|
|
export default ChatBody
|