fix: should stop running the model when GPU settings are changed (#2067)

This commit is contained in:
Louis 2024-02-18 15:09:15 +07:00 committed by GitHub
parent a3aceb8f60
commit 56034d682a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,6 +36,7 @@ import { snackbar, toaster } from '@/containers/Toast'
import { FeatureToggleContext } from '@/context/FeatureToggle' import { FeatureToggleContext } from '@/context/FeatureToggle'
import { useActiveModel } from '@/hooks/useActiveModel'
import { useSettings } from '@/hooks/useSettings' import { useSettings } from '@/hooks/useSettings'
import DataFolder from './DataFolder' import DataFolder from './DataFolder'
@ -62,6 +63,7 @@ const Advanced = () => {
const [gpusInUse, setGpusInUse] = useState<string[]>([]) const [gpusInUse, setGpusInUse] = useState<string[]>([])
const { readSettings, saveSettings, validateSettings, setShowNotification } = const { readSettings, saveSettings, validateSettings, setShowNotification } =
useSettings() useSettings()
const { stopModel } = useActiveModel()
const selectedGpu = gpuList const selectedGpu = gpuList
.filter((x) => gpusInUse.includes(x.id)) .filter((x) => gpusInUse.includes(x.id))
@ -232,6 +234,8 @@ const Advanced = () => {
type: 'success', type: 'success',
}) })
} }
// Stop any running model to apply the changes
if (e !== gpuEnabled) stopModel()
}} }}
/> />
</TooltipTrigger> </TooltipTrigger>