diff --git a/web/containers/ModelDropdown/index.tsx b/web/containers/ModelDropdown/index.tsx index d95a114c4..46154ce34 100644 --- a/web/containers/ModelDropdown/index.tsx +++ b/web/containers/ModelDropdown/index.tsx @@ -1,4 +1,11 @@ -import { useState, useMemo, useEffect, useCallback, useRef } from 'react' +import { + useState, + useMemo, + useEffect, + useCallback, + useRef, + Fragment, +} from 'react' import Image from 'next/image' @@ -553,10 +560,9 @@ const ModelDropdown = ({ (c) => c.id === model.id ) return ( - <> + {isDownloaded && (
  • )} - +
    ) })} diff --git a/web/hooks/useHardwareManagement.ts b/web/hooks/useHardwareManagement.ts index 90dbdb2b5..a7103e50b 100644 --- a/web/hooks/useHardwareManagement.ts +++ b/web/hooks/useHardwareManagement.ts @@ -57,24 +57,20 @@ export function useGetHardwareInfo(updatePeriodically: boolean = true) { revalidateOnFocus: false, revalidateOnReconnect: false, refreshInterval: updatePeriodically ? 2000 : undefined, + onSuccess(data) { + const usedMemory = data.ram.total - data.ram.available + setUsedRam(usedMemory) + + setTotalRam(data.ram.total) + + const ramUtilitized = (usedMemory / data.ram.total) * 100 + setRamUtilitized(Math.round(ramUtilitized)) + + setCpuUsage(Math.round(data.cpu.usage)) + }, } ) - const usedMemory = - Number(hardware?.ram.total) - Number(hardware?.ram.available) - - if (hardware?.ram?.total && hardware?.ram?.available) - setUsedRam(Number(usedMemory)) - - if (hardware?.ram?.total) setTotalRam(hardware.ram.total) - - const ramUtilitized = - ((Number(usedMemory) ?? 0) / (hardware?.ram.total ?? 1)) * 100 - - setRamUtilitized(Math.round(ramUtilitized)) - - setCpuUsage(Math.round(hardware?.cpu.usage ?? 0)) - return { hardware, error, mutate } }