mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-06 14:10:13 -03:00
fix: correct return_types propagation to GenericNodeExtractor
Two bugs prevented type-signature-based fallback from working: - metadata_hook.py used getattr(obj.__class__, 'RETURN_TYPES') which fails when _async_map_node_over_list is called with a class (not instance) — obj.__class__ is the metaclass 'type', which has no RETURN_TYPES. Fixed: getattr(obj, ...). - metadata_registry.py used type(extractor) is GenericNodeExtractor to dispatch return_types. NODE_EXTRACTORS stores class references, not instances; type(Class) is always 'type', never the class. Fixed: extractor is GenericNodeExtractor.
This commit is contained in:
@@ -83,7 +83,7 @@ class MetadataHook:
|
|||||||
|
|
||||||
# Record inputs before execution
|
# Record inputs before execution
|
||||||
if node_id is not None:
|
if node_id is not None:
|
||||||
return_types = getattr(obj.__class__, 'RETURN_TYPES', None)
|
return_types = getattr(obj, 'RETURN_TYPES', None)
|
||||||
registry.record_node_execution(node_id, class_type, input_data_all, None, return_types=return_types)
|
registry.record_node_execution(node_id, class_type, input_data_all, None, return_types=return_types)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error collecting metadata (pre-execution): {str(e)}")
|
logger.error(f"Error collecting metadata (pre-execution): {str(e)}")
|
||||||
@@ -115,7 +115,7 @@ class MetadataHook:
|
|||||||
|
|
||||||
# Record outputs after execution
|
# Record outputs after execution
|
||||||
if node_id is not None:
|
if node_id is not None:
|
||||||
return_types = getattr(obj.__class__, 'RETURN_TYPES', None)
|
return_types = getattr(obj, 'RETURN_TYPES', None)
|
||||||
registry.update_node_execution(node_id, class_type, results, return_types=return_types)
|
registry.update_node_execution(node_id, class_type, results, return_types=return_types)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error collecting metadata (post-execution): {str(e)}")
|
logger.error(f"Error collecting metadata (post-execution): {str(e)}")
|
||||||
@@ -168,7 +168,7 @@ class MetadataHook:
|
|||||||
class_type = obj.__class__.__name__
|
class_type = obj.__class__.__name__
|
||||||
node_id = unique_id
|
node_id = unique_id
|
||||||
if node_id is not None:
|
if node_id is not None:
|
||||||
return_types = getattr(obj.__class__, 'RETURN_TYPES', None)
|
return_types = getattr(obj, 'RETURN_TYPES', None)
|
||||||
registry.record_node_execution(node_id, class_type, input_data_all, None, return_types=return_types)
|
registry.record_node_execution(node_id, class_type, input_data_all, None, return_types=return_types)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error collecting metadata (pre-execution): {str(e)}")
|
logger.error(f"Error collecting metadata (pre-execution): {str(e)}")
|
||||||
@@ -186,7 +186,7 @@ class MetadataHook:
|
|||||||
class_type = obj.__class__.__name__
|
class_type = obj.__class__.__name__
|
||||||
node_id = unique_id
|
node_id = unique_id
|
||||||
if node_id is not None:
|
if node_id is not None:
|
||||||
return_types = getattr(obj.__class__, 'RETURN_TYPES', None)
|
return_types = getattr(obj, 'RETURN_TYPES', None)
|
||||||
registry.update_node_execution(node_id, class_type, results, return_types=return_types)
|
registry.update_node_execution(node_id, class_type, results, return_types=return_types)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error collecting metadata (post-execution): {str(e)}")
|
logger.error(f"Error collecting metadata (post-execution): {str(e)}")
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class MetadataRegistry:
|
|||||||
|
|
||||||
# Extract node-specific metadata
|
# Extract node-specific metadata
|
||||||
extractor = NODE_EXTRACTORS.get(class_type, GenericNodeExtractor)
|
extractor = NODE_EXTRACTORS.get(class_type, GenericNodeExtractor)
|
||||||
if type(extractor) is GenericNodeExtractor:
|
if extractor is GenericNodeExtractor:
|
||||||
extractor.extract(node_id, processed_inputs, outputs,
|
extractor.extract(node_id, processed_inputs, outputs,
|
||||||
self.prompt_metadata[self.current_prompt_id],
|
self.prompt_metadata[self.current_prompt_id],
|
||||||
return_types=return_types)
|
return_types=return_types)
|
||||||
@@ -194,7 +194,7 @@ class MetadataRegistry:
|
|||||||
# Use the same extractor to update with outputs
|
# Use the same extractor to update with outputs
|
||||||
extractor = NODE_EXTRACTORS.get(class_type, GenericNodeExtractor)
|
extractor = NODE_EXTRACTORS.get(class_type, GenericNodeExtractor)
|
||||||
if hasattr(extractor, "update"):
|
if hasattr(extractor, "update"):
|
||||||
if type(extractor) is GenericNodeExtractor:
|
if extractor is GenericNodeExtractor:
|
||||||
extractor.update(
|
extractor.update(
|
||||||
node_id, processed_outputs,
|
node_id, processed_outputs,
|
||||||
self.prompt_metadata[self.current_prompt_id],
|
self.prompt_metadata[self.current_prompt_id],
|
||||||
|
|||||||
Reference in New Issue
Block a user