Add option to scan loaded folder again

This commit is contained in:
blessedcoolant 2022-12-28 16:07:41 +13:00
parent 942f029a24
commit ad0b366e47
2 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,7 @@
"checkpointFolder": "Checkpoint Folder", "checkpointFolder": "Checkpoint Folder",
"clearCheckpointFolder": "Clear Checkpoint Folder", "clearCheckpointFolder": "Clear Checkpoint Folder",
"findModels": "Find Models", "findModels": "Find Models",
"scanAgain": "Scan Again",
"modelsFound": "Models Found", "modelsFound": "Models Found",
"selectFolder": "Select Folder", "selectFolder": "Select Folder",
"selected": "Selected", "selected": "Selected",

View File

@ -26,6 +26,7 @@ import type { ReactNode, ChangeEvent } from 'react';
import type { FoundModel } from 'app/invokeai'; import type { FoundModel } from 'app/invokeai';
import IAIInput from 'common/components/IAIInput'; import IAIInput from 'common/components/IAIInput';
import { Field, Formik } from 'formik'; import { Field, Formik } from 'formik';
import { BiReset } from 'react-icons/bi';
const existingModelsSelector = createSelector([systemSelector], (system) => { const existingModelsSelector = createSelector([systemSelector], (system) => {
const { model_list } = system; const { model_list } = system;
@ -130,6 +131,10 @@ export default function SearchModels() {
(state: RootState) => state.options.shouldShowExistingModelsInSearch (state: RootState) => state.options.shouldShowExistingModelsInSearch
); );
const isProcessing = useAppSelector(
(state: RootState) => state.system.isProcessing
);
const [modelsToAdd, setModelsToAdd] = React.useState<string[]>([]); const [modelsToAdd, setModelsToAdd] = React.useState<string[]>([]);
const resetSearchModelHandler = () => { const resetSearchModelHandler = () => {
@ -243,6 +248,16 @@ export default function SearchModels() {
> >
{searchFolder} {searchFolder}
</p> </p>
<IAIIconButton
aria-label={t('modelmanager:scanAgain')}
tooltip={t('modelmanager:scanAgain')}
icon={<BiReset />}
position={'absolute'}
right={16}
fontSize={18}
disabled={isProcessing}
onClick={() => dispatch(searchForModels(searchFolder))}
/>
<IAIIconButton <IAIIconButton
aria-label={t('modelmanager:clearCheckpointFolder')} aria-label={t('modelmanager:clearCheckpointFolder')}
icon={<FaPlus style={{ transform: 'rotate(45deg)' }} />} icon={<FaPlus style={{ transform: 'rotate(45deg)' }} />}
@ -277,6 +292,7 @@ export default function SearchModels() {
aria-label={t('modelmanager:findModels')} aria-label={t('modelmanager:findModels')}
tooltip={t('modelmanager:findModels')} tooltip={t('modelmanager:findModels')}
type="submit" type="submit"
disabled={isProcessing}
/> />
</HStack> </HStack>
</form> </form>