fix: Model Manager scan Auto Add not detecting checkpoint correctly

This commit is contained in:
blessedcoolant 2023-07-18 14:14:44 +12:00
parent c3a7e35ad8
commit d45ff7e100

View File

@ -19,18 +19,16 @@ export default function ScanAdvancedAddModels() {
const [advancedAddMode, setAdvancedAddMode] =
useState<ManualAddMode>('diffusers');
const [isCheckpoint, setIsCheckpoint] = useState(
advancedAddScanModel &&
['.ckpt', '.safetensors', '.pth', '.pt'].some((ext) =>
advancedAddScanModel.endsWith(ext)
)
);
const [isCheckpoint, setIsCheckpoint] = useState<boolean>(false);
useEffect(() => {
isCheckpoint
advancedAddScanModel &&
['.ckpt', '.safetensors', '.pth', '.pt'].some((ext) =>
advancedAddScanModel.endsWith(ext)
)
? setAdvancedAddMode('checkpoint')
: setAdvancedAddMode('diffusers');
}, [setAdvancedAddMode, isCheckpoint]);
}, [advancedAddScanModel, setAdvancedAddMode]);
const dispatch = useAppDispatch();