mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): expand config options (#3393)
now may disable individual SD features eg Noise, Variation, etc - stuff which is not ready for consumption in commercial.
This commit is contained in:
commit
5013a4b9f3
@ -326,11 +326,11 @@ export type AppFeature =
|
||||
/**
|
||||
* A disable-able Stable Diffusion feature
|
||||
*/
|
||||
export type StableDiffusionFeature =
|
||||
| 'noiseConfig'
|
||||
| 'variations'
|
||||
export type SDFeature =
|
||||
| 'noise'
|
||||
| 'variation'
|
||||
| 'symmetry'
|
||||
| 'tiling'
|
||||
| 'seamless'
|
||||
| 'hires';
|
||||
|
||||
/**
|
||||
@ -348,6 +348,7 @@ export type AppConfig = {
|
||||
shouldFetchImages: boolean;
|
||||
disabledTabs: InvokeTabName[];
|
||||
disabledFeatures: AppFeature[];
|
||||
disabledSDFeatures: SDFeature[];
|
||||
canRestoreDeletedImagesFromBin: boolean;
|
||||
sd: {
|
||||
iterations: {
|
||||
|
@ -152,6 +152,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
||||
} = useAppSelector(currentImageButtonsSelector);
|
||||
|
||||
const isLightboxEnabled = useFeatureStatus('lightbox').isFeatureEnabled;
|
||||
const isCanvasEnabled = useFeatureStatus('unifiedCanvas').isFeatureEnabled;
|
||||
const isUpscalingEnabled = useFeatureStatus('upscaling').isFeatureEnabled;
|
||||
const isFaceRestoreEnabled = useFeatureStatus('faceRestore').isFeatureEnabled;
|
||||
|
||||
@ -429,13 +430,15 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
||||
>
|
||||
{t('parameters.sendToImg2Img')}
|
||||
</IAIButton>
|
||||
<IAIButton
|
||||
size="sm"
|
||||
onClick={handleSendToCanvas}
|
||||
leftIcon={<FaShare />}
|
||||
>
|
||||
{t('parameters.sendToUnifiedCanvas')}
|
||||
</IAIButton>
|
||||
{isCanvasEnabled && (
|
||||
<IAIButton
|
||||
size="sm"
|
||||
onClick={handleSendToCanvas}
|
||||
leftIcon={<FaShare />}
|
||||
>
|
||||
{t('parameters.sendToUnifiedCanvas')}
|
||||
</IAIButton>
|
||||
)}
|
||||
|
||||
{/* <IAIButton
|
||||
size="sm"
|
||||
|
@ -104,7 +104,10 @@ const HoverableImage = memo((props: HoverableImageProps) => {
|
||||
const toast = useToast();
|
||||
|
||||
const { t } = useTranslation();
|
||||
const { isFeatureEnabled: isLightboxEnabled } = useFeatureStatus('lightbox');
|
||||
|
||||
const isLightboxEnabled = useFeatureStatus('lightbox').isFeatureEnabled;
|
||||
const isCanvasEnabled = useFeatureStatus('unifiedCanvas').isFeatureEnabled;
|
||||
|
||||
const { recallSeed, recallPrompt, recallInitialImage, recallAllParameters } =
|
||||
useParameters();
|
||||
|
||||
@ -250,9 +253,11 @@ const HoverableImage = memo((props: HoverableImageProps) => {
|
||||
>
|
||||
{t('parameters.sendToImg2Img')}
|
||||
</MenuItem>
|
||||
<MenuItem icon={<FaShare />} onClickCapture={handleSendToCanvas}>
|
||||
{t('parameters.sendToUnifiedCanvas')}
|
||||
</MenuItem>
|
||||
{isCanvasEnabled && (
|
||||
<MenuItem icon={<FaShare />} onClickCapture={handleSendToCanvas}>
|
||||
{t('parameters.sendToUnifiedCanvas')}
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem icon={<FaTrash />} onClickCapture={onDeleteDialogOpen}>
|
||||
{t('gallery.deleteImage')}
|
||||
</MenuItem>
|
||||
|
@ -6,6 +6,7 @@ import IAICollapse from 'common/components/IAICollapse';
|
||||
import { memo } from 'react';
|
||||
import { ParamHiresStrength } from './ParamHiresStrength';
|
||||
import { setHiresFix } from 'features/parameters/store/postprocessingSlice';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
|
||||
const ParamHiresCollapse = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -13,10 +14,16 @@ const ParamHiresCollapse = () => {
|
||||
(state: RootState) => state.postprocessing.hiresFix
|
||||
);
|
||||
|
||||
const isHiresEnabled = useFeatureStatus('hires').isFeatureEnabled;
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleToggle = () => dispatch(setHiresFix(!hiresFix));
|
||||
|
||||
if (!isHiresEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<IAICollapse
|
||||
label={t('parameters.hiresOptim')}
|
||||
|
@ -7,9 +7,13 @@ import { RootState } from 'app/store/store';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { setShouldUseNoiseSettings } from 'features/parameters/store/generationSlice';
|
||||
import { memo } from 'react';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
|
||||
const ParamNoiseCollapse = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const isNoiseEnabled = useFeatureStatus('noise').isFeatureEnabled;
|
||||
|
||||
const shouldUseNoiseSettings = useAppSelector(
|
||||
(state: RootState) => state.generation.shouldUseNoiseSettings
|
||||
);
|
||||
@ -19,6 +23,10 @@ const ParamNoiseCollapse = () => {
|
||||
const handleToggle = () =>
|
||||
dispatch(setShouldUseNoiseSettings(!shouldUseNoiseSettings));
|
||||
|
||||
if (!isNoiseEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<IAICollapse
|
||||
label={t('parameters.noiseSettings')}
|
||||
|
@ -9,6 +9,7 @@ import { generationSelector } from 'features/parameters/store/generationSelector
|
||||
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
|
||||
import ParamSeamlessXAxis from './ParamSeamlessXAxis';
|
||||
import ParamSeamlessYAxis from './ParamSeamlessYAxis';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
|
||||
const selector = createSelector(
|
||||
generationSelector,
|
||||
@ -24,10 +25,16 @@ const ParamSeamlessCollapse = () => {
|
||||
const { t } = useTranslation();
|
||||
const { shouldUseSeamless } = useAppSelector(selector);
|
||||
|
||||
const isSeamlessEnabled = useFeatureStatus('seamless').isFeatureEnabled;
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleToggle = () => dispatch(setSeamless(!shouldUseSeamless));
|
||||
|
||||
if (!isSeamlessEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<IAICollapse
|
||||
label={t('parameters.seamlessTiling')}
|
||||
|
@ -8,6 +8,7 @@ import IAICollapse from 'common/components/IAICollapse';
|
||||
import { RootState } from 'app/store/store';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { setShouldUseSymmetry } from 'features/parameters/store/generationSlice';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
|
||||
const ParamSymmetryCollapse = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -15,10 +16,16 @@ const ParamSymmetryCollapse = () => {
|
||||
(state: RootState) => state.generation.shouldUseSymmetry
|
||||
);
|
||||
|
||||
const isSymmetryEnabled = useFeatureStatus('symmetry').isFeatureEnabled;
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleToggle = () => dispatch(setShouldUseSymmetry(!shouldUseSymmetry));
|
||||
|
||||
if (!isSymmetryEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<IAICollapse
|
||||
label={t('parameters.symmetry')}
|
||||
|
@ -7,6 +7,7 @@ import { setShouldGenerateVariations } from 'features/parameters/store/generatio
|
||||
import { Flex } from '@chakra-ui/react';
|
||||
import IAICollapse from 'common/components/IAICollapse';
|
||||
import { memo } from 'react';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
|
||||
const ParamVariationCollapse = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -14,11 +15,17 @@ const ParamVariationCollapse = () => {
|
||||
(state: RootState) => state.generation.shouldGenerateVariations
|
||||
);
|
||||
|
||||
const isVariationEnabled = useFeatureStatus('variation').isFeatureEnabled;
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleToggle = () =>
|
||||
dispatch(setShouldGenerateVariations(!shouldGenerateVariations));
|
||||
|
||||
if (!isVariationEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<IAICollapse
|
||||
label={t('parameters.variations')}
|
||||
|
@ -1,21 +1,40 @@
|
||||
import { AppFeature } from 'app/types/invokeai';
|
||||
import { AppFeature, SDFeature } from 'app/types/invokeai';
|
||||
import { RootState } from 'app/store/store';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { useMemo } from 'react';
|
||||
import { InvokeTabName } from 'features/ui/store/tabMap';
|
||||
|
||||
export const useFeatureStatus = (
|
||||
feature: AppFeature | SDFeature | InvokeTabName
|
||||
) => {
|
||||
const disabledTabs = useAppSelector(
|
||||
(state: RootState) => state.config.disabledTabs
|
||||
);
|
||||
|
||||
export const useFeatureStatus = (feature: AppFeature) => {
|
||||
const disabledFeatures = useAppSelector(
|
||||
(state: RootState) => state.config.disabledFeatures
|
||||
);
|
||||
|
||||
const disabledSDFeatures = useAppSelector(
|
||||
(state: RootState) => state.config.disabledSDFeatures
|
||||
);
|
||||
|
||||
const isFeatureDisabled = useMemo(
|
||||
() => disabledFeatures.includes(feature),
|
||||
[disabledFeatures, feature]
|
||||
() =>
|
||||
disabledFeatures.includes(feature as AppFeature) ||
|
||||
disabledSDFeatures.includes(feature as SDFeature) ||
|
||||
disabledTabs.includes(feature as InvokeTabName),
|
||||
[disabledFeatures, disabledSDFeatures, disabledTabs, feature]
|
||||
);
|
||||
|
||||
const isFeatureEnabled = useMemo(
|
||||
() => !disabledFeatures.includes(feature),
|
||||
[disabledFeatures, feature]
|
||||
() =>
|
||||
!(
|
||||
disabledFeatures.includes(feature as AppFeature) ||
|
||||
disabledSDFeatures.includes(feature as SDFeature) ||
|
||||
disabledTabs.includes(feature as InvokeTabName)
|
||||
),
|
||||
[disabledFeatures, disabledSDFeatures, disabledTabs, feature]
|
||||
);
|
||||
|
||||
return { isFeatureDisabled, isFeatureEnabled };
|
||||
|
@ -8,6 +8,7 @@ export const initialConfigState: AppConfig = {
|
||||
shouldFetchImages: false,
|
||||
disabledTabs: [],
|
||||
disabledFeatures: [],
|
||||
disabledSDFeatures: [],
|
||||
canRestoreDeletedImagesFromBin: true,
|
||||
sd: {
|
||||
iterations: {
|
||||
|
Loading…
Reference in New Issue
Block a user