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 { join } from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
import { log, logServer } from './log'
|
|
||||||
import childProcess from 'child_process'
|
import childProcess from 'child_process'
|
||||||
|
|
||||||
// TODO: move this to core
|
// TODO: move this to core
|
||||||
|
|||||||
@ -85,14 +85,14 @@ const Advanced = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const setUseGpuIfPossible = async () => {
|
const setUseGpuIfPossible = async () => {
|
||||||
const settings = await readSettings()
|
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 || [])
|
setGpusInUse(settings.gpus_in_use || [])
|
||||||
if (settings.gpus) {
|
if (settings.gpus) {
|
||||||
setGpuList(settings.gpus)
|
setGpuList(settings.gpus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setUseGpuIfPossible()
|
setUseGpuIfPossible()
|
||||||
}, [readSettings, gpuList])
|
}, [readSettings])
|
||||||
|
|
||||||
const clearLogs = async () => {
|
const clearLogs = async () => {
|
||||||
if (await fs.existsSync(`file://logs`)) {
|
if (await fs.existsSync(`file://logs`)) {
|
||||||
@ -258,7 +258,7 @@ const Advanced = () => {
|
|||||||
disabled={gpuList.length === 0 || !gpuEnabled}
|
disabled={gpuList.length === 0 || !gpuEnabled}
|
||||||
value={selectedGpu.join()}
|
value={selectedGpu.join()}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="w-[340px] bg-white">
|
<SelectTrigger className="w-[340px] dark:bg-gray-500 bg-white">
|
||||||
<SelectValue placeholder={gpuSelectionPlaceHolder}>
|
<SelectValue placeholder={gpuSelectionPlaceHolder}>
|
||||||
<span className="line-clamp-1 w-full pr-8">
|
<span className="line-clamp-1 w-full pr-8">
|
||||||
{selectedGpu.join()}
|
{selectedGpu.join()}
|
||||||
@ -273,7 +273,7 @@ const Advanced = () => {
|
|||||||
<div className="rounded-lg bg-secondary p-3">
|
<div className="rounded-lg bg-secondary p-3">
|
||||||
{gpuList
|
{gpuList
|
||||||
.filter((gpu) =>
|
.filter((gpu) =>
|
||||||
gpu.name.toLowerCase().includes('nvidia')
|
gpu.name?.toLowerCase().includes('nvidia')
|
||||||
)
|
)
|
||||||
.map((gpu) => (
|
.map((gpu) => (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user