mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Update Checkpoint Model Edit to use config picker
This commit is contained in:
parent
5351171d0e
commit
92029e69c6
@ -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 = () => {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
console.log({ selectedBoardId });
|
||||
|
||||
if (status !== 'rejected') {
|
||||
return (
|
||||
|
@ -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<boolean>(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')}
|
||||
/>
|
||||
<BaseModelSelect
|
||||
required
|
||||
{...checkpointEditForm.getInputProps('base_model')}
|
||||
/>
|
||||
<ModelVariantSelect
|
||||
required
|
||||
{...checkpointEditForm.getInputProps('variant')}
|
||||
/>
|
||||
<IAIMantineTextInput
|
||||
required
|
||||
label={t('modelManager.modelLocation')}
|
||||
{...checkpointEditForm.getInputProps('path')}
|
||||
/>
|
||||
@ -136,10 +151,27 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) {
|
||||
label={t('modelManager.vaeLocation')}
|
||||
{...checkpointEditForm.getInputProps('vae')}
|
||||
/>
|
||||
|
||||
<Flex flexDirection="column" gap={2}>
|
||||
{!useCustomConfig ? (
|
||||
<CheckpointConfigsSelect
|
||||
required
|
||||
{...checkpointEditForm.getInputProps('config')}
|
||||
/>
|
||||
) : (
|
||||
<IAIMantineTextInput
|
||||
required
|
||||
label={t('modelManager.config')}
|
||||
{...checkpointEditForm.getInputProps('config')}
|
||||
/>
|
||||
)}
|
||||
<IAISimpleCheckbox
|
||||
isChecked={useCustomConfig}
|
||||
onChange={() => setUseCustomConfig(!useCustomConfig)}
|
||||
label="Use Custom Config"
|
||||
/>
|
||||
</Flex>
|
||||
|
||||
<IAIButton
|
||||
type="submit"
|
||||
isDisabled={isBusy || isLoading}
|
||||
|
@ -112,9 +112,16 @@ export default function DiffusersModelEdit(props: DiffusersModelEditProps) {
|
||||
label={t('modelManager.description')}
|
||||
{...diffusersEditForm.getInputProps('description')}
|
||||
/>
|
||||
<BaseModelSelect {...diffusersEditForm.getInputProps('base_model')} />
|
||||
<ModelVariantSelect {...diffusersEditForm.getInputProps('variant')} />
|
||||
<BaseModelSelect
|
||||
required
|
||||
{...diffusersEditForm.getInputProps('base_model')}
|
||||
/>
|
||||
<ModelVariantSelect
|
||||
required
|
||||
{...diffusersEditForm.getInputProps('variant')}
|
||||
/>
|
||||
<IAIMantineTextInput
|
||||
required
|
||||
label={t('modelManager.modelLocation')}
|
||||
{...diffusersEditForm.getInputProps('path')}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user