This commit is contained in:
Extraltodeus 2025-12-14 11:02:46 +01:00 committed by GitHub
commit 8e53efdacb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 0 deletions

View File

@ -209,6 +209,12 @@ parser.add_argument(
help="The local filesystem path to the directory where the frontend is located. Overrides --front-end-version.", help="The local filesystem path to the directory where the frontend is located. Overrides --front-end-version.",
) )
parser.add_argument(
"--legacy-frontend-compat",
action="store_true",
help="Convert V3 node schemas to V1 format for compatibility with old frontends"
)
parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path. Overrides --base-directory.") parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path. Overrides --base-directory.")
parser.add_argument("--enable-compress-response-body", action="store_true", help="Enable compressing response body.") parser.add_argument("--enable-compress-response-body", action="store_true", help="Enable compressing response body.")

View File

@ -182,6 +182,33 @@ def create_block_external_middleware():
return block_external_middleware return block_external_middleware
def convert_v3_to_v1_schema(input_types):
"""
Convert V3 schema (Combo objects) to V1 schema (simple tuples/lists)
for compatibility with old frontends
"""
converted = {}
for category, inputs in input_types.items():
converted[category] = {}
for input_name, input_spec in inputs.items():
if isinstance(input_spec, tuple) and len(input_spec) > 1 and input_spec[0] == 'COMBO':
first_elem = input_spec[1]
if isinstance(first_elem, dict) and 'options' in first_elem:
adapted_input_spec = (first_elem['options'], {})
first_elem.pop('options')
adapted_input_spec[1].update(first_elem)
converted[category][input_name] = adapted_input_spec
else:
# Already V1 format, pass through
converted[category][input_name] = input_spec
else:
# Pass through anything else unchanged
converted[category][input_name] = input_spec
return converted
class PromptServer(): class PromptServer():
def __init__(self, loop): def __init__(self, loop):
@ -681,6 +708,8 @@ class PromptServer():
for x in nodes.NODE_CLASS_MAPPINGS: for x in nodes.NODE_CLASS_MAPPINGS:
try: try:
out[x] = node_info(x) out[x] = node_info(x)
if args.legacy_frontend_compat:
out[x]['input'] = convert_v3_to_v1_schema(out[x]['input'])
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())