fix: settings page state loop and dark theme (#2065)

* fix: settings page state loop and dark theme

* fix: crash on visiting settings page
This commit is contained in:
Louis 2024-02-18 14:24:54 +07:00 committed by GitHub
parent 537b7d8004
commit a3aceb8f60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -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

View File

@ -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()}
>
<SelectTrigger className="w-[340px] bg-white">
<SelectTrigger className="w-[340px] dark:bg-gray-500 bg-white">
<SelectValue placeholder={gpuSelectionPlaceHolder}>
<span className="line-clamp-1 w-full pr-8">
{selectedGpu.join()}
@ -273,7 +273,7 @@ const Advanced = () => {
<div className="rounded-lg bg-secondary p-3">
{gpuList
.filter((gpu) =>
gpu.name.toLowerCase().includes('nvidia')
gpu.name?.toLowerCase().includes('nvidia')
)
.map((gpu) => (
<div