mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix: Type resolutions & Bug Fixes
- Fix checkpoint filter not working - Resolve all typescript and undefined issues in Model Manager List / Edit Forms and main panel
This commit is contained in:
parent
5a6ad99d4e
commit
3568e28b1c
@ -17,19 +17,23 @@ export default function ModelManagerPanel() {
|
|||||||
const renderModelEditTabs = () => {
|
const renderModelEditTabs = () => {
|
||||||
if (!openModel || !mainModels) return;
|
if (!openModel || !mainModels) return;
|
||||||
|
|
||||||
if (mainModels['entities'][openModel]['model_format'] === 'diffusers') {
|
const openedModelData = mainModels['entities'][openModel];
|
||||||
|
|
||||||
|
if (openedModelData && openedModelData.model_format === 'diffusers') {
|
||||||
return (
|
return (
|
||||||
<DiffusersModelEdit
|
<DiffusersModelEdit
|
||||||
modelToEdit={openModel}
|
modelToEdit={openModel}
|
||||||
retrievedModel={mainModels['entities'][openModel]}
|
retrievedModel={openedModelData}
|
||||||
key={openModel}
|
key={openModel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (openedModelData && openedModelData.model_format === 'checkpoint') {
|
||||||
return (
|
return (
|
||||||
<CheckpointModelEdit
|
<CheckpointModelEdit
|
||||||
modelToEdit={openModel}
|
modelToEdit={openModel}
|
||||||
retrievedModel={mainModels['entities'][openModel]}
|
retrievedModel={openedModelData}
|
||||||
key={openModel}
|
key={openModel}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -45,7 +45,7 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) {
|
|||||||
|
|
||||||
const { modelToEdit, retrievedModel } = props;
|
const { modelToEdit, retrievedModel } = props;
|
||||||
|
|
||||||
const [updateMainModel, { error }] = useUpdateMainModelsMutation();
|
const [updateMainModel, { error, isLoading }] = useUpdateMainModelsMutation();
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -145,7 +145,11 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) {
|
|||||||
label={t('modelManager.config')}
|
label={t('modelManager.config')}
|
||||||
{...checkpointEditForm.getInputProps('config')}
|
{...checkpointEditForm.getInputProps('config')}
|
||||||
/>
|
/>
|
||||||
<IAIButton disabled={isProcessing} type="submit">
|
<IAIButton
|
||||||
|
disabled={isProcessing}
|
||||||
|
type="submit"
|
||||||
|
isLoading={isLoading}
|
||||||
|
>
|
||||||
{t('modelManager.updateModel')}
|
{t('modelManager.updateModel')}
|
||||||
</IAIButton>
|
</IAIButton>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -42,7 +42,7 @@ export default function DiffusersModelEdit(props: DiffusersModelEditProps) {
|
|||||||
);
|
);
|
||||||
const { retrievedModel, modelToEdit } = props;
|
const { retrievedModel, modelToEdit } = props;
|
||||||
|
|
||||||
const [updateMainModel, { error }] = useUpdateMainModelsMutation();
|
const [updateMainModel, { isLoading, error }] = useUpdateMainModelsMutation();
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -129,7 +129,11 @@ export default function DiffusersModelEdit(props: DiffusersModelEditProps) {
|
|||||||
label={t('modelManager.vaeLocation')}
|
label={t('modelManager.vaeLocation')}
|
||||||
{...diffusersEditForm.getInputProps('vae')}
|
{...diffusersEditForm.getInputProps('vae')}
|
||||||
/>
|
/>
|
||||||
<IAIButton disabled={isProcessing} type="submit">
|
<IAIButton
|
||||||
|
disabled={isProcessing}
|
||||||
|
type="submit"
|
||||||
|
isLoading={isLoading}
|
||||||
|
>
|
||||||
{t('modelManager.updateModel')}
|
{t('modelManager.updateModel')}
|
||||||
</IAIButton>
|
</IAIButton>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -50,7 +50,7 @@ const ModelList = () => {
|
|||||||
|
|
||||||
const [searchText, setSearchText] = useState<string>('');
|
const [searchText, setSearchText] = useState<string>('');
|
||||||
const [isSelectedFilter, setIsSelectedFilter] = useState<
|
const [isSelectedFilter, setIsSelectedFilter] = useState<
|
||||||
'all' | 'ckpt' | 'diffusers'
|
'all' | 'checkpoint' | 'diffusers'
|
||||||
>('all');
|
>('all');
|
||||||
const [_, startTransition] = useTransition();
|
const [_, startTransition] = useTransition();
|
||||||
|
|
||||||
@ -73,35 +73,39 @@ const ModelList = () => {
|
|||||||
const modelList = mainModels.entities;
|
const modelList = mainModels.entities;
|
||||||
|
|
||||||
Object.keys(modelList).forEach((model, i) => {
|
Object.keys(modelList).forEach((model, i) => {
|
||||||
if (
|
const modelInfo = modelList[model];
|
||||||
modelList[model].name.toLowerCase().includes(searchText.toLowerCase())
|
|
||||||
) {
|
// If no model info found for a model, ignore it
|
||||||
|
if (!modelInfo) return;
|
||||||
|
|
||||||
|
if (modelInfo.name.toLowerCase().includes(searchText.toLowerCase())) {
|
||||||
filteredModelListItemsToRender.push(
|
filteredModelListItemsToRender.push(
|
||||||
<ModelListItem
|
<ModelListItem
|
||||||
key={i}
|
key={i}
|
||||||
modelKey={model}
|
modelKey={model}
|
||||||
name={modelList[model].name}
|
name={modelInfo.name}
|
||||||
description={modelList[model].description}
|
description={modelInfo.description}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
if (modelList[model]?.model_format === isSelectedFilter) {
|
if (modelInfo?.model_format === isSelectedFilter) {
|
||||||
localFilteredModelListItemsToRender.push(
|
localFilteredModelListItemsToRender.push(
|
||||||
<ModelListItem
|
<ModelListItem
|
||||||
key={i}
|
key={i}
|
||||||
modelKey={model}
|
modelKey={model}
|
||||||
name={modelList[model].name}
|
name={modelInfo.name}
|
||||||
description={modelList[model].description}
|
description={modelInfo.description}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modelList[model]?.model_format !== 'diffusers') {
|
|
||||||
|
if (modelInfo?.model_format !== 'diffusers') {
|
||||||
ckptModelListItemsToRender.push(
|
ckptModelListItemsToRender.push(
|
||||||
<ModelListItem
|
<ModelListItem
|
||||||
key={i}
|
key={i}
|
||||||
modelKey={model}
|
modelKey={model}
|
||||||
name={modelList[model].name}
|
name={modelInfo.name}
|
||||||
description={modelList[model].description}
|
description={modelInfo.description}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -109,8 +113,8 @@ const ModelList = () => {
|
|||||||
<ModelListItem
|
<ModelListItem
|
||||||
key={i}
|
key={i}
|
||||||
modelKey={model}
|
modelKey={model}
|
||||||
name={modelList[model].name}
|
name={modelInfo.name}
|
||||||
description={modelList[model].description}
|
description={modelInfo.description}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -170,7 +174,7 @@ const ModelList = () => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isSelectedFilter === 'ckpt' && (
|
{isSelectedFilter === 'checkpoint' && (
|
||||||
<Flex flexDirection="column" marginTop={4}>
|
<Flex flexDirection="column" marginTop={4}>
|
||||||
{ckptModelListItemsToRender}
|
{ckptModelListItemsToRender}
|
||||||
</Flex>
|
</Flex>
|
||||||
@ -206,8 +210,8 @@ const ModelList = () => {
|
|||||||
/>
|
/>
|
||||||
<ModelFilterButton
|
<ModelFilterButton
|
||||||
label={t('modelManager.checkpointModels')}
|
label={t('modelManager.checkpointModels')}
|
||||||
onClick={() => setIsSelectedFilter('ckpt')}
|
onClick={() => setIsSelectedFilter('checkpoint')}
|
||||||
isActive={isSelectedFilter === 'ckpt'}
|
isActive={isSelectedFilter === 'checkpoint'}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user