This commit is contained in:
meimeilook 2025-04-11 13:28:24 +02:00 committed by GitHub
commit 3e793ab22b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -554,32 +554,27 @@ class PromptServer():
def node_info(node_class): def node_info(node_class):
obj_class = nodes.NODE_CLASS_MAPPINGS[node_class] obj_class = nodes.NODE_CLASS_MAPPINGS[node_class]
info = {} input_types = obj_class.INPUT_TYPES()
info['input'] = obj_class.INPUT_TYPES()
info['input_order'] = {key: list(value.keys()) for (key, value) in obj_class.INPUT_TYPES().items()} info = {
info['output'] = obj_class.RETURN_TYPES 'input': input_types,
info['output_is_list'] = obj_class.OUTPUT_IS_LIST if hasattr(obj_class, 'OUTPUT_IS_LIST') else [False] * len(obj_class.RETURN_TYPES) 'input_order': {key: list(value.keys()) for key, value in input_types.items()},
info['output_name'] = obj_class.RETURN_NAMES if hasattr(obj_class, 'RETURN_NAMES') else info['output'] 'output': obj_class.RETURN_TYPES,
info['name'] = node_class 'output_is_list': getattr(obj_class, 'OUTPUT_IS_LIST', [False] * len(obj_class.RETURN_TYPES)),
info['display_name'] = nodes.NODE_DISPLAY_NAME_MAPPINGS[node_class] if node_class in nodes.NODE_DISPLAY_NAME_MAPPINGS.keys() else node_class 'output_name': getattr(obj_class, 'RETURN_NAMES', obj_class.RETURN_TYPES),
info['description'] = obj_class.DESCRIPTION if hasattr(obj_class,'DESCRIPTION') else '' 'name': node_class,
info['python_module'] = getattr(obj_class, "RELATIVE_PYTHON_MODULE", "nodes") 'display_name': nodes.NODE_DISPLAY_NAME_MAPPINGS.get(node_class, node_class),
info['category'] = 'sd' 'description': getattr(obj_class, 'DESCRIPTION', ''),
if hasattr(obj_class, 'OUTPUT_NODE') and obj_class.OUTPUT_NODE == True: 'python_module': getattr(obj_class, "RELATIVE_PYTHON_MODULE", "nodes"),
info['output_node'] = True 'category': getattr(obj_class, 'CATEGORY', 'sd'),
else: 'output_node': hasattr(obj_class, 'OUTPUT_NODE') and obj_class.OUTPUT_NODE,
info['output_node'] = False 'deprecated': getattr(obj_class, "DEPRECATED", False),
'experimental': getattr(obj_class, "EXPERIMENTAL", False)
if hasattr(obj_class, 'CATEGORY'): }
info['category'] = obj_class.CATEGORY
if hasattr(obj_class, 'OUTPUT_TOOLTIPS'): if hasattr(obj_class, 'OUTPUT_TOOLTIPS'):
info['output_tooltips'] = obj_class.OUTPUT_TOOLTIPS info['output_tooltips'] = obj_class.OUTPUT_TOOLTIPS
if getattr(obj_class, "DEPRECATED", False):
info['deprecated'] = True
if getattr(obj_class, "EXPERIMENTAL", False):
info['experimental'] = True
return info return info
@routes.get("/object_info") @routes.get("/object_info")
@ -592,8 +587,9 @@ class PromptServer():
except Exception: except Exception:
logging.error(f"[ERROR] An error occurred while retrieving information for the '{x}' node.") logging.error(f"[ERROR] An error occurred while retrieving information for the '{x}' node.")
logging.error(traceback.format_exc()) logging.error(traceback.format_exc())
return web.json_response(out)
return web.json_response(out)
@routes.get("/object_info/{node_class}") @routes.get("/object_info/{node_class}")
async def get_object_info_node(request): async def get_object_info_node(request):
node_class = request.match_info.get("node_class", None) node_class = request.match_info.get("node_class", None)