From 487f4f7891488540993eeb01b8da942932c52416 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Wed, 10 Jan 2024 17:04:32 +0700 Subject: [PATCH] added calculation active model size into available RAM --- web/screens/ExploreModels/ExploreModelItemHeader/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx b/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx index 851e5bada..c35e480f2 100644 --- a/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx +++ b/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx @@ -14,6 +14,7 @@ import ModalCancelDownload from '@/containers/ModalCancelDownload' import { MainViewState } from '@/constants/screens' +import { useActiveModel } from '@/hooks/useActiveModel' import { useCreateNewThread } from '@/hooks/useCreateNewThread' import useDownloadModel from '@/hooks/useDownloadModel' import { useDownloadState } from '@/hooks/useDownloadState' @@ -83,9 +84,11 @@ const ExploreModelItemHeader: React.FC = ({ model, onClick, open }) => { downloadButton = } + const { activeModel } = useActiveModel() + const getLabel = (size: number) => { const minimumRamModel = size * 1.25 - const availableRam = totalRam - usedRam + const availableRam = totalRam - usedRam + (activeModel?.metadata.size ?? 0) if (minimumRamModel > totalRam) { return (