From 382a55afd308d03989da0d71626ccef60d86d048 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Sun, 27 Aug 2023 03:07:42 +1200 Subject: [PATCH] fix: merge conflicts --- .../Invocation/fields/InputFieldRenderer.tsx | 14 ++++++ .../fields/inputs/InpaintMaskInputField.tsx | 6 +-- .../web/src/features/nodes/types/types.ts | 49 ++++++------------- 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx index 9b3ce100c8..176e8a5905 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx @@ -13,6 +13,7 @@ import ControlNetModelInputField from './inputs/ControlNetModelInputField'; import EnumInputField from './inputs/EnumInputField'; import ImageCollectionInputField from './inputs/ImageCollectionInputField'; import ImageInputField from './inputs/ImageInputField'; +import InpaintMaskInputField from './inputs/InpaintMaskInputField'; import LatentsInputField from './inputs/LatentsInputField'; import LoRAModelInputField from './inputs/LoRAModelInputField'; import MainModelInputField from './inputs/MainModelInputField'; @@ -105,6 +106,19 @@ const InputFieldRenderer = ({ nodeId, fieldName }: InputFieldProps) => { ); } + if ( + field?.type === 'InpaintMaskField' && + fieldTemplate?.type === 'InpaintMaskField' + ) { + return ( + + ); + } + if ( field?.type === 'ConditioningField' && fieldTemplate?.type === 'ConditioningField' diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/InpaintMaskInputField.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/InpaintMaskInputField.tsx index cf786db3a5..248d5922af 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/InpaintMaskInputField.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/InpaintMaskInputField.tsx @@ -1,13 +1,13 @@ import { - InpaintMaskFieldValue, + FieldComponentProps, InpaintMaskInputFieldTemplate, + InpaintMaskInputFieldValue, } from 'features/nodes/types/types'; import { memo } from 'react'; -import { FieldComponentProps } from './types'; const InpaintMaskInputFieldComponent = ( _props: FieldComponentProps< - InpaintMaskFieldValue, + InpaintMaskInputFieldValue, InpaintMaskInputFieldTemplate > ) => { diff --git a/invokeai/frontend/web/src/features/nodes/types/types.ts b/invokeai/frontend/web/src/features/nodes/types/types.ts index 961ec458c4..11672b2a64 100644 --- a/invokeai/frontend/web/src/features/nodes/types/types.ts +++ b/invokeai/frontend/web/src/features/nodes/types/types.ts @@ -109,40 +109,6 @@ export type FieldType = z.infer; export const isFieldType = (value: unknown): value is FieldType => zFieldType.safeParse(value).success; -/** - * An input field is persisted across reloads as part of the user's local state. - * - * An input field has three properties: - * - `id` a unique identifier - * - `name` the name of the field, which comes from the python dataclass - * - `value` the field's value - */ -export type InputFieldValue = - | IntegerInputFieldValue - | SeedInputFieldValue - | FloatInputFieldValue - | StringInputFieldValue - | BooleanInputFieldValue - | ImageInputFieldValue - | InpaintMaskFieldValue - | LatentsInputFieldValue - | ConditioningInputFieldValue - | UNetInputFieldValue - | ClipInputFieldValue - | VaeInputFieldValue - | ControlInputFieldValue - | EnumInputFieldValue - | MainModelInputFieldValue - | SDXLMainModelInputFieldValue - | SDXLRefinerModelInputFieldValue - | VaeModelInputFieldValue - | LoRAModelInputFieldValue - | ControlNetModelInputFieldValue - | CollectionInputFieldValue - | CollectionItemInputFieldValue - | ColorInputFieldValue - | ImageCollectionInputFieldValue; - /** * An input field template is generated on each page load from the OpenAPI schema. * @@ -241,6 +207,12 @@ export const zConditioningField = z.object({ }); export type ConditioningField = z.infer; +export const zInpaintMaskField = z.object({ + mask_name: z.string().trim().min(1), + masked_latents_name: z.string().trim().min(1).optional(), +}); +export type InpaintMaskFieldValue = z.infer; + export const zIntegerInputFieldValue = zInputFieldValueBase.extend({ type: z.literal('integer'), value: z.number().optional(), @@ -277,6 +249,14 @@ export const zLatentsInputFieldValue = zInputFieldValueBase.extend({ }); export type LatentsInputFieldValue = z.infer; +export const zInpaintMaskInputFieldValue = zInputFieldValueBase.extend({ + type: z.literal('InpaintMaskField'), + value: zInpaintMaskField.optional(), +}); +export type InpaintMaskInputFieldValue = z.infer< + typeof zInpaintMaskInputFieldValue +>; + export const zConditioningInputFieldValue = zInputFieldValueBase.extend({ type: z.literal('ConditioningField'), value: zConditioningField.optional(), @@ -495,6 +475,7 @@ export const zInputFieldValue = z.discriminatedUnion('type', [ zBooleanInputFieldValue, zImageInputFieldValue, zLatentsInputFieldValue, + zInpaintMaskInputFieldValue, zConditioningInputFieldValue, zUNetInputFieldValue, zClipInputFieldValue,