mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore(ui): lint
This commit is contained in:
parent
311ba8c04b
commit
6e966909ab
@ -1,5 +1,5 @@
|
|||||||
import type { PayloadAction, Update } from '@reduxjs/toolkit';
|
import type { PayloadAction, Update } from '@reduxjs/toolkit';
|
||||||
import { createEntityAdapter, createSlice, isAnyOf } from '@reduxjs/toolkit';
|
import { createEntityAdapter, createSlice } from '@reduxjs/toolkit';
|
||||||
import { getSelectorsOptions } from 'app/store/createMemoizedSelector';
|
import { getSelectorsOptions } from 'app/store/createMemoizedSelector';
|
||||||
import type { PersistConfig, RootState } from 'app/store/store';
|
import type { PersistConfig, RootState } from 'app/store/store';
|
||||||
import { deepClone } from 'common/util/deepClone';
|
import { deepClone } from 'common/util/deepClone';
|
||||||
@ -481,8 +481,6 @@ export const {
|
|||||||
t2iAdaptersReset,
|
t2iAdaptersReset,
|
||||||
} = controlAdaptersSlice.actions;
|
} = controlAdaptersSlice.actions;
|
||||||
|
|
||||||
export const isAnyControlAdapterAdded = isAnyOf(controlAdapterAdded, controlAdapterRecalled);
|
|
||||||
|
|
||||||
export const selectControlAdaptersSlice = (state: RootState) => state.controlAdapters;
|
export const selectControlAdaptersSlice = (state: RootState) => state.controlAdapters;
|
||||||
|
|
||||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||||
|
@ -88,7 +88,7 @@ export const selectIPALayerOrThrow = (state: ControlLayersState, layerId: string
|
|||||||
assert(isIPAdapterLayer(layer));
|
assert(isIPAdapterLayer(layer));
|
||||||
return layer;
|
return layer;
|
||||||
};
|
};
|
||||||
export const selectCAOrIPALayerOrThrow = (
|
const selectCAOrIPALayerOrThrow = (
|
||||||
state: ControlLayersState,
|
state: ControlLayersState,
|
||||||
layerId: string
|
layerId: string
|
||||||
): ControlAdapterLayer | IPAdapterLayer => {
|
): ControlAdapterLayer | IPAdapterLayer => {
|
||||||
@ -96,7 +96,7 @@ export const selectCAOrIPALayerOrThrow = (
|
|||||||
assert(isControlAdapterLayer(layer) || isIPAdapterLayer(layer));
|
assert(isControlAdapterLayer(layer) || isIPAdapterLayer(layer));
|
||||||
return layer;
|
return layer;
|
||||||
};
|
};
|
||||||
export const selectRGLayerOrThrow = (state: ControlLayersState, layerId: string): RegionalGuidanceLayer => {
|
const selectRGLayerOrThrow = (state: ControlLayersState, layerId: string): RegionalGuidanceLayer => {
|
||||||
const layer = state.layers.find((l) => l.id === layerId);
|
const layer = state.layers.find((l) => l.id === layerId);
|
||||||
assert(isRegionalGuidanceLayer(layer));
|
assert(isRegionalGuidanceLayer(layer));
|
||||||
return layer;
|
return layer;
|
||||||
@ -348,19 +348,6 @@ export const controlLayersSlice = createSlice({
|
|||||||
const layer = selectIPALayerOrThrow(state, layerId);
|
const layer = selectIPALayerOrThrow(state, layerId);
|
||||||
layer.ipAdapter.image = imageDTO ? imageDTOToImageWithDims(imageDTO) : null;
|
layer.ipAdapter.image = imageDTO ? imageDTOToImageWithDims(imageDTO) : null;
|
||||||
},
|
},
|
||||||
ipaLayerWeightChanged: (state, action: PayloadAction<{ layerId: string; weight: number }>) => {
|
|
||||||
const { layerId, weight } = action.payload;
|
|
||||||
const layer = selectIPALayerOrThrow(state, layerId);
|
|
||||||
layer.ipAdapter.weight = weight;
|
|
||||||
},
|
|
||||||
ipaLayerBeginEndStepPctChanged: (
|
|
||||||
state,
|
|
||||||
action: PayloadAction<{ layerId: string; beginEndStepPct: [number, number] }>
|
|
||||||
) => {
|
|
||||||
const { layerId, beginEndStepPct } = action.payload;
|
|
||||||
const layer = selectIPALayerOrThrow(state, layerId);
|
|
||||||
layer.ipAdapter.beginEndStepPct = beginEndStepPct;
|
|
||||||
},
|
|
||||||
ipaLayerMethodChanged: (state, action: PayloadAction<{ layerId: string; method: IPMethod }>) => {
|
ipaLayerMethodChanged: (state, action: PayloadAction<{ layerId: string; method: IPMethod }>) => {
|
||||||
const { layerId, method } = action.payload;
|
const { layerId, method } = action.payload;
|
||||||
const layer = selectIPALayerOrThrow(state, layerId);
|
const layer = selectIPALayerOrThrow(state, layerId);
|
||||||
@ -744,8 +731,6 @@ export const {
|
|||||||
// IPA Layers
|
// IPA Layers
|
||||||
ipaLayerAdded,
|
ipaLayerAdded,
|
||||||
ipaLayerImageChanged,
|
ipaLayerImageChanged,
|
||||||
ipaLayerWeightChanged,
|
|
||||||
ipaLayerBeginEndStepPctChanged,
|
|
||||||
ipaLayerMethodChanged,
|
ipaLayerMethodChanged,
|
||||||
ipaLayerModelChanged,
|
ipaLayerModelChanged,
|
||||||
ipaLayerCLIPVisionModelChanged,
|
ipaLayerCLIPVisionModelChanged,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { ControlNetConfig, IPAdapterConfig,T2IAdapterConfig } from 'features/controlLayers/util/controlAdapters';
|
import type { ControlNetConfig, IPAdapterConfig, T2IAdapterConfig } from 'features/controlLayers/util/controlAdapters';
|
||||||
import type { AspectRatioState } from 'features/parameters/components/ImageSize/types';
|
import type { AspectRatioState } from 'features/parameters/components/ImageSize/types';
|
||||||
import type {
|
import type {
|
||||||
ParameterAutoNegative,
|
ParameterAutoNegative,
|
||||||
|
@ -46,7 +46,7 @@ export type DepthAnythingProcessorConfig = Required<
|
|||||||
Pick<DepthAnythingImageProcessorInvocation, 'id' | 'type' | 'model_size'>
|
Pick<DepthAnythingImageProcessorInvocation, 'id' | 'type' | 'model_size'>
|
||||||
>;
|
>;
|
||||||
export type HedProcessorConfig = Required<Pick<HedImageProcessorInvocation, 'id' | 'type' | 'scribble'>>;
|
export type HedProcessorConfig = Required<Pick<HedImageProcessorInvocation, 'id' | 'type' | 'scribble'>>;
|
||||||
export type LineartAnimeProcessorConfig = Required<Pick<LineartAnimeImageProcessorInvocation, 'id' | 'type'>>;
|
type LineartAnimeProcessorConfig = Required<Pick<LineartAnimeImageProcessorInvocation, 'id' | 'type'>>;
|
||||||
export type LineartProcessorConfig = Required<Pick<LineartImageProcessorInvocation, 'id' | 'type' | 'coarse'>>;
|
export type LineartProcessorConfig = Required<Pick<LineartImageProcessorInvocation, 'id' | 'type' | 'coarse'>>;
|
||||||
export type MediapipeFaceProcessorConfig = Required<
|
export type MediapipeFaceProcessorConfig = Required<
|
||||||
Pick<MediapipeFaceProcessorInvocation, 'id' | 'type' | 'max_faces' | 'min_confidence'>
|
Pick<MediapipeFaceProcessorInvocation, 'id' | 'type' | 'max_faces' | 'min_confidence'>
|
||||||
@ -55,12 +55,12 @@ export type MidasDepthProcessorConfig = Required<
|
|||||||
Pick<MidasDepthImageProcessorInvocation, 'id' | 'type' | 'a_mult' | 'bg_th'>
|
Pick<MidasDepthImageProcessorInvocation, 'id' | 'type' | 'a_mult' | 'bg_th'>
|
||||||
>;
|
>;
|
||||||
export type MlsdProcessorConfig = Required<Pick<MlsdImageProcessorInvocation, 'id' | 'type' | 'thr_v' | 'thr_d'>>;
|
export type MlsdProcessorConfig = Required<Pick<MlsdImageProcessorInvocation, 'id' | 'type' | 'thr_v' | 'thr_d'>>;
|
||||||
export type NormalbaeProcessorConfig = Required<Pick<NormalbaeImageProcessorInvocation, 'id' | 'type'>>;
|
type NormalbaeProcessorConfig = Required<Pick<NormalbaeImageProcessorInvocation, 'id' | 'type'>>;
|
||||||
export type DWOpenposeProcessorConfig = Required<
|
export type DWOpenposeProcessorConfig = Required<
|
||||||
Pick<DWOpenposeImageProcessorInvocation, 'id' | 'type' | 'draw_body' | 'draw_face' | 'draw_hands'>
|
Pick<DWOpenposeImageProcessorInvocation, 'id' | 'type' | 'draw_body' | 'draw_face' | 'draw_hands'>
|
||||||
>;
|
>;
|
||||||
export type PidiProcessorConfig = Required<Pick<PidiImageProcessorInvocation, 'id' | 'type' | 'safe' | 'scribble'>>;
|
export type PidiProcessorConfig = Required<Pick<PidiImageProcessorInvocation, 'id' | 'type' | 'safe' | 'scribble'>>;
|
||||||
export type ZoeDepthProcessorConfig = Required<Pick<ZoeDepthImageProcessorInvocation, 'id' | 'type'>>;
|
type ZoeDepthProcessorConfig = Required<Pick<ZoeDepthImageProcessorInvocation, 'id' | 'type'>>;
|
||||||
|
|
||||||
export type ProcessorConfig =
|
export type ProcessorConfig =
|
||||||
| CannyProcessorConfig
|
| CannyProcessorConfig
|
||||||
@ -132,7 +132,7 @@ export type IPAdapterConfig = {
|
|||||||
beginEndStepPct: [number, number];
|
beginEndStepPct: [number, number];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const zProcessorType = z.enum([
|
const zProcessorType = z.enum([
|
||||||
'canny_image_processor',
|
'canny_image_processor',
|
||||||
'color_map_image_processor',
|
'color_map_image_processor',
|
||||||
'content_shuffle_image_processor',
|
'content_shuffle_image_processor',
|
||||||
@ -405,7 +405,7 @@ export const CONTROLNET_PROCESSORS: CAProcessorsData = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialControlNet: Omit<ControlNetConfig, 'id'> = {
|
const initialControlNet: Omit<ControlNetConfig, 'id'> = {
|
||||||
type: 'controlnet',
|
type: 'controlnet',
|
||||||
model: null,
|
model: null,
|
||||||
weight: 1,
|
weight: 1,
|
||||||
@ -417,7 +417,7 @@ export const initialControlNet: Omit<ControlNetConfig, 'id'> = {
|
|||||||
processorConfig: CONTROLNET_PROCESSORS.canny_image_processor.buildDefaults(),
|
processorConfig: CONTROLNET_PROCESSORS.canny_image_processor.buildDefaults(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialT2IAdapter: Omit<T2IAdapterConfig, 'id'> = {
|
const initialT2IAdapter: Omit<T2IAdapterConfig, 'id'> = {
|
||||||
type: 't2i_adapter',
|
type: 't2i_adapter',
|
||||||
model: null,
|
model: null,
|
||||||
weight: 1,
|
weight: 1,
|
||||||
@ -428,7 +428,7 @@ export const initialT2IAdapter: Omit<T2IAdapterConfig, 'id'> = {
|
|||||||
processorConfig: CONTROLNET_PROCESSORS.canny_image_processor.buildDefaults(),
|
processorConfig: CONTROLNET_PROCESSORS.canny_image_processor.buildDefaults(),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialIPAdapter: Omit<IPAdapterConfig, 'id'> = {
|
const initialIPAdapter: Omit<IPAdapterConfig, 'id'> = {
|
||||||
type: 'ip_adapter',
|
type: 'ip_adapter',
|
||||||
image: null,
|
image: null,
|
||||||
model: null,
|
model: null,
|
||||||
|
Loading…
Reference in New Issue
Block a user