Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(workflows): allow Any outputs to connect to collection inputs (#9928)

Josh Corbett206316b495df
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/validation.test.ts b/invokeai/frontend/webv2/src/features/workflow/core/validation.test.ts
index f862feeced..5145f72b5c 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/validation.test.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/validation.test.ts
@@ -49,6 +49,9 @@ describe('validateConnectionTypes', () => {
expect(validateConnectionTypes(single('ImageField'), single('CollectionItemField'))).toBe(true);
expect(validateConnectionTypes(single('ImageField'), single('AnyField'))).toBe(true);
expect(validateConnectionTypes(single('AnyField'), single('ImageField'))).toBe(true);
+ // An Any output may hold a list at runtime, so it can feed collection inputs.
+ expect(validateConnectionTypes(single('AnyField'), collection('CollectionField'))).toBe(true);
+ expect(validateConnectionTypes(single('AnyField'), collection('BooleanField'))).toBe(true);
});
it('rejects batch/non-batch mixes', () => {
@@ -61,6 +64,7 @@ describe('validateConnectionTypes', () => {
).toBe(true);
expect(validateConnectionTypes(collection('FloatField'), { ...collection('FloatField'), batch: true })).toBe(false);
expect(validateConnectionTypes({ ...single('IntegerField'), batch: true }, single('IntegerField'))).toBe(false);
+ expect(validateConnectionTypes(single('AnyField'), { ...collection('FloatField'), batch: true })).toBe(false);
});
});
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/validation.ts b/invokeai/frontend/webv2/src/features/workflow/core/validation.ts
index 755997c39c..f9a610585c 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/validation.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/validation.ts
@@ -67,7 +67,8 @@ export const validateConnectionTypes = (sourceType: FieldType, targetType: Field
const isSubTypeMatch = doesCardinalityMatch && (isIntToFloat || isIntToString || isFloatToString);
const isTargetAnyType = targetType.name === 'AnyField';
- const isSourceAnyType = sourceType.name === 'AnyField' && doesCardinalityMatch;
+ // An Any output may hold any value, so like the backend it connects to inputs of any cardinality.
+ const isSourceAnyType = sourceType.name === 'AnyField';
return (
isCollectionItemToNonCollection ||