From c44df3c3793e2bd1db5fa614412cf7fec64aa4ea Mon Sep 17 00:00:00 2001 From: AI Lab <129358391+1038lab@users.noreply.github.com> Date: Wed, 26 Aug 2026 17:46:38 -0700 Subject: [PATCH] Implement legacy file cleanup on initialization Added legacy file cleanup functionality to remove obsolete files during initialization. --- __init__.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/__init__.py b/__init__.py index 1ad5dcc..f537281 100644 --- a/__init__.py +++ b/__init__.py @@ -16,6 +16,39 @@ if str(nodes_dir) not in sys.path: if str(current_dir) not in sys.path: sys.path.append(str(current_dir)) +# Legacy root files migrated into py/ in v2.3.0 +LEGACY_ROOT_FILES = [ + "AILab_OutputCleaner.py", + "AILab_QwenVL.py", + "AILab_QwenVL_GGUF.py", + "AILab_QwenVL_GGUF_PromptEnhancer.py", + "AILab_QwenVL_PromptEnhancer.py", + "AILab_System_Prompts.json", +] + + +def cleanup_legacy_files(): + """Automatically clean up obsolete root files left over by ComfyUI Manager / git updates.""" + old_prompts = current_dir / "AILab_System_Prompts.json" + new_prompts = current_dir / "system_prompts.json" + if old_prompts.exists() and not new_prompts.exists(): + try: + old_prompts.rename(new_prompts) + except Exception: + pass + + for filename in LEGACY_ROOT_FILES: + target = current_dir / filename + if target.exists() and target.is_file(): + try: + target.unlink() + except Exception: + pass + + +# Auto-cleanup legacy root files on initialization +cleanup_legacy_files() + # Initialize node mappings NODE_CLASS_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS = {}