diff --git a/web/screens/Settings/Advanced/index.tsx b/web/screens/Settings/Advanced/index.tsx index e1ccaf6a4..2d9f85712 100644 --- a/web/screens/Settings/Advanced/index.tsx +++ b/web/screens/Settings/Advanced/index.tsx @@ -8,9 +8,8 @@ import { ChangeEvent, } from 'react' -import { openExternalUrl } from '@janhq/core' +import { openExternalUrl, fs } from '@janhq/core' -import { fs } from '@janhq/core' import { Switch, Button, @@ -42,6 +41,12 @@ import { useSettings } from '@/hooks/useSettings' import DataFolder from './DataFolder' import FactoryReset from './FactoryReset' +type GPU = { + id: string + vram: number | null + name: string +} + const Advanced = () => { const { experimentalFeature, @@ -53,9 +58,7 @@ const Advanced = () => { } = useContext(FeatureToggleContext) const [partialProxy, setPartialProxy] = useState(proxy) const [gpuEnabled, setGpuEnabled] = useState(false) - const [gpuList, setGpuList] = useState([ - { id: 'none', vram: null, name: 'none' }, - ]) + const [gpuList, setGpuList] = useState([]) const [gpusInUse, setGpusInUse] = useState([]) const { readSettings, saveSettings, validateSettings, setShowNotification } = useSettings() @@ -117,6 +120,9 @@ const Advanced = () => { saveSettings({ gpusInUse: updatedGpusInUse }) } + const gpuSelectionPlaceHolder = + gpuList.length > 0 ? 'Select GPU' : "You don't have any compatible GPU" + return (
{/* Keyboard shortcut */} @@ -155,7 +161,7 @@ const Advanced = () => { {/* CPU / GPU switching */} {!isMac && (
-
+
@@ -204,6 +210,7 @@ const Advanced = () => { { if (e === true) { @@ -245,77 +252,70 @@ const Advanced = () => { )}
- - {gpuEnabled && ( -
- - + + + + {selectedGpu.join()} + + + + + + + Nvidia +
+
+ {gpuList + .filter((gpu) => + gpu.name.toLowerCase().includes('nvidia') + ) + .map((gpu) => ( +
+ handleGPUChange(gpu.id)} + /> +
- ))} -
- {/* Warning message */} - {gpuEnabled && gpusInUse.length > 1 && ( -
- -

- If multi-GPU is enabled with different GPU models - or without NVLink, it could impact token speed. -

-
- )} + {gpu.name} + {gpu.vram}MB VRAM + +
+ ))}
- + {/* Warning message */} + {gpuEnabled && gpusInUse.length > 1 && ( +
+ +

+ If multi-GPU is enabled with different GPU models or + without NVLink, it could impact token speed. +

+
+ )} +
+ - {/* TODO enable this when we support AMD */} - - - -
- )} + {/* TODO enable this when we support AMD */} + + + +
)}