import { ScrollArea, Progress, Badge, Button, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipTrigger, } from '@janhq/uikit' import { useAtom, useAtomValue } from 'jotai' import { useActiveModel } from '@/hooks/useActiveModel' import { toGibibytes } from '@/utils/converter' import { serverEnabledAtom } from '@/helpers/atoms/LocalServer.atom' import { cpuUsageAtom, totalRamAtom, usedRamAtom, } from '@/helpers/atoms/SystemBar.atom' const Column = ['Name', 'Model ID', 'Size', 'Version', 'Action'] export default function SystemMonitorScreen() { const totalRam = useAtomValue(totalRamAtom) const usedRam = useAtomValue(usedRamAtom) const cpuUsage = useAtomValue(cpuUsageAtom) const { activeModel, stateModel, stopModel } = useActiveModel() const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom) return (

ram ({Math.round((usedRam / totalRam) * 100)}%)

{toGibibytes(usedRam)} of {toGibibytes(totalRam)} used

cpu ({cpuUsage}%)

{cpuUsage}% of 100%
{activeModel && (

Actively Running Models

{Column.map((col, i) => { return ( ) })}
{col}
{activeModel.name} {activeModel.id} {toGibibytes(activeModel.metadata.size)} v{activeModel.version} {serverEnabled && ( The API server is running, stop the model will also stop the server )}
)}
) }