Add support for growable inputs (#6830)

![autogrow-optional_00002](https://github.com/user-attachments/assets/79bfe703-23d7-45fb-86ce-88baa9eaf582)

Also fixes connections to widget inputs created by a dynamic combo
breaking on reload.

Performs some refactoring to group the prior dynamic inputs code.

See also, the overarching frontend PR: comfyanonymous/ComfyUI#10832

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6830-Add-support-for-growable-inputs-2b36d73d365081c484ebc251a10aa6dd)
by [Unito](https://www.unito.io)
This commit is contained in:
AustinMroz
2025-12-01 21:05:25 -08:00
committed by GitHub
parent 8e006bb8a3
commit 49824824e6
10 changed files with 543 additions and 202 deletions

View File

@@ -14,10 +14,6 @@ const zRemoteWidgetConfig = z.object({
timeout: z.number().gte(0).optional(),
max_retries: z.number().gte(0).optional()
})
const zWidgetTemplate = z.object({
template_id: z.string(),
allowed_types: z.string().optional()
})
const zMultiSelectOption = z.object({
placeholder: z.string().optional(),
chip: z.boolean().optional()
@@ -34,7 +30,6 @@ export const zBaseInputOptions = z
hidden: z.boolean().optional(),
advanced: z.boolean().optional(),
widgetType: z.string().optional(),
template: zWidgetTemplate.optional(),
/** Backend-only properties. */
rawLink: z.boolean().optional(),
lazy: z.boolean().optional()
@@ -232,9 +227,21 @@ export const zComfyNodeDef = z.object({
input_order: z.record(z.array(z.string())).optional()
})
export const zAutogrowOptions = z.object({
...zBaseInputOptions.shape,
template: z.object({
input: zComfyInputsSpec,
names: z.array(z.string()).optional(),
max: z.number().optional(),
//Backend defines as mandatory with min 1, Frontend is more forgiving
min: z.number().optional(),
prefix: z.string().optional()
})
})
export const zDynamicComboInputSpec = z.tuple([
z.literal('COMFY_DYNAMICCOMBO_V3'),
zComboInputOptions.extend({
zBaseInputOptions.extend({
options: z.array(
z.object({
inputs: zComfyInputsSpec,