Major Features: - Backward compatibility: VALIDATE_INPUTS handles old boolean True/False values for enable_runtime_hooks parameter - Phase 3: XMP region metadata with MWG-RS compliance (faces, areas, coordinates, extensions) - Phase 4.4: Per-node UI toggle for runtime hooks (dropdown: Auto/Enabled/Disabled) - Runtime hooks enhancements: performance tracking, disagreement logging, configurable limits New Files: - config.json: Configuration file for runtime hooks and metadata settings - eric_metadata/hooks/runtime_capture.py: Runtime hook infrastructure - eric_metadata/utils/config.py: Configuration loader with priority system - eric_metadata/utils/version.py: Version helper for generated_by labels - eric_metadata/utils/a1111.py: Automatic1111 parameter string generation - eric_metadata/utils/jpeg_fallback.py: 4-stage JPEG metadata fallback - eric_metadata/workflow/: Workflow parsing and generation helpers - tests/test_backward_compatibility.py: 7 tests for parameter migration - tests/test_xmp_regions.py: 6 tests for XMP region round-trip - tests/test_per_node_runtime_hooks.py: 9 tests for per-node toggle Documentation: - CONFIG_GUIDE.md: Configuration options and usage - RUNTIME_HOOKS_QUICK_REFERENCE.md: Quick reference for runtime hooks - RUNTIME_HOOKS_ENHANCEMENTS_SUMMARY.md: Detailed enhancement documentation - SAFE_RUNTIME_HOOKS_RESEARCH.md: Safety analysis and validation - edit_log.md: Complete change history Test Results: All 143 tests passing - 7 backward compatibility tests - 6 XMP region tests - 9 per-node toggle tests - 17 runtime hooks enhancement tests - 104 existing tests Breaking Changes: None - fully backward compatible
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Utility helpers for retrieving the current metadata system version."""
|
|
|
|
import os
|
|
from functools import lru_cache
|
|
|
|
|
|
@lru_cache(maxsize=1)
|
|
def get_metadata_system_version() -> str:
|
|
"""Return the metadata system version string from version.txt or fallbacks."""
|
|
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
|
|
version_file = os.path.join(base_dir, "version.txt")
|
|
|
|
try:
|
|
with open(version_file, "r", encoding="utf-8") as handle:
|
|
version = handle.read().strip()
|
|
if version:
|
|
return version
|
|
except OSError:
|
|
pass
|
|
|
|
try:
|
|
from custom_nodes.AAA_Metadata_System import __version__ # type: ignore
|
|
if __version__:
|
|
return str(__version__)
|
|
except Exception:
|
|
pass
|
|
|
|
return "unknown"
|
|
|
|
|
|
def get_metadata_system_version_label(prefix: str = "ComfyUI Metadata System") -> str:
|
|
"""Return a human-friendly "generated by" string using the current version."""
|
|
version = get_metadata_system_version()
|
|
lower_version = version.lower()
|
|
|
|
if lower_version.startswith("v"):
|
|
return f"{prefix} {version}"
|
|
if version == "unknown":
|
|
return f"{prefix} (version unknown)"
|
|
return f"{prefix} v{version}"
|