mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): revised simple upscale warning UI
This commit is contained in:
parent
aeb53563ff
commit
7f7ce291b5
@ -1646,6 +1646,7 @@
|
|||||||
"structure": "Structure",
|
"structure": "Structure",
|
||||||
"upscaleModel": "Upscale Model",
|
"upscaleModel": "Upscale Model",
|
||||||
"scale": "Scale",
|
"scale": "Scale",
|
||||||
|
"simpleUpscaleMissingModelWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install an upscale (image to image) model.",
|
||||||
"missingModelsWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install the required models:",
|
"missingModelsWarning": "Visit the <LinkComponent>Model Manager</LinkComponent> to install the required models:",
|
||||||
"mainModelDesc": "Main model (SD1.5 or SDXL architecture)",
|
"mainModelDesc": "Main model (SD1.5 or SDXL architecture)",
|
||||||
"tileControlNetModelDesc": "Tile ControlNet model for the chosen main model architecture",
|
"tileControlNetModelDesc": "Tile ControlNet model for the chosen main model architecture",
|
||||||
|
@ -54,6 +54,7 @@ const ParamSpandrelModel = ({ isMultidiffusion }: Props) => {
|
|||||||
options={options}
|
options={options}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
noOptionsMessage={noOptionsMessage}
|
noOptionsMessage={noOptionsMessage}
|
||||||
|
isDisabled={options.length === 0}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
@ -6,14 +6,16 @@ import {
|
|||||||
PopoverBody,
|
PopoverBody,
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
|
Text,
|
||||||
useDisclosure,
|
useDisclosure,
|
||||||
} from '@invoke-ai/ui-library';
|
} from '@invoke-ai/ui-library';
|
||||||
import { upscaleRequested } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested';
|
import { upscaleRequested } from 'app/store/middleware/listenerMiddleware/listeners/upscaleRequested';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
|
import { $installModelsTab } from 'features/modelManagerV2/subpanels/InstallModels';
|
||||||
import { useIsQueueMutationInProgress } from 'features/queue/hooks/useIsQueueMutationInProgress';
|
import { useIsQueueMutationInProgress } from 'features/queue/hooks/useIsQueueMutationInProgress';
|
||||||
import { UpscaleWarning } from 'features/settingsAccordions/components/UpscaleSettingsAccordion/UpscaleWarning';
|
import { setActiveTab } from 'features/ui/store/uiSlice';
|
||||||
import { memo, useCallback } from 'react';
|
import { memo, useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
import { PiFrameCornersBold } from 'react-icons/pi';
|
import { PiFrameCornersBold } from 'react-icons/pi';
|
||||||
import type { ImageDTO } from 'services/api/types';
|
import type { ImageDTO } from 'services/api/types';
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ const ParamUpscalePopover = (props: Props) => {
|
|||||||
<PopoverBody w={96}>
|
<PopoverBody w={96}>
|
||||||
<Flex flexDirection="column" gap={4}>
|
<Flex flexDirection="column" gap={4}>
|
||||||
<ParamSpandrelModel isMultidiffusion={false} />
|
<ParamSpandrelModel isMultidiffusion={false} />
|
||||||
<UpscaleWarning usesTile={false} />
|
{!simpleUpscaleModel && <MissingModelWarning />}
|
||||||
<Button size="sm" isDisabled={!imageDTO || inProgress || !simpleUpscaleModel} onClick={handleClickUpscale}>
|
<Button size="sm" isDisabled={!imageDTO || inProgress || !simpleUpscaleModel} onClick={handleClickUpscale}>
|
||||||
{t('parameters.upscaleImage')}
|
{t('parameters.upscaleImage')}
|
||||||
</Button>
|
</Button>
|
||||||
@ -63,3 +65,27 @@ const ParamUpscalePopover = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(ParamUpscalePopover);
|
export default memo(ParamUpscalePopover);
|
||||||
|
|
||||||
|
const MissingModelWarning = () => {
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
|
const handleGoToModelManager = useCallback(() => {
|
||||||
|
dispatch(setActiveTab('models'));
|
||||||
|
$installModelsTab.set(3);
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Flex bg="error.500" borderRadius="base" padding={4} direction="column" fontSize="sm" gap={2}>
|
||||||
|
<Text>
|
||||||
|
<Trans
|
||||||
|
i18nKey="upscaling.simpleUpscaleMissingModelWarning"
|
||||||
|
components={{
|
||||||
|
LinkComponent: (
|
||||||
|
<Button size="sm" flexGrow={0} variant="link" color="base.50" onClick={handleGoToModelManager} />
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
@ -58,7 +58,7 @@ export const UpscaleSettingsAccordion = memo(() => {
|
|||||||
<UpscaleScaleSlider />
|
<UpscaleScaleSlider />
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
<UpscaleWarning usesTile={true} />
|
<UpscaleWarning />
|
||||||
</Flex>
|
</Flex>
|
||||||
<Expander label={t('accordions.advanced.options')} isOpen={isOpenExpander} onToggle={onToggleExpander}>
|
<Expander label={t('accordions.advanced.options')} isOpen={isOpenExpander} onToggle={onToggleExpander}>
|
||||||
<Flex gap={4} pb={4} flexDir="column">
|
<Flex gap={4} pb={4} flexDir="column">
|
||||||
|
@ -7,14 +7,11 @@ import { useCallback, useEffect, useMemo } from 'react';
|
|||||||
import { Trans, useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
import { useControlNetModels } from 'services/api/hooks/modelsByType';
|
import { useControlNetModels } from 'services/api/hooks/modelsByType';
|
||||||
|
|
||||||
interface Props {
|
export const UpscaleWarning = () => {
|
||||||
usesTile: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const UpscaleWarning = ({ usesTile }: Props) => {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const model = useAppSelector((s) => s.generation.model);
|
const model = useAppSelector((s) => s.generation.model);
|
||||||
const { tileControlnetModel, upscaleModel, simpleUpscaleModel } = useAppSelector((s) => s.upscale);
|
const upscaleModel = useAppSelector((s) => s.upscale.upscaleModel);
|
||||||
|
const tileControlnetModel = useAppSelector((s) => s.upscale.tileControlnetModel);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const [modelConfigs, { isLoading }] = useControlNetModels();
|
const [modelConfigs, { isLoading }] = useControlNetModels();
|
||||||
const disabledTabs = useAppSelector((s) => s.config.disabledTabs);
|
const disabledTabs = useAppSelector((s) => s.config.disabledTabs);
|
||||||
@ -29,23 +26,18 @@ export const UpscaleWarning = ({ usesTile }: Props) => {
|
|||||||
|
|
||||||
const warnings = useMemo(() => {
|
const warnings = useMemo(() => {
|
||||||
const _warnings: string[] = [];
|
const _warnings: string[] = [];
|
||||||
if (!usesTile) {
|
|
||||||
if (!simpleUpscaleModel) {
|
|
||||||
_warnings.push(t('upscaling.upscaleModelDesc'));
|
|
||||||
}
|
|
||||||
return _warnings;
|
|
||||||
}
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
_warnings.push(t('upscaling.mainModelDesc'));
|
_warnings.push(t('upscaling.mainModelDesc'));
|
||||||
}
|
}
|
||||||
if (!tileControlnetModel && usesTile) {
|
if (!tileControlnetModel) {
|
||||||
_warnings.push(t('upscaling.tileControlNetModelDesc'));
|
_warnings.push(t('upscaling.tileControlNetModelDesc'));
|
||||||
}
|
}
|
||||||
if (!upscaleModel) {
|
if (!upscaleModel) {
|
||||||
_warnings.push(t('upscaling.upscaleModelDesc'));
|
_warnings.push(t('upscaling.upscaleModelDesc'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return _warnings;
|
return _warnings;
|
||||||
}, [model, upscaleModel, tileControlnetModel, usesTile, simpleUpscaleModel, t]);
|
}, [model, tileControlnetModel, upscaleModel, t]);
|
||||||
|
|
||||||
const handleGoToModelManager = useCallback(() => {
|
const handleGoToModelManager = useCallback(() => {
|
||||||
dispatch(setActiveTab('models'));
|
dispatch(setActiveTab('models'));
|
||||||
|
Loading…
Reference in New Issue
Block a user