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:
parent
537b7d8004
commit
a3aceb8f60
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user