From 623dd624049735d57718d480da9eec5a8b0c4b51 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Tue, 16 Jan 2024 16:59:49 +0700 Subject: [PATCH] Showing empty state when logs are empty --- web/containers/DropdownListSidebar/index.tsx | 14 ++ web/containers/Layout/BottomBar/index.tsx | 2 - web/screens/LocalServer/Logs.tsx | 153 +++++++++++++++++-- 3 files changed, 158 insertions(+), 11 deletions(-) diff --git a/web/containers/DropdownListSidebar/index.tsx b/web/containers/DropdownListSidebar/index.tsx index b12263678..0dc23c71a 100644 --- a/web/containers/DropdownListSidebar/index.tsx +++ b/web/containers/DropdownListSidebar/index.tsx @@ -47,6 +47,20 @@ export default function DropdownListSidebar() { const setThreadModelParams = useSetAtom(setThreadModelParamsAtom) const { setMainViewState } = useMainViewState() + const [openAISettings, setOpenAISettings] = useState< + { api_key: string } | undefined + >(undefined) + const { readOpenAISettings, saveOpenAISettings } = useEngineSettings() + const totalRam = useAtomValue(totalRamAtom) + const usedRam = useAtomValue(usedRamAtom) + + useEffect(() => { + readOpenAISettings().then((settings) => { + setOpenAISettings(settings) + }) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + const { recommendedModel, downloadedModels } = useRecommendedModel() const selectedName = diff --git a/web/containers/Layout/BottomBar/index.tsx b/web/containers/Layout/BottomBar/index.tsx index ec7a8081b..6e334b9ef 100644 --- a/web/containers/Layout/BottomBar/index.tsx +++ b/web/containers/Layout/BottomBar/index.tsx @@ -1,5 +1,3 @@ -import { useState } from 'react' - import { Badge, Button, diff --git a/web/screens/LocalServer/Logs.tsx b/web/screens/LocalServer/Logs.tsx index 97b625f40..589fbf64b 100644 --- a/web/screens/LocalServer/Logs.tsx +++ b/web/screens/LocalServer/Logs.tsx @@ -19,15 +19,150 @@ const Logs = () => { return (
- - {logs.map((log, i) => { - return ( -

- {log} -

- ) - })} -
+ {logs.length > 1 ? ( + + {logs.map((log, i) => { + return ( +

+ {log} +

+ ) + })} +
+ ) : ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Empty logs

+
+ )}
) }