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,
useMainModels,
useRefinerModels,
useSpandrelImageToImageModels,
useT2IAdapterModels,
useVAEModels,
} from 'services/api/hooks/modelsByType';
@ -71,6 +72,12 @@ const ModelList = () => {
[vaeModels, searchTerm, filteredModelType]
);
const [spandrelImageToImageModels, { isLoading: isLoadingSpandrelImageToImageModels }] = useSpandrelImageToImageModels();
const filteredSpandrelImageToImageModels = useMemo(
() => modelsFilter(spandrelImageToImageModels, searchTerm, filteredModelType),
[spandrelImageToImageModels, searchTerm, filteredModelType]
);
const totalFilteredModels = useMemo(() => {
return (
filteredMainModels.length +
@ -80,7 +87,8 @@ const ModelList = () => {
filteredControlNetModels.length +
filteredT2IAdapterModels.length +
filteredIPAdapterModels.length +
filteredVAEModels.length
filteredVAEModels.length +
filteredSpandrelImageToImageModels.length
);
}, [
filteredControlNetModels.length,
@ -91,6 +99,7 @@ const ModelList = () => {
filteredRefinerModels.length,
filteredT2IAdapterModels.length,
filteredVAEModels.length,
filteredSpandrelImageToImageModels.length,
]);
return (
@ -143,6 +152,11 @@ const ModelList = () => {
{!isLoadingT2IAdapterModels && filteredT2IAdapterModels.length > 0 && (
<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 && (
<Flex w="full" h="full" alignItems="center" justifyContent="center">
<Text>{t('modelManager.noMatchingModels')}</Text>