From 3aa58cee62a2c7f2b6f53d4a4340091a0015264a Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Mon, 4 Dec 2023 19:18:18 +0700 Subject: [PATCH] Finished flow hub screen --- web/containers/DropdownListSidebar/index.tsx | 14 +++++++++++--- web/screens/Chat/index.tsx | 2 +- .../ExploreModels/ExploreModelItemHeader/index.tsx | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/web/containers/DropdownListSidebar/index.tsx b/web/containers/DropdownListSidebar/index.tsx index 589847fdf..84bc6623b 100644 --- a/web/containers/DropdownListSidebar/index.tsx +++ b/web/containers/DropdownListSidebar/index.tsx @@ -19,6 +19,7 @@ import { twMerge } from 'tailwind-merge' import { MainViewState } from '@/constants/screens' +import { useActiveModel } from '@/hooks/useActiveModel' import { getDownloadedModels } from '@/hooks/useGetDownloadedModels' import { useMainViewState } from '@/hooks/useMainViewState' @@ -35,6 +36,7 @@ export default function DropdownListSidebar() { const activeThread = useAtomValue(activeThreadAtom) const [selected, setSelected] = useState() const { setMainViewState } = useMainViewState() + const { activeModel, stateModel } = useActiveModel() useEffect(() => { getDownloadedModels().then((downloadedModels) => { @@ -42,18 +44,24 @@ export default function DropdownListSidebar() { if (downloadedModels.length > 0) { setSelected( downloadedModels.filter( - (x) => x.id === activeThread?.assistants[0].model.id + (x) => + x.id === activeThread?.assistants[0].model.id || + x.id === activeModel?.id )[0] || downloadedModels[0] ) setSelectedModel( downloadedModels.filter( - (x) => x.id === activeThread?.assistants[0].model.id + (x) => + x.id === activeThread?.assistants[0].model.id || + x.id === activeModel?.id )[0] || downloadedModels[0] ) } }) // eslint-disable-next-line react-hooks/exhaustive-deps - }, [activeThread]) + }, [activeThread, activeModel]) + + if (stateModel.loading) return null return (