mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
multi-select actions include:
- drag to board to move all to that board
- right click to add all to board or delete all
backend changes:
- add routes for changing board for list of image names, deleting list of images
- change image-specific routes to `images/i/{image_name}` to not clobber other routes (like `images/upload`, `images/delete`)
- subclass pydantic `BaseModel` as `BaseModelExcludeNull`, which excludes null values when calling `dict()` on the model. this fixes inconsistent types related to JSON parsing null values into `null` instead of `undefined`
- remove `board_id` from `remove_image_from_board`
frontend changes:
- multi-selection stuff uses `ImageDTO[]` as payloads, for dnd and other mutations. this gives us access to image `board_id`s when hitting routes, and enables efficient cache updates.
- consolidate change board and delete image modals to handle single and multiples
- board totals are now re-fetched on mutation and not kept in sync manually - was way too tedious to do this
- fixed warning about nested `<p>` elements
- closes #4088 , need to handle case when `autoAddBoardId` is `"none"`
- add option to show gallery image delete button on every gallery image
frontend refactors/organisation:
- make typegen script js instead of ts
- enable `noUncheckedIndexedAccess` to help avoid bugs when indexing into arrays, many small changes needed to satisfy TS after this
- move all image-related endpoints into `endpoints/images.ts`, its a big file now, but this fixes a number of circular dependency issues that were otherwise felt impossible to resolve
147 lines
3.7 KiB
TypeScript
147 lines
3.7 KiB
TypeScript
import { memo } from 'react';
|
|
import { ControlNetConfig } from '../store/controlNetSlice';
|
|
import CannyProcessor from './processors/CannyProcessor';
|
|
import ContentShuffleProcessor from './processors/ContentShuffleProcessor';
|
|
import HedProcessor from './processors/HedProcessor';
|
|
import LineartAnimeProcessor from './processors/LineartAnimeProcessor';
|
|
import LineartProcessor from './processors/LineartProcessor';
|
|
import MediapipeFaceProcessor from './processors/MediapipeFaceProcessor';
|
|
import MidasDepthProcessor from './processors/MidasDepthProcessor';
|
|
import MlsdImageProcessor from './processors/MlsdImageProcessor';
|
|
import NormalBaeProcessor from './processors/NormalBaeProcessor';
|
|
import OpenposeProcessor from './processors/OpenposeProcessor';
|
|
import PidiProcessor from './processors/PidiProcessor';
|
|
import ZoeDepthProcessor from './processors/ZoeDepthProcessor';
|
|
|
|
export type ControlNetProcessorProps = {
|
|
controlNet: ControlNetConfig;
|
|
};
|
|
|
|
const ControlNetProcessorComponent = (props: ControlNetProcessorProps) => {
|
|
const { controlNetId, isEnabled, processorNode } = props.controlNet;
|
|
|
|
if (processorNode.type === 'canny_image_processor') {
|
|
return (
|
|
<CannyProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'hed_image_processor') {
|
|
return (
|
|
<HedProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'lineart_image_processor') {
|
|
return (
|
|
<LineartProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'content_shuffle_image_processor') {
|
|
return (
|
|
<ContentShuffleProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'lineart_anime_image_processor') {
|
|
return (
|
|
<LineartAnimeProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'mediapipe_face_processor') {
|
|
return (
|
|
<MediapipeFaceProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'midas_depth_image_processor') {
|
|
return (
|
|
<MidasDepthProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'mlsd_image_processor') {
|
|
return (
|
|
<MlsdImageProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'normalbae_image_processor') {
|
|
return (
|
|
<NormalBaeProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'openpose_image_processor') {
|
|
return (
|
|
<OpenposeProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'pidi_image_processor') {
|
|
return (
|
|
<PidiProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (processorNode.type === 'zoe_depth_image_processor') {
|
|
return (
|
|
<ZoeDepthProcessor
|
|
controlNetId={controlNetId}
|
|
processorNode={processorNode}
|
|
isEnabled={isEnabled}
|
|
/>
|
|
);
|
|
}
|
|
|
|
return null;
|
|
};
|
|
|
|
export default memo(ControlNetProcessorComponent);
|