From a3aceb8f60e8bd00f6c82df1ff655dd326c22808 Mon Sep 17 00:00:00 2001 From: Louis Date: Sun, 18 Feb 2024 14:24:54 +0700 Subject: [PATCH] fix: settings page state loop and dark theme (#2065) * fix: settings page state loop and dark theme * fix: crash on visiting settings page --- core/src/node/helper/config.ts | 3 +-- web/screens/Settings/Advanced/index.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/src/node/helper/config.ts b/core/src/node/helper/config.ts index a47875e68..71e721578 100644 --- a/core/src/node/helper/config.ts +++ b/core/src/node/helper/config.ts @@ -1,8 +1,7 @@ -import { AppConfiguration, SystemResourceInfo } from '../../types' +import { AppConfiguration } from '../../types' import { join } from 'path' import fs from 'fs' import os from 'os' -import { log, logServer } from './log' import childProcess from 'child_process' // TODO: move this to core diff --git a/web/screens/Settings/Advanced/index.tsx b/web/screens/Settings/Advanced/index.tsx index 43204d7c1..2b6f6fd17 100644 --- a/web/screens/Settings/Advanced/index.tsx +++ b/web/screens/Settings/Advanced/index.tsx @@ -85,14 +85,14 @@ const Advanced = () => { useEffect(() => { const setUseGpuIfPossible = async () => { const settings = await readSettings() - setGpuEnabled(settings.run_mode === 'gpu' && gpuList.length > 0) + setGpuEnabled(settings.run_mode === 'gpu' && settings.gpus?.length > 0) setGpusInUse(settings.gpus_in_use || []) if (settings.gpus) { setGpuList(settings.gpus) } } setUseGpuIfPossible() - }, [readSettings, gpuList]) + }, [readSettings]) const clearLogs = async () => { if (await fs.existsSync(`file://logs`)) { @@ -258,7 +258,7 @@ const Advanced = () => { disabled={gpuList.length === 0 || !gpuEnabled} value={selectedGpu.join()} > - + {selectedGpu.join()} @@ -273,7 +273,7 @@ const Advanced = () => {
{gpuList .filter((gpu) => - gpu.name.toLowerCase().includes('nvidia') + gpu.name?.toLowerCase().includes('nvidia') ) .map((gpu) => (