Skip to content

Commit 62a14bb

Browse files
feat(ui): use enriched starter model metadata
1 parent d7ae2cd commit 62a14bb

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

invokeai/frontend/web/public/locales/en.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,18 +873,19 @@
873873
"starterBundleHelpText": "Easily install all models needed to get started with a base model, including a main model, controlnets, IP adapters, and more. Selecting a bundle will skip any models that you already have installed.",
874874
"starterModels": "Starter Models",
875875
"starterModelsInModelManager": "Starter Models can be found in Model Manager",
876+
"bundleAlreadyInstalled": "Bundle {{bundleName}} already installed",
876877
"launchpadTab": "Launchpad",
877878
"launchpad": {
878879
"welcome": "Welcome to Model Management",
879-
"description": "Invoke requires you to install or import models to utilize many of the features in the platform. In order to get started, you can begin by adding models to your InvokeAI installation. Choose from manual installation options or explore curated starter models.",
880+
"description": "Invoke requires models to be installed to utilize most features of the platform. Choose from manual installation options or explore curated starter models.",
880881
"manualInstall": "Manual Installation",
881882
"urlDescription": "Install models from a URL or local file path. Perfect for specific models you want to add.",
882883
"huggingFaceDescription": "Browse and install models directly from HuggingFace repositories.",
883884
"scanFolderDescription": "Scan a local folder to automatically detect and install models.",
884885
"recommendedModels": "Recommended Models",
885-
"exploreStarter": "Browse all available starter models",
886+
"exploreStarter": "Or browse all available starter models",
886887
"quickStart": "Quick Start Bundles",
887-
"bundleDescription": "Each bundle includes essential models for each model family and curated base models to get started",
888+
"bundleDescription": "Each bundle includes essential models for each model family and curated base models to get started.",
888889
"browseAll": "Or browse all available models:",
889890
"stableDiffusion15": "Stable Diffusion 1.5",
890891
"sdxl": "SDXL",

invokeai/frontend/web/src/features/modelManagerV2/hooks/useStarterBundleInstall.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { toast } from 'features/toast/toast';
33
import { useCallback } from 'react';
44
import { useTranslation } from 'react-i18next';
55
import { useInstallModelMutation } from 'services/api/endpoints/models';
6-
import type { StarterModel } from 'services/api/types';
6+
import type { S } from 'services/api/types';
77

88
import { flattenStarterModel, useBuildModelInstallArg } from './useBuildModelsToInstall';
99

@@ -13,9 +13,9 @@ export const useStarterBundleInstall = () => {
1313
const { t } = useTranslation();
1414

1515
const getModelsToInstall = useCallback(
16-
(bundle: StarterModel[]) => {
16+
(bundle: S['StarterModelBundle']) => {
1717
// Flatten the models and remove duplicates, which is expected as models can have the same dependencies
18-
const flattenedModels = flatMap(bundle, flattenStarterModel);
18+
const flattenedModels = flatMap(bundle.models, flattenStarterModel);
1919
const uniqueModels = uniqWith(
2020
flattenedModels,
2121
(m1, m2) => m1.source === m2.source || (m1.name === m2.name && m1.base === m2.base && m1.type === m2.type)
@@ -30,17 +30,15 @@ export const useStarterBundleInstall = () => {
3030
);
3131

3232
const installBundle = useCallback(
33-
(bundle: StarterModel[], bundleName?: string) => {
33+
(bundle: S['StarterModelBundle']) => {
3434
const modelsToInstall = getModelsToInstall(bundle);
3535

3636
if (modelsToInstall.install.length === 0) {
37-
if (bundleName) {
38-
toast({
39-
status: 'info',
40-
title: t('modelManager.bundleAlreadyInstalled', { bundleName }),
41-
description: t('modelManager.allModelsAlreadyInstalled'),
42-
});
43-
}
37+
toast({
38+
status: 'info',
39+
title: t('modelManager.bundleAlreadyInstalled', { bundleName: bundle.name }),
40+
description: t('modelManager.allModelsAlreadyInstalled'),
41+
});
4442
return;
4543
}
4644

invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/LaunchpadForm/LaunchpadForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const LaunchpadForm = memo(() => {
2525
return;
2626
}
2727

28-
installBundle(bundle, bundleName);
28+
installBundle(bundle);
2929
},
3030
[starterModelsData, installBundle]
3131
);

invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/StarterModels/StarterBundle.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ import { isMainModelBase } from 'features/nodes/types/common';
44
import { MODEL_TYPE_SHORT_MAP } from 'features/parameters/types/constants';
55
import { useCallback, useMemo } from 'react';
66
import { useTranslation } from 'react-i18next';
7-
import type { StarterModel } from 'services/api/types';
7+
import type { S } from 'services/api/types';
88

9-
export const StarterBundle = ({ bundleName, bundle }: { bundleName: string; bundle: StarterModel[] }) => {
9+
export const StarterBundle = ({ bundle }: { bundle: S['StarterModelBundle'] }) => {
1010
const { installBundle, getModelsToInstall } = useStarterBundleInstall();
1111
const { t } = useTranslation();
1212

13-
const modelsToInstall = useMemo(() => getModelsToInstall(bundle), [getModelsToInstall, bundle]);
13+
const modelsToInstall = useMemo(() => getModelsToInstall(bundle), [bundle, getModelsToInstall]);
1414

1515
const handleClickBundle = useCallback(() => {
16-
installBundle(bundle, bundleName);
17-
}, [installBundle, bundle, bundleName]);
16+
installBundle(bundle);
17+
}, [installBundle, bundle]);
1818

1919
return (
2020
<Tooltip
2121
label={
2222
<Flex flexDir="column" p={1}>
23-
<Text>{t('modelManager.includesNModels', { n: bundle.length })}:</Text>
23+
<Text>{t('modelManager.includesNModels', { n: bundle.models.length })}:</Text>
2424
<UnorderedList>
25-
{bundle.map((model, index) => (
25+
{bundle.models.map((model, index) => (
2626
<ListItem key={index} wordBreak="break-all">
2727
{model.name}
2828
</ListItem>
@@ -33,10 +33,10 @@ export const StarterBundle = ({ bundleName, bundle }: { bundleName: string; bund
3333
>
3434
<Button size="sm" onClick={handleClickBundle} py={6} isDisabled={modelsToInstall.install.length === 0}>
3535
<Flex flexDir="column">
36-
<Text>{isMainModelBase(bundleName) ? MODEL_TYPE_SHORT_MAP[bundleName] : bundleName}</Text>
36+
<Text>{isMainModelBase(bundle.name) ? MODEL_TYPE_SHORT_MAP[bundle.name] : bundle.name}</Text>
3737
{modelsToInstall.install.length > 0 && (
3838
<Text fontSize="xs">
39-
({bundle.length} {t('settings.models')})
39+
({bundle.models.length} {t('settings.models')})
4040
</Text>
4141
)}
4242
{modelsToInstall.install.length === 0 && <Text fontSize="xs">{t('common.installed')}</Text>}

invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/StarterModels/StarterModelsResults.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export const StarterModelsResults = memo(({ results }: StarterModelsResultsProps
6161
</Tooltip>
6262
</Flex>
6363
<Flex gap={2}>
64-
{map(results.starter_bundles, (bundle, bundleName) => (
65-
<StarterBundle key={bundleName} bundleName={bundleName} bundle={bundle} />
64+
{map(results.starter_bundles, (bundle) => (
65+
<StarterBundle key={bundle.name} bundle={bundle} />
6666
))}
6767
</Flex>
6868
</Flex>

0 commit comments

Comments
 (0)