fix is_disable_switch_model

This commit is contained in:
Qing
2022-11-25 08:55:10 +08:00
parent d44dd8822c
commit f7d7e89197
4 changed files with 42 additions and 18 deletions

View File

@@ -5,11 +5,11 @@ import useInputImage from './hooks/useInputImage'
import LandingPage from './components/LandingPage/LandingPage'
import { themeState } from './components/Header/ThemeChanger'
import Workspace from './components/Workspace'
import { fileState, toastState } from './store/Atoms'
import { fileState, isDisableModelSwitchState, toastState } from './store/Atoms'
import { keepGUIAlive } from './utils'
import Header from './components/Header/Header'
import useHotKey from './hooks/useHotkey'
import { isDesktop } from './adapters/inpainting'
import { getIsDisableModelSwitch, isDesktop } from './adapters/inpainting'
const SUPPORTED_FILE_TYPE = [
'image/jpeg',
@@ -24,8 +24,9 @@ function App() {
const [theme, setTheme] = useRecoilState(themeState)
const [toastVal, setToastState] = useRecoilState(toastState)
const userInputImage = useInputImage()
const [openPasteImageAlertDialog, setOpenPasteImageAlertDialog] =
useState(false)
const [isDisableModelSwitch, setIsDisableModelSwitch] = useRecoilState(
isDisableModelSwitchState
)
// Set Input Image
useEffect(() => {
@@ -43,6 +44,17 @@ function App() {
fetchData()
}, [])
useEffect(() => {
const fetchData = async () => {
const isDisable: string = await getIsDisableModelSwitch().then(res =>
res.text()
)
setIsDisableModelSwitch(isDisable === 'true')
}
fetchData()
}, [])
// Dark Mode Hotkey
useHotKey(
'shift+d',