diff --git a/Launcher.bat b/Launcher.bat index 178c67f..291e72f 100644 --- a/Launcher.bat +++ b/Launcher.bat @@ -110,6 +110,19 @@ if exist "%sdwebui_modules_path%" ( ) ) +REM Define variables to track module status (COMFYUI) +set "comfyui_modules_path=%~dp0bin\settings\modules-comfyui.txt" +set "comfyui_disableautolaunch_trigger=false" +set "comfyui_listen_trigger=false" +set "comfyui_port_trigger=false" +set "comfyui_lowvram_trigger=false" +set "comfyui_medvram_trigger=false" +if exist "%comfyui_modules_path%" ( + for /f "tokens=1,* delims==" %%A in ('type "%comfyui_modules_path%"') do ( + set "%%A=%%B" + ) +) + REM Define variables to track module status (STABLE DIFFUSION WEBUI FORGE) set "sdwebuiforge_modules_path=%~dp0bin\settings\modules-sdwebuiforge.txt" set "sdwebuiforge_autolaunch_trigger=false" @@ -362,6 +375,14 @@ if not exist %sdwebui_modules_path% ( REM Load modules-xtts flags from modules-xtts for /f "tokens=*" %%a in (%sdwebui_modules_path%) do set "%%a" +REM Create modules-comfyui if it doesn't exist +if not exist %comfyui_modules_path% ( + type nul > %comfyui_modules_path% + echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Created text file: "modules-comfyui.txt" +) +REM Load modules-xtts flags from modules-xtts +for /f "tokens=*" %%a in (%comfyui_modules_path%) do set "%%a" + REM Create modules-ooba if it doesn't exist if not exist %ooba_modules_path% ( diff --git a/bin/functions/Toolbox/Editor/Image_Generation/edit_comfyui_modules.bat b/bin/functions/Toolbox/Editor/Image_Generation/edit_comfyui_modules.bat index d421093..49f57f4 100644 --- a/bin/functions/Toolbox/Editor/Image_Generation/edit_comfyui_modules.bat +++ b/bin/functions/Toolbox/Editor/Image_Generation/edit_comfyui_modules.bat @@ -1,6 +1,138 @@ @echo off +REM ############################################################ +REM ############## EDIT COMFYUI MODULES - FRONTEND ############# +REM ############################################################ :edit_comfyui_modules -echo COMING SOON -pause -goto :editor_image_generation +title STL [EDIT COMFYUI MODULES] +cls +echo %blue_fg_strong%/ Home / Toolbox / Editor / Image Generation / Edit comfyui Modules%reset% +echo ------------------------------------------------------------- +echo Choose comfyui modules to enable or disable (e.g., "2 3 5" to enable port, listen, and medvram) + +REM Display module options with colors based on their status +call :printModule "1. Disable Auto Launch (--disable-auto-launch)" %comfyui_disableautolaunch_trigger% +call :printModule "2. Port (--port 7969)" %comfyui_port_trigger% +call :printModule "3. Listen (--listen)" %comfyui_listen_trigger% +call :printModule "4. Low VRAM (--lowvram)" %comfyui_lowvram_trigger% +call :printModule "5. Med VRAM (--medvram)" %comfyui_medvram_trigger% +echo 00. Quick Start Stable Diffusion WebUI +echo 0. Back + +set "python_command=" + +set /p comfyui_module_choices=Choose modules to enable/disable: + +REM Handle the user's module choices and construct the Python command +for %%i in (%comfyui_module_choices%) do ( + if "%%i"=="1" ( + if "%comfyui_disableautolaunch_trigger%"=="true" ( + set "comfyui_disableautolaunch_trigger=false" + ) else ( + set "comfyui_disableautolaunch_trigger=true" + ) + + ) else if "%%i"=="2" ( + if "%comfyui_port_trigger%"=="true" ( + set "comfyui_port_trigger=false" + ) else ( + set "comfyui_port_trigger=true" + ) + + ) else if "%%i"=="3" ( + if "%comfyui_listen_trigger%"=="true" ( + set "comfyui_listen_trigger=false" + ) else ( + set "comfyui_listen_trigger=true" + ) + + + ) else if "%%i"=="4" ( + if "%comfyui_lowvram_trigger%"=="true" ( + set "comfyui_lowvram_trigger=false" + ) else ( + set "comfyui_lowvram_trigger=true" + ) + + ) else if "%%i"=="5" ( + if "%comfyui_medvram_trigger%"=="true" ( + set "comfyui_medvram_trigger=false" + ) else ( + set "comfyui_medvram_trigger=true" + ) + + ) else if "%%i"=="00" ( + set "caller=app_launcher_image_generation" + if exist "%app_launcher_image_generation_dir%\start_comfyui.bat" ( + call %app_launcher_image_generation_dir%\start_comfyui.bat + goto :home + ) else ( + echo [%DATE% %TIME%] ERROR: start_comfyui.bat not found in: app_launcher_image_generation_dir% >> %logs_stl_console_path% + echo %red_bg%[%time%]%reset% %red_fg_strong%[ERROR] start_comfyui.bat not found in: %app_launcher_image_generation_dir%%reset% + echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Running Automatic Repair... + git pull + pause + goto :edit_comfyui_modules + ) + + ) else if "%%i"=="0" ( + goto :editor_image_generation + ) +) + +REM Save the module flags to modules-comfyui +echo comfyui_disableautolaunch_trigger=%comfyui_disableautolaunch_trigger%>%comfyui_modules_path% +echo comfyui_port_trigger=%comfyui_port_trigger%>>%comfyui_modules_path% +echo comfyui_listen_trigger=%comfyui_listen_trigger%>>%comfyui_modules_path% +echo comfyui_lowvram_trigger=%comfyui_lowvram_trigger%>>%comfyui_modules_path% +echo comfyui_medvram_trigger=%comfyui_medvram_trigger%>>%comfyui_modules_path% + +REM remove modules_enable +set "modules_enable=" + +REM Compile the Python command +set "python_command=python launch.py" +if "%comfyui_disableautolaunch_trigger%"=="true" ( + set "python_command=%python_command% --disable-auto-launch" +) + + +if "%comfyui_port_trigger%"=="true" ( + set "python_command=%python_command% --port 7969" +) + +if "%comfyui_listen_trigger%"=="true" ( + set "python_command=%python_command% --listen" +) + +if "%comfyui_lowvram_trigger%"=="true" ( + set "python_command=%python_command% --lowvram" +) + +if "%comfyui_medvram_trigger%"=="true" ( + set "python_command=%python_command% --medvram" +) + +REM is modules_enable empty? +if defined modules_enable ( + REM remove last comma + set "modules_enable=%modules_enable:~0,-1%" +) + +REM command completed +if defined modules_enable ( + set "python_command=%python_command% --enable-modules=%modules_enable%" +) + +REM Save the constructed Python command to modules-comfyui for testing +echo comfyui_start_command=%python_command%>>%comfyui_modules_path% +goto :edit_comfyui_modules + +REM Function to print module options with color based on their status +:printModule +if "%2"=="true" ( + echo %green_fg_strong%%1 [Enabled]%reset% +) else ( + echo %red_fg_strong%%1 [Disabled]%reset% +) +exit /b