mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Resolving conflicts in rebase to origin/main
This commit is contained in:
parent
5e4c0217c7
commit
0864fca641
@ -260,7 +260,7 @@ class TextToLatentsInvocation(BaseInvocation):
|
|||||||
print("type of control input: ", type(self.control))
|
print("type of control input: ", type(self.control))
|
||||||
|
|
||||||
if (self.control is None):
|
if (self.control is None):
|
||||||
control_model_name = None
|
control_model = None
|
||||||
control_image_field = None
|
control_image_field = None
|
||||||
control_weight = None
|
control_weight = None
|
||||||
else:
|
else:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { forEach, size } from 'lodash-es';
|
import { forEach, size } from 'lodash-es';
|
||||||
import { ImageField, LatentsField, ConditioningField } from 'services/api';
|
import { ImageField, LatentsField, ConditioningField, ControlField} from 'services/api';
|
||||||
|
|
||||||
const OBJECT_TYPESTRING = '[object Object]';
|
const OBJECT_TYPESTRING = '[object Object]';
|
||||||
const STRING_TYPESTRING = '[object String]';
|
const STRING_TYPESTRING = '[object String]';
|
||||||
@ -98,6 +98,29 @@ const parseConditioningField = (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const parseControlField = (controlField: unknown): ControlField | undefined => {
|
||||||
|
// Must be an object
|
||||||
|
if (!isObject(controlField)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A ControlField must have a `control`
|
||||||
|
if (!('control' in controlField)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(typeof controlField.control);
|
||||||
|
// A ControlField's `controlnets` must be a array
|
||||||
|
// TODO: check type - array of tuples
|
||||||
|
//if (Array.isArray(controlField.control)) {
|
||||||
|
//return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Build a valid ControlField
|
||||||
|
return {
|
||||||
|
control: controlField.control,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
type NodeMetadata = {
|
type NodeMetadata = {
|
||||||
[key: string]:
|
[key: string]:
|
||||||
| string
|
| string
|
||||||
@ -105,7 +128,8 @@ type NodeMetadata = {
|
|||||||
| boolean
|
| boolean
|
||||||
| ImageField
|
| ImageField
|
||||||
| LatentsField
|
| LatentsField
|
||||||
| ConditioningField;
|
| ConditioningField
|
||||||
|
| ControlField;
|
||||||
};
|
};
|
||||||
|
|
||||||
type InvokeAIMetadata = {
|
type InvokeAIMetadata = {
|
||||||
@ -131,7 +155,7 @@ export const parseNodeMetadata = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the only valid object types are ImageField, LatentsField and ConditioningField
|
// the only valid object types are ImageField, LatentsField, ConditioningField, ControlField
|
||||||
if (isObject(nodeItem)) {
|
if (isObject(nodeItem)) {
|
||||||
if ('image_name' in nodeItem || 'image_type' in nodeItem) {
|
if ('image_name' in nodeItem || 'image_type' in nodeItem) {
|
||||||
const imageField = parseImageField(nodeItem);
|
const imageField = parseImageField(nodeItem);
|
||||||
@ -156,6 +180,14 @@ export const parseNodeMetadata = (
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('control' in nodeItem) {
|
||||||
|
const controlField = parseControlField(nodeItem);
|
||||||
|
if (controlField) {
|
||||||
|
parsed[nodeKey] = controlField;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise we accept any string, number or boolean
|
// otherwise we accept any string, number or boolean
|
||||||
|
@ -7,6 +7,12 @@ import EnumInputFieldComponent from './fields/EnumInputFieldComponent';
|
|||||||
import ImageInputFieldComponent from './fields/ImageInputFieldComponent';
|
import ImageInputFieldComponent from './fields/ImageInputFieldComponent';
|
||||||
import LatentsInputFieldComponent from './fields/LatentsInputFieldComponent';
|
import LatentsInputFieldComponent from './fields/LatentsInputFieldComponent';
|
||||||
import ConditioningInputFieldComponent from './fields/ConditioningInputFieldComponent';
|
import ConditioningInputFieldComponent from './fields/ConditioningInputFieldComponent';
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
import ControlNetInputFieldComponent from './fields/ControlNetInputFieldComponent';
|
||||||
|
import ControlInputFieldComponent from './fields/ControlInputFieldComponent';
|
||||||
|
|
||||||
|
>>>>>>> 5b9fa636 (Refactored controlnet node to output ControlField that bundles control info.)
|
||||||
import ModelInputFieldComponent from './fields/ModelInputFieldComponent';
|
import ModelInputFieldComponent from './fields/ModelInputFieldComponent';
|
||||||
import NumberInputFieldComponent from './fields/NumberInputFieldComponent';
|
import NumberInputFieldComponent from './fields/NumberInputFieldComponent';
|
||||||
import StringInputFieldComponent from './fields/StringInputFieldComponent';
|
import StringInputFieldComponent from './fields/StringInputFieldComponent';
|
||||||
@ -97,6 +103,29 @@ const InputFieldComponent = (props: InputFieldComponentProps) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
if (type === 'controlnet' && template.type === 'controlnet') {
|
||||||
|
return (
|
||||||
|
<ControlNetInputFieldComponent
|
||||||
|
nodeId={nodeId}
|
||||||
|
field={field}
|
||||||
|
template={template}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'control' && template.type === 'control') {
|
||||||
|
return (
|
||||||
|
<ControlInputFieldComponent
|
||||||
|
nodeId={nodeId}
|
||||||
|
field={field}
|
||||||
|
template={template}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> 5b9fa636 (Refactored controlnet node to output ControlField that bundles control info.)
|
||||||
if (type === 'model' && template.type === 'model') {
|
if (type === 'model' && template.type === 'model') {
|
||||||
return (
|
return (
|
||||||
<ModelInputFieldComponent
|
<ModelInputFieldComponent
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import {
|
||||||
|
ControlInputFieldTemplate,
|
||||||
|
ControlInputFieldValue,
|
||||||
|
} from 'features/nodes/types/types';
|
||||||
|
import { memo } from 'react';
|
||||||
|
import { FieldComponentProps } from './types';
|
||||||
|
|
||||||
|
const ControlInputFieldComponent = (
|
||||||
|
props: FieldComponentProps<ControlInputFieldValue, ControlInputFieldTemplate>
|
||||||
|
) => {
|
||||||
|
const { nodeId, field } = props;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default memo(ControlInputFieldComponent);
|
@ -15,6 +15,7 @@ export const FIELD_TYPE_MAP: Record<string, FieldType> = {
|
|||||||
array: 'array',
|
array: 'array',
|
||||||
item: 'item',
|
item: 'item',
|
||||||
ColorField: 'color',
|
ColorField: 'color',
|
||||||
|
ControlField: 'control',
|
||||||
};
|
};
|
||||||
|
|
||||||
const COLOR_TOKEN_VALUE = 500;
|
const COLOR_TOKEN_VALUE = 500;
|
||||||
@ -22,6 +23,9 @@ const COLOR_TOKEN_VALUE = 500;
|
|||||||
const getColorTokenCssVariable = (color: string) =>
|
const getColorTokenCssVariable = (color: string) =>
|
||||||
`var(--invokeai-colors-${color}-${COLOR_TOKEN_VALUE})`;
|
`var(--invokeai-colors-${color}-${COLOR_TOKEN_VALUE})`;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
// @ts-ignore
|
||||||
|
// @ts-ignore
|
||||||
export const FIELDS: Record<FieldType, FieldUIConfig> = {
|
export const FIELDS: Record<FieldType, FieldUIConfig> = {
|
||||||
integer: {
|
integer: {
|
||||||
color: 'red',
|
color: 'red',
|
||||||
@ -71,6 +75,12 @@ export const FIELDS: Record<FieldType, FieldUIConfig> = {
|
|||||||
title: 'Conditioning',
|
title: 'Conditioning',
|
||||||
description: 'Conditioning may be passed between nodes.',
|
description: 'Conditioning may be passed between nodes.',
|
||||||
},
|
},
|
||||||
|
control: {
|
||||||
|
color: 'cyan',
|
||||||
|
colorCssVar: getColorTokenCssVariable('cyan'), // TODO: no free color left
|
||||||
|
title: 'Control',
|
||||||
|
description: 'Control info passed between nodes.',
|
||||||
|
},
|
||||||
model: {
|
model: {
|
||||||
color: 'teal',
|
color: 'teal',
|
||||||
colorCssVar: getColorTokenCssVariable('teal'),
|
colorCssVar: getColorTokenCssVariable('teal'),
|
||||||
|
@ -61,6 +61,7 @@ export type FieldType =
|
|||||||
| 'image'
|
| 'image'
|
||||||
| 'latents'
|
| 'latents'
|
||||||
| 'conditioning'
|
| 'conditioning'
|
||||||
|
| 'control'
|
||||||
| 'model'
|
| 'model'
|
||||||
| 'array'
|
| 'array'
|
||||||
| 'item'
|
| 'item'
|
||||||
@ -82,6 +83,7 @@ export type InputFieldValue =
|
|||||||
| ImageInputFieldValue
|
| ImageInputFieldValue
|
||||||
| LatentsInputFieldValue
|
| LatentsInputFieldValue
|
||||||
| ConditioningInputFieldValue
|
| ConditioningInputFieldValue
|
||||||
|
| ControlInputFieldValue
|
||||||
| EnumInputFieldValue
|
| EnumInputFieldValue
|
||||||
| ModelInputFieldValue
|
| ModelInputFieldValue
|
||||||
| ArrayInputFieldValue
|
| ArrayInputFieldValue
|
||||||
@ -102,6 +104,7 @@ export type InputFieldTemplate =
|
|||||||
| ImageInputFieldTemplate
|
| ImageInputFieldTemplate
|
||||||
| LatentsInputFieldTemplate
|
| LatentsInputFieldTemplate
|
||||||
| ConditioningInputFieldTemplate
|
| ConditioningInputFieldTemplate
|
||||||
|
| ControlInputFieldTemplate
|
||||||
| EnumInputFieldTemplate
|
| EnumInputFieldTemplate
|
||||||
| ModelInputFieldTemplate
|
| ModelInputFieldTemplate
|
||||||
| ArrayInputFieldTemplate
|
| ArrayInputFieldTemplate
|
||||||
@ -177,6 +180,10 @@ export type LatentsInputFieldValue = FieldValueBase & {
|
|||||||
|
|
||||||
export type ConditioningInputFieldValue = FieldValueBase & {
|
export type ConditioningInputFieldValue = FieldValueBase & {
|
||||||
type: 'conditioning';
|
type: 'conditioning';
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ControlInputFieldValue = FieldValueBase & {
|
||||||
|
type: 'control';
|
||||||
value?: undefined;
|
value?: undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -262,6 +269,11 @@ export type ConditioningInputFieldTemplate = InputFieldTemplateBase & {
|
|||||||
type: 'conditioning';
|
type: 'conditioning';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ControlInputFieldTemplate = InputFieldTemplateBase & {
|
||||||
|
default: undefined;
|
||||||
|
type: 'control';
|
||||||
|
};
|
||||||
|
|
||||||
export type EnumInputFieldTemplate = InputFieldTemplateBase & {
|
export type EnumInputFieldTemplate = InputFieldTemplateBase & {
|
||||||
default: string | number;
|
default: string | number;
|
||||||
type: 'enum';
|
type: 'enum';
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
IntegerInputFieldTemplate,
|
IntegerInputFieldTemplate,
|
||||||
LatentsInputFieldTemplate,
|
LatentsInputFieldTemplate,
|
||||||
ConditioningInputFieldTemplate,
|
ConditioningInputFieldTemplate,
|
||||||
|
ControlInputFieldTemplate,
|
||||||
StringInputFieldTemplate,
|
StringInputFieldTemplate,
|
||||||
ModelInputFieldTemplate,
|
ModelInputFieldTemplate,
|
||||||
ArrayInputFieldTemplate,
|
ArrayInputFieldTemplate,
|
||||||
@ -215,6 +216,21 @@ const buildConditioningInputFieldTemplate = ({
|
|||||||
return template;
|
return template;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const buildControlInputFieldTemplate = ({
|
||||||
|
schemaObject,
|
||||||
|
baseField,
|
||||||
|
}: BuildInputFieldArg): ControlInputFieldTemplate => {
|
||||||
|
const template: ControlInputFieldTemplate = {
|
||||||
|
...baseField,
|
||||||
|
type: 'control',
|
||||||
|
inputRequirement: 'always',
|
||||||
|
inputKind: 'connection',
|
||||||
|
default: schemaObject.default ?? undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
return template;
|
||||||
|
};
|
||||||
|
|
||||||
const buildEnumInputFieldTemplate = ({
|
const buildEnumInputFieldTemplate = ({
|
||||||
schemaObject,
|
schemaObject,
|
||||||
baseField,
|
baseField,
|
||||||
@ -331,6 +347,9 @@ export const buildInputFieldTemplate = (
|
|||||||
if (['conditioning'].includes(fieldType)) {
|
if (['conditioning'].includes(fieldType)) {
|
||||||
return buildConditioningInputFieldTemplate({ schemaObject, baseField });
|
return buildConditioningInputFieldTemplate({ schemaObject, baseField });
|
||||||
}
|
}
|
||||||
|
if (['control'].includes(fieldType)) {
|
||||||
|
return buildControlInputFieldTemplate({ schemaObject, baseField });
|
||||||
|
}
|
||||||
if (['model'].includes(fieldType)) {
|
if (['model'].includes(fieldType)) {
|
||||||
return buildModelInputFieldTemplate({ schemaObject, baseField });
|
return buildModelInputFieldTemplate({ schemaObject, baseField });
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,10 @@ export const buildInputFieldValue = (
|
|||||||
fieldValue.value = undefined;
|
fieldValue.value = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (template.type === 'control') {
|
||||||
|
fieldValue.value = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if (template.type === 'model') {
|
if (template.type === 'model') {
|
||||||
fieldValue.value = undefined;
|
fieldValue.value = undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user