From 92029e69c61b5a89b698eac3fd7d64de97b53566 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:48:44 +1200 Subject: [PATCH] feat: Update Checkpoint Model Edit to use config picker --- .../components/ImageGrid/GalleryImageGrid.tsx | 4 +- .../ModelManagerPanel/CheckpointModelEdit.tsx | 42 ++++++++++++++++--- .../ModelManagerPanel/DiffusersModelEdit.tsx | 11 ++++- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx index 8b44b39ae9..7811e5f1c4 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx @@ -16,14 +16,13 @@ import { ASSETS_CATEGORIES, IMAGE_CATEGORIES, IMAGE_LIMIT, - selectImagesAll, } from 'features/gallery//store/gallerySlice'; import { selectFilteredImages } from 'features/gallery/store/gallerySelectors'; import { VirtuosoGrid } from 'react-virtuoso'; import { receivedPageOfImages } from 'services/api/thunks/image'; +import { useListBoardImagesQuery } from '../../../../services/api/endpoints/boardImages'; import ImageGridItemContainer from './ImageGridItemContainer'; import ImageGridListContainer from './ImageGridListContainer'; -import { useListBoardImagesQuery } from '../../../../services/api/endpoints/boardImages'; const selector = createSelector( [stateSelector, selectFilteredImages], @@ -180,7 +179,6 @@ const GalleryImageGrid = () => { ); } - console.log({ selectedBoardId }); if (status !== 'rejected') { return ( diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx index 6078ba4a68..960fa1cbf5 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx @@ -4,17 +4,20 @@ import { makeToast } from 'app/components/Toaster'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import IAIButton from 'common/components/IAIButton'; import IAIMantineTextInput from 'common/components/IAIMantineInput'; +import IAISimpleCheckbox from 'common/components/IAISimpleCheckbox'; import { MODEL_TYPE_MAP } from 'features/parameters/types/constants'; import { selectIsBusy } from 'features/system/store/systemSelectors'; import { addToast } from 'features/system/store/systemSlice'; -import { useCallback } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { CheckpointModelConfigEntity, + useGetCheckpointConfigsQuery, useUpdateMainModelsMutation, } from 'services/api/endpoints/models'; import { CheckpointModelConfig } from 'services/api/types'; import BaseModelSelect from '../shared/BaseModelSelect'; +import CheckpointConfigsSelect from '../shared/CheckpointConfigsSelect'; import ModelVariantSelect from '../shared/ModelVariantSelect'; import ModelConvert from './ModelConvert'; @@ -28,6 +31,15 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) { const { model } = props; const [updateMainModel, { isLoading }] = useUpdateMainModelsMutation(); + const { data: availableCheckpointConfigs } = useGetCheckpointConfigsQuery(); + + const [useCustomConfig, setUseCustomConfig] = useState(false); + + useEffect(() => { + if (!availableCheckpointConfigs?.includes(model.config)) { + setUseCustomConfig(true); + } + }, [availableCheckpointConfigs, model.config]); const dispatch = useAppDispatch(); const { t } = useTranslation(); @@ -123,12 +135,15 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) { {...checkpointEditForm.getInputProps('description')} /> @@ -136,10 +151,27 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) { label={t('modelManager.vaeLocation')} {...checkpointEditForm.getInputProps('vae')} /> - + + + {!useCustomConfig ? ( + + ) : ( + + )} + setUseCustomConfig(!useCustomConfig)} + label="Use Custom Config" + /> + + - - + +