* feat: starter screen * chore: update flow starter screen * fix CI Signed-off-by: James <namnh0122@gmail.com> * chore: update variable name * chore: fix CI * update download cortex binary Signed-off-by: James <namnh0122@gmail.com> --------- Signed-off-by: James <namnh0122@gmail.com> Co-authored-by: James <namnh0122@gmail.com>
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { Fragment, useEffect } from 'react'
|
|
|
|
import { Model } from '@janhq/core'
|
|
import { useAtom, useAtomValue } from 'jotai'
|
|
|
|
import useCortex from '@/hooks/useCortex'
|
|
import useModels from '@/hooks/useModels'
|
|
|
|
import ThreadLeftPanel from '@/screens/Thread/ThreadLeftPanel'
|
|
|
|
import ThreadCenterPanel from './ThreadCenterPanel'
|
|
import EmptyModel from './ThreadCenterPanel/ChatBody/EmptyModel'
|
|
import ThreadRightPanel from './ThreadRightPanel'
|
|
|
|
import { downloadedModelsAtom } from '@/helpers/atoms/Model.atom'
|
|
import {
|
|
isAnyRemoteModelConfiguredAtom,
|
|
setUpRemoteModelStageAtom,
|
|
} from '@/helpers/atoms/SetupRemoteModel.atom'
|
|
|
|
const ThreadScreen = () => {
|
|
const downloadedModels = useAtomValue(downloadedModelsAtom)
|
|
const isAnyRemoteModelConfigured = useAtomValue(
|
|
isAnyRemoteModelConfiguredAtom
|
|
)
|
|
const { createModel } = useCortex()
|
|
const { getModels } = useModels()
|
|
|
|
const [{ metadata }] = useAtom(setUpRemoteModelStageAtom)
|
|
|
|
useEffect(() => {
|
|
if (isAnyRemoteModelConfigured) {
|
|
createModel(metadata?.model as Model)
|
|
getModels()
|
|
}
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [isAnyRemoteModelConfigured])
|
|
|
|
return (
|
|
<div className="relative flex h-full w-full flex-1 overflow-x-hidden">
|
|
{!downloadedModels.length && !isAnyRemoteModelConfigured ? (
|
|
<EmptyModel />
|
|
) : (
|
|
<Fragment>
|
|
<ThreadLeftPanel />
|
|
<ThreadCenterPanel />
|
|
</Fragment>
|
|
)}
|
|
<ThreadRightPanel />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ThreadScreen
|