Add Spandrel models to the list of models in the Model Manager tab.

This commit is contained in:
Ryan Dick 2024-07-02 09:21:25 -04:00
parent c1c8e55e8e
commit 9328c17ded

View File

@ -11,6 +11,7 @@ import {
useLoRAModels, useLoRAModels,
useMainModels, useMainModels,
useRefinerModels, useRefinerModels,
useSpandrelImageToImageModels,
useT2IAdapterModels, useT2IAdapterModels,
useVAEModels, useVAEModels,
} from 'services/api/hooks/modelsByType'; } from 'services/api/hooks/modelsByType';
@ -71,6 +72,12 @@ const ModelList = () => {
[vaeModels, searchTerm, filteredModelType] [vaeModels, searchTerm, filteredModelType]
); );
const [spandrelImageToImageModels, { isLoading: isLoadingSpandrelImageToImageModels }] = useSpandrelImageToImageModels();
const filteredSpandrelImageToImageModels = useMemo(
() => modelsFilter(spandrelImageToImageModels, searchTerm, filteredModelType),
[spandrelImageToImageModels, searchTerm, filteredModelType]
);
const totalFilteredModels = useMemo(() => { const totalFilteredModels = useMemo(() => {
return ( return (
filteredMainModels.length + filteredMainModels.length +
@ -80,7 +87,8 @@ const ModelList = () => {
filteredControlNetModels.length + filteredControlNetModels.length +
filteredT2IAdapterModels.length + filteredT2IAdapterModels.length +
filteredIPAdapterModels.length + filteredIPAdapterModels.length +
filteredVAEModels.length filteredVAEModels.length +
filteredSpandrelImageToImageModels.length
); );
}, [ }, [
filteredControlNetModels.length, filteredControlNetModels.length,
@ -91,6 +99,7 @@ const ModelList = () => {
filteredRefinerModels.length, filteredRefinerModels.length,
filteredT2IAdapterModels.length, filteredT2IAdapterModels.length,
filteredVAEModels.length, filteredVAEModels.length,
filteredSpandrelImageToImageModels.length,
]); ]);
return ( return (
@ -143,6 +152,11 @@ const ModelList = () => {
{!isLoadingT2IAdapterModels && filteredT2IAdapterModels.length > 0 && ( {!isLoadingT2IAdapterModels && filteredT2IAdapterModels.length > 0 && (
<ModelListWrapper title={t('common.t2iAdapter')} modelList={filteredT2IAdapterModels} key="t2i-adapters" /> <ModelListWrapper title={t('common.t2iAdapter')} modelList={filteredT2IAdapterModels} key="t2i-adapters" />
)} )}
{/* Spandrel Image to Image List */}
{isLoadingSpandrelImageToImageModels && <FetchingModelsLoader loadingMessage="Loading Spandrel Image to Image Models..." />}
{!isLoadingSpandrelImageToImageModels && filteredSpandrelImageToImageModels.length > 0 && (
<ModelListWrapper title="Spandrel Image to Image" modelList={filteredSpandrelImageToImageModels} key="spandrel-image-to-image" />
)}
{totalFilteredModels === 0 && ( {totalFilteredModels === 0 && (
<Flex w="full" h="full" alignItems="center" justifyContent="center"> <Flex w="full" h="full" alignItems="center" justifyContent="center">
<Text>{t('modelManager.noMatchingModels')}</Text> <Text>{t('modelManager.noMatchingModels')}</Text>