From e6f1724420cb0f3f0d7356c370d7da00ca9d7f45 Mon Sep 17 00:00:00 2001 From: Blueprint Coding Date: Thu, 19 Dec 2024 19:11:51 -0700 Subject: [PATCH] Set autorepair of ST launch to NO by default Fixes missing log issues for users with slow internet Fixed the info_vram bat that was broken due to bad merged contributor code. Little less info than before but the core works at least. --- Launcher.bat | 46 +++++++++++++++---- bin/functions/Home/info_vram.bat | 31 +++++++++---- .../App_Launcher/Core_Utilities/start_st.bat | 29 +++++++++++- 3 files changed, 86 insertions(+), 20 deletions(-) diff --git a/Launcher.bat b/Launcher.bat index c0ba88e..71306ac 100644 --- a/Launcher.bat +++ b/Launcher.bat @@ -231,10 +231,12 @@ set "editor_voice_generation_dir=%functions_dir%\Toolbox\Editor\Voice_Generation set "editor_core_utilities_dir=%functions_dir%\Toolbox\Editor\Core_Utilities" REM Define variables for logging +set "st_auto_repair=%log_dir%\autorepair-setting.txt" set "logs_stl_console_path=%log_dir%\stl.log" set "logs_st_console_path=%log_dir%\st_console_output.log" + REM Create the logs folder if it doesn't exist if not exist "%log_dir%" ( mkdir "%log_dir%" @@ -487,7 +489,8 @@ for /f "tokens=2 delims==" %%f in ('wmic path Win32_VideoController get name /va if /i !lastUVRAM! neq !UVRAM! ( if /i !lastUVRAM! gtr !UVRAM! ( set "UVRAM=!lastUVRAM!" - set "GPU_name=!last_GPU!" + @REM set "GPU_name=!last_GPU!" + ) ) ) else ( @@ -694,7 +697,7 @@ if "%choice%"=="1" ( ) else if "%choice%"=="8" ( set "caller=home" if exist "%functions_dir%\Home\info_vram.bat" ( - call %functions_dir%\Home\info_vram.bat + call "%functions_dir%\Home\info_vram.bat" "%UVRAM%" goto :home ) else ( echo [%DATE% %TIME%] ERROR: info_vram.bat not found in: %functions_dir%\Home >> %logs_stl_console_path% @@ -4447,12 +4450,24 @@ REM ############################################################ REM ########## TROUBLESHOOTING & SUPPORT - FRONTEND ############ REM ############################################################ :troubleshooting +setlocal enabledelayedexpansion + +REM Check auto-repair setting +if not exist "%log_dir%\autorepair-setting.txt" ( + echo NO > "%log_dir%\autorepair-setting.txt" +) +for /f "tokens=1 delims= " %%a in ('type "%log_dir%\autorepair-setting.txt"') do set "st_auto_repair=%%a" +if /i "%st_auto_repair%"=="YES" ( + set "autorepair_status=Enabled" +) else ( + set "autorepair_status=Disabled" +) + title STL [TROUBLE ^& SUPPORT] @echo off cls echo %blue_fg_strong%^| ^> / Home / Troubleshooting ^& Support ^|%reset% echo %blue_fg_strong% ==============================================================%reset% -setlocal enabledelayedexpansion REM Call the VPN detection script call "%troubleshooting_dir%\detect_vpn.bat" > "%log_dir%\vpn_status.txt" @@ -4461,7 +4476,7 @@ del "%log_dir%\vpn_status.txt" REM Call the home port check script call "%troubleshooting_dir%\home_port_check.bat" > "%log_dir%\port_8000_status.txt" -set /p "portStatus="<"%log_dir%\port_8000_status.txt +set /p "portStatus="<"%log_dir%\port_8000_status.txt" del "%log_dir%\port_8000_status.txt" REM Get the current Git branch @@ -4509,11 +4524,12 @@ echo 4. Fix unresolved conflicts or unmerged files [SillyTavern] echo 5. Export dxdiag info echo 6. Find what app is using port echo 7. Set Onboarding Flow +echo 8. Toggle Logging/Auto-repair (Current: %cyan_fg_strong%!autorepair_status!%reset%) echo %cyan_fg_strong% ______________________________________________________________%reset% echo %cyan_fg_strong%^| Support Options: ^|%reset% -echo 8. Report an Issue -echo 9. SillyTavern Documentation -echo 10. Discord servers +echo 9. Report an Issue +echo 10. SillyTavern Documentation +echo 11. Discord servers echo %cyan_fg_strong% ______________________________________________________________%reset% echo %cyan_fg_strong%^| Menu Options: ^|%reset% echo 0. Back @@ -4528,7 +4544,6 @@ for /f %%A in ('"prompt $H &echo on &for %%B in (1) do rem"') do set "BS=%%A" set /p "troubleshooting_choice=%BS% Choose Your Destiny: " - REM ############## TROUBLESHOOTING - BACKEND ################## if "%troubleshooting_choice%"=="1" ( set "caller=troubleshooting" @@ -4608,10 +4623,20 @@ if "%troubleshooting_choice%"=="1" ( goto :troubleshooting ) ) else if "%troubleshooting_choice%"=="8" ( - call :issue_report + for /f "tokens=1 delims= " %%a in ('type "%log_dir%\autorepair-setting.txt"') do set "st_auto_repair=%%a" + if /i "%st_auto_repair%"=="YES" ( + echo NO > "%log_dir%\autorepair-setting.txt" + echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Auto-repair and logging disabled. + ) else ( + echo YES > "%log_dir%\autorepair-setting.txt" + echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Auto-repair and logging enabled. + ) + goto :troubleshooting ) else if "%troubleshooting_choice%"=="9" ( - call :documentation + call :issue_report ) else if "%troubleshooting_choice%"=="10" ( + call :documentation +) else if "%troubleshooting_choice%"=="11" ( set "caller=troubleshooting" if exist "%troubleshooting_dir%\Support\discord.bat" ( call %troubleshooting_dir%\Support\discord.bat @@ -4648,6 +4673,7 @@ start "" "https://docs.sillytavern.app/" goto :troubleshooting + REM ############################################################ REM ############## SWITCH BRANCH - FRONTEND #################### REM ############################################################ diff --git a/bin/functions/Home/info_vram.bat b/bin/functions/Home/info_vram.bat index e4f64b1..60edac1 100644 --- a/bin/functions/Home/info_vram.bat +++ b/bin/functions/Home/info_vram.bat @@ -1,25 +1,38 @@ @echo off - :info_vram title STL [VRAM INFO] chcp 65001 > nul setlocal enabledelayedexpansion -REM Get GPU information -for /f "skip=1 delims=" %%i in ('wmic path win32_videocontroller get caption') do ( - set "gpu_info=!gpu_info! %%i" + + +REM Confirm script start and input arguments +set "UVRAM=%~1" + +REM Handle undefined or invalid UVRAM +if not defined UVRAM ( + echo DEBUG: UVRAM is not defined. Defaulting to 0. + set "UVRAM=0" +) else if "%UVRAM%"=="Property not found" ( + echo DEBUG: UVRAM could not be detected. Defaulting to 0. + set "UVRAM=0" ) +REM Get GPU information safely +set "gpu_info=" +for /f "skip=1 delims=" %%i in ('wmic path win32_videocontroller get caption') do ( + if not "%%i"=="" set "gpu_info=!gpu_info! %%i" +) cls echo %blue_fg_strong%^| ^> / Home / VRAM ^& LLM Info ^|%reset% echo %blue_fg_strong% ======================================================================================================%reset% REM Recommendations Based on VRAM Size if %UVRAM% lss 8 ( - echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% + @REM echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% echo %cyan_fg_strong%GPU VRAM: %UVRAM% GB%reset% - It's recommended to stick with APIs like OpenAI, Claude or OpenRouter for LLM usage, echo Local models will result in memory error or perform a REAL SLOW output ) else if %UVRAM% lss 12 ( - echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% + @REM echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% echo %cyan_fg_strong%GPU VRAM: %UVRAM% GB%reset% - Great for 7B and 8B models. Check info below for BPW endlocal echo. @@ -42,7 +55,7 @@ if %UVRAM% lss 8 ( echo ╚═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ echo. ) else if %UVRAM% lss 22 ( - echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% + @REM echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% echo %cyan_fg_strong%GPU VRAM: %UVRAM% GB%reset% - Great for 7B, 8B and 13B models. Check info below for BPW endlocal echo. @@ -65,7 +78,7 @@ if %UVRAM% lss 8 ( echo ╚═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ echo. ) else if %UVRAM% lss 25 ( - echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% + @REM echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% echo %cyan_fg_strong%GPU VRAM: %UVRAM% GB%reset% - Great for 7B, 8B, 13B and 30B models, Check info below for BPW endlocal echo. @@ -88,7 +101,7 @@ if %UVRAM% lss 8 ( echo ╚═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ echo. ) else if %UVRAM% gtr 25 ( - echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% + @REM echo %cyan_fg_strong%GPU: %gpu_info:~1%%reset% echo %cyan_fg_strong%GPU VRAM: %UVRAM% GB%reset% - Great for 7B, 8B, 13B, 30B and 70B models. Check info below for BPW endlocal echo. diff --git a/bin/functions/Toolbox/App_Launcher/Core_Utilities/start_st.bat b/bin/functions/Toolbox/App_Launcher/Core_Utilities/start_st.bat index be6fba9..6344c93 100644 --- a/bin/functions/Toolbox/App_Launcher/Core_Utilities/start_st.bat +++ b/bin/functions/Toolbox/App_Launcher/Core_Utilities/start_st.bat @@ -40,6 +40,33 @@ if exist "%SSL_INFO_FILE%" ( ) ) +REM Debugging: Check auto-repair setting +if not exist "%log_dir%\autorepair-setting.txt" ( + echo NO > "%log_dir%\autorepair-setting.txt" +) + +REM Read and sanitize autorepair-setting.txt +set "st_auto_repair=" +for /f "tokens=*" %%a in ('type "%log_dir%\autorepair-setting.txt" 2^>nul ^| findstr /v "^$"') do set "st_auto_repair=%%a" + +REM Remove leading/trailing spaces and validate value + +set "st_auto_repair=!st_auto_repair: =!" +if /i "!st_auto_repair!" neq "YES" if /i "!st_auto_repair!" neq "NO" ( + set "st_auto_repair=NO" +) + +REM Conditional Logic Based on st_auto_repair +if "%st_auto_repair%"=="YES" ( + echo DEBUG: Entered the YES block + echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Auto-repair process enabled [this can be toggled in the troubleshooting menu]. + goto :ST_SSL_Start +) else ( + echo DEBUG: Entered the NO block + echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Auto-repair disabled [this can be toggled in the troubleshooting menu]. Launching SillyTavern normally... + goto :fallback +) + :ST_SSL_Start if "%sslPathsFound%"=="true" ( echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% SillyTavern opened with SSL in a new window. @@ -72,7 +99,7 @@ goto :scan_log :fallback REM Fallback to %st_install_path% and start -echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Fallback: Starting SillyTavern from %st_install_path%... +echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Starting SillyTavern from %st_install_path%... start cmd /k "title SillyTavern && cd /d %st_install_path% && call npm install --no-audit --no-fund --loglevel=error --no-progress --omit=dev && call Start.bat" echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% SillyTavern should now be launching in a new window, if you still receive errors please contact the launcher devs in the #launcher-help channel on discord. timeout /t 10