Skip to content

Commit 8f93474

Browse files
feat(ui): updated upscale tab warnings
1 parent 4352341 commit 8f93474

File tree

3 files changed

+38
-30
lines changed

3 files changed

+38
-30
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,14 +1644,15 @@
16441644
"upscaling": {
16451645
"creativity": "Creativity",
16461646
"structure": "Structure",
1647-
"toInstall": "to install",
16481647
"upscaleModel": "Upscale Model",
16491648
"scale": "Scale",
1650-
"visit": "Visit",
1651-
"warningNoMainModel": "a model",
1652-
"warningNoTile": "a {{base_model}} tile controlnet required by this feature",
1653-
"warningNoTileOrUpscaleModel": "an upscaler model and {{base_model}} tile controlnet required by this feature",
1654-
"warningNoUpscaleModel": "an upscaler model required by this feature"
1649+
"missingModelsWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install the required models:",
1650+
"mainModelDesc": "Main model (SD1.5 or SDXL architecture)",
1651+
"tileControlNetModelDesc": "Tile ControlNet model for the chosen main model architecture",
1652+
"upscaleModelDesc": "Upscale (image to image) model",
1653+
"missingUpscaleInitialImage": "Missing initial image for upscaling",
1654+
"missingUpscaleModel": "Missing upscale model",
1655+
"missingTileControlNetModel": "No valid tile ControlNet models installed"
16551656
},
16561657
"ui": {
16571658
"tabs": {

invokeai/frontend/web/src/common/hooks/useIsReadyToEnqueue.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,13 @@ const createSelector = (templates: Templates) =>
208208
});
209209
} else if (activeTabName === 'upscaling') {
210210
if (!upscale.upscaleInitialImage) {
211-
reasons.push({ content: 'No Initial image' });
211+
reasons.push({ content: i18n.t('upscaling.missingUpscaleInitialImage') });
212212
}
213213
if (!upscale.upscaleModel) {
214-
reasons.push({ content: 'No upscale model selected' });
214+
reasons.push({ content: i18n.t('upscaling.missingUpscaleModel') });
215215
}
216-
217216
if (!upscale.tileControlnetModel) {
218-
reasons.push({ content: 'No valid tile controlnet available' });
217+
reasons.push({ content: i18n.t('upscaling.missingTileControlNetModel') });
219218
}
220219
} else {
221220
// Handling for all other tabs
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Flex, Link, Text } from '@invoke-ai/ui-library';
1+
import { Button, Flex, ListItem, Text, UnorderedList } from '@invoke-ai/ui-library';
22
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
3+
import { $installModelsTab } from 'features/modelManagerV2/subpanels/InstallModels';
34
import { tileControlnetModelChanged } from 'features/parameters/store/upscaleSlice';
4-
import { MODEL_TYPE_SHORT_MAP } from 'features/parameters/types/constants';
55
import { setActiveTab } from 'features/ui/store/uiSlice';
66
import { useCallback, useEffect, useMemo } from 'react';
7-
import { useTranslation } from 'react-i18next';
7+
import { Trans, useTranslation } from 'react-i18next';
88
import { useControlNetModels } from 'services/api/hooks/modelsByType';
99

1010
export const MultidiffusionWarning = () => {
@@ -23,38 +23,46 @@ export const MultidiffusionWarning = () => {
2323
dispatch(tileControlnetModelChanged(validModel || null));
2424
}, [model?.base, modelConfigs, dispatch]);
2525

26-
const warningText = useMemo(() => {
26+
const warnings = useMemo(() => {
27+
const _warnings: string[] = [];
2728
if (!model) {
28-
return t('upscaling.warningNoMainModel');
29+
_warnings.push(t('upscaling.mainModelDesc'));
2930
}
30-
if (!upscaleModel && !tileControlnetModel) {
31-
return t('upscaling.warningNoTileOrUpscaleModel', { base_model: MODEL_TYPE_SHORT_MAP[model.base] });
31+
if (!tileControlnetModel) {
32+
_warnings.push(t('upscaling.tileControlNetModelDesc'));
3233
}
3334
if (!upscaleModel) {
34-
return t('upscaling.warningNoUpscaleModel');
35-
}
36-
if (!tileControlnetModel) {
37-
return t('upscaling.warningNoTile', { base_model: MODEL_TYPE_SHORT_MAP[model.base] });
35+
_warnings.push(t('upscaling.upscaleModelDesc'));
3836
}
37+
return _warnings;
3938
}, [model, upscaleModel, tileControlnetModel, t]);
4039

4140
const handleGoToModelManager = useCallback(() => {
4241
dispatch(setActiveTab('models'));
42+
$installModelsTab.set(3);
4343
}, [dispatch]);
4444

45-
if (!warningText || isLoading || !shouldShowButton) {
46-
return <></>;
45+
if (!warnings.length || isLoading || !shouldShowButton) {
46+
return null;
4747
}
4848

4949
return (
50-
<Flex bg="error.500" borderRadius="base" padding="2" direction="column">
51-
<Text fontSize="xs" textAlign="center" display="inline-block">
52-
{t('upscaling.visit')}{' '}
53-
<Link fontWeight="bold" onClick={handleGoToModelManager}>
54-
{t('modelManager.modelManager')}
55-
</Link>{' '}
56-
{t('upscaling.toInstall')} {warningText}.
50+
<Flex bg="error.500" borderRadius="base" padding={4} direction="column" fontSize="sm" gap={2}>
51+
<Text>
52+
<Trans
53+
i18nKey="upscaling.missingModelsWarning"
54+
components={{
55+
LinkComponent: (
56+
<Button size="sm" flexGrow={0} variant="link" color="base.50" onClick={handleGoToModelManager} />
57+
),
58+
}}
59+
/>
5760
</Text>
61+
<UnorderedList>
62+
{warnings.map((warning) => (
63+
<ListItem key={warning}>{warning}</ListItem>
64+
))}
65+
</UnorderedList>
5866
</Flex>
5967
);
6068
};

0 commit comments

Comments
 (0)