mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-17 01:52:59 +08:00
Make nested DynamicCombos work properly with prefixed keys on latest frontend; breaks old Autogrow, but is pretty much ready for upcoming Autogrow keys
This commit is contained in:
parent
639cf870f9
commit
154bf49204
@ -1004,6 +1004,7 @@ class Autogrow(ComfyTypeI):
|
||||
curr_prefix = handle_prefix(curr_prefix, self.id)
|
||||
# need to remove self from expected inputs dictionary; replaced by template inputs in frontend
|
||||
for inner_dict in d.values():
|
||||
# TODO: once frontend is ready, replace self.id with finalize_prefix(curr_prefix, self.id)
|
||||
if self.id in inner_dict:
|
||||
del inner_dict[self.id]
|
||||
self.template.expand_schema_for_dynamic(d, live_inputs, curr_prefix)
|
||||
@ -1031,9 +1032,10 @@ class DynamicCombo(ComfyTypeI):
|
||||
|
||||
def expand_schema_for_dynamic(self, d: dict[str, Any], live_inputs: dict[str, Any], curr_prefix: list[str] | None=None):
|
||||
# check if dynamic input's id is in live_inputs
|
||||
if self.id in live_inputs:
|
||||
curr_prefix = handle_prefix(curr_prefix, self.id)
|
||||
key = live_inputs[self.id]
|
||||
curr_prefix = handle_prefix(curr_prefix, self.id)
|
||||
finalized_id = finalize_prefix(curr_prefix)
|
||||
if finalized_id in live_inputs:
|
||||
key = live_inputs[finalized_id]
|
||||
selected_option = None
|
||||
for option in self.options:
|
||||
if option.key == key:
|
||||
@ -1111,8 +1113,13 @@ def add_dynamic_id_mapping(d: dict[str, Any], inputs: list[Input], curr_prefix:
|
||||
if self is not None:
|
||||
dynamic[finalize_prefix(curr_prefix[:-1], self.id)] = finalize_prefix(curr_prefix, self.id)
|
||||
for i in inputs:
|
||||
# if not isinstance(i, DynamicInput):
|
||||
dynamic[finalize_prefix(curr_prefix, i.id)] = finalize_prefix(curr_prefix, i.id)
|
||||
if not isinstance(i, DynamicInput):
|
||||
dynamic[finalize_prefix(curr_prefix, i.id)] = finalize_prefix(curr_prefix, i.id)
|
||||
|
||||
def add_to_dynamic_dict(dynamic: dict[str, Any], curr_prefix: list[str], id: str, value: str):
|
||||
finalize_key = finalize_prefix(curr_prefix, id)
|
||||
if finalize_key not in dynamic:
|
||||
dynamic[finalize_key] = value
|
||||
|
||||
class V3Data(TypedDict):
|
||||
hidden_inputs: dict[str, Any]
|
||||
|
||||
@ -756,6 +756,7 @@ async def validate_inputs(prompt_id, prompt, item, validated):
|
||||
validate_function_inputs = []
|
||||
validate_has_kwargs = False
|
||||
if issubclass(obj_class, _ComfyNodeInternal):
|
||||
obj_class: _io._ComfyNodeBaseInternal
|
||||
class_inputs, _, _ = obj_class.INPUT_TYPES(include_hidden=False, return_schema=True, live_inputs=inputs)
|
||||
validate_function_name = "validate_inputs"
|
||||
validate_function = first_real_override(obj_class, validate_function_name)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user