launcher improvements

+fixed XTTS path issue where it did not found voices
+fixed modules command construct by @AlexVeeBee
+added tab titles when launching service from terminal
+added function to edit modules in launcher.sh
This commit is contained in:
deffcolony
2023-12-07 15:29:05 +01:00
parent 4889ecb717
commit 84dbc9d300
2 changed files with 188 additions and 19 deletions

View File

@@ -149,7 +149,8 @@ REM Get the current Git branch
for /f %%i in ('git branch --show-current') do set current_branch=%%i
echo ======== VERSION STATUS =========
echo SillyTavern branch: %cyan_fg_strong%%current_branch%%reset%
echo Update Status: %update_status%
echo SillyTavern: %update_status%
echo Launcher: V1.0.1
echo =================================
set "choice="
@@ -191,9 +192,8 @@ if %errorlevel% neq 0 (
pause
goto :home
)
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% SillyTavern has been launched.
cd /d "%~dp0SillyTavern"
start cmd /k start.bat
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% SillyTavern launched in a new window.
start cmd /k "title SillyTavern && cd /d %~dp0SillyTavern && call npm install --no-audit && node server.js && pause && popd"
goto :home
@@ -207,9 +207,10 @@ if %errorlevel% neq 0 (
pause
goto :home
)
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% SillyTavern has been launched.
cd /d "%~dp0SillyTavern"
start cmd /k start.bat
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% SillyTavern launched in a new window.
start cmd /k "title SillyTavern && cd /d %~dp0SillyTavern && call npm install --no-audit && node server.js && pause && popd"
REM Run conda activate from the Miniconda installation
call "%miniconda_path%\Scripts\activate.bat"
@@ -218,13 +219,17 @@ REM Activate the extras environment
call conda activate extras
REM Start SillyTavern Extras with desired configurations
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Extras has been launched.
cd /d "%~dp0SillyTavern-extras"
start cmd /k python server.py --rvc-save-file --cuda-device=0 --max-content-length=1000 --enable-modules=talkinghead,chromadb,caption,summarize,rvc
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% Extras launched in a new window.
start cmd /k "title SillyTavern Extras && cd /d %~dp0SillyTavern-extras && python server.py --rvc-save-file --cuda-device=0 --max-content-length=1000 --enable-modules=talkinghead,chromadb,caption,summarize,rvc"
REM Activate the xtts environment
call conda activate xtts
start cmd /k python -m xtts_api_server
REM Start XTTS
echo %blue_bg%[%time%]%reset% %blue_fg_strong%[INFO]%reset% XTTS launched in a new window.
start cmd /k "title XTTSv2 API Server && cd /d %~dp0xtts && python -m xtts_api_server"
goto :home
@@ -684,7 +689,7 @@ REM Edit Extras Modules - Frontend
cls
echo %blue_fg_strong%/ Home / Toolbox / Edit Extras Modules%reset%
echo -------------------------------------
echo Choose extras modules to enable or disable (e.g., "1 2 4" to enable Coqui, RVC, and Caption)
echo Choose extras modules to enable or disable (e.g., "1 2 4" to enable XTTS, RVC, and Caption)
REM color 7
REM Display module options with colors based on their status
@@ -707,35 +712,35 @@ for %%i in (%module_choices%) do (
) else (
set "xtts_trigger=true"
)
set "python_command= xtts_api_server --gpu 0 --cuda-device=0"
REM set "python_command= xtts_api_server --gpu 0 --cuda-device=0"
) else if "%%i"=="2" (
if "%rvc_trigger%"=="true" (
set "rvc_trigger=false"
) else (
set "rvc_trigger=true"
)
set "python_command= --enable-modules=rvc --rvc-save-file --max-content-length=1000"
REM set "python_command= --enable-modules=rvc --rvc-save-file --max-content-length=1000"
) else if "%%i"=="3" (
if "%talkinghead_trigger%"=="true" (
set "talkinghead_trigger=false"
) else (
set "talkinghead_trigger=true"
)
set "python_command= --enable-modules=talkinghead"
REM set "python_command= --enable-modules=talkinghead"
) else if "%%i"=="4" (
if "%caption_trigger%"=="true" (
set "caption_trigger=false"
) else (
set "caption_trigger=true"
)
set "python_command= --enable-modules=caption"
REM set "python_command= --enable-modules=caption"
) else if "%%i"=="5" (
if "%summarize_trigger%"=="true" (
set "summarize_trigger=false"
) else (
set "summarize_trigger=true"
)
set "python_command= --enable-modules=summarize"
REM set "python_command= --enable-modules=summarize"
) else if "%%i"=="6" (
goto :toolbox
)
@@ -748,8 +753,45 @@ echo talkinghead_trigger=%talkinghead_trigger%>>"%~dp0modules.txt"
echo caption_trigger=%caption_trigger%>>"%~dp0modules.txt"
echo summarize_trigger=%summarize_trigger%>>"%~dp0modules.txt"
REM remove modules_enable
set "modules_enable="
REM Compile the Python command
set "python_command=start cmd /k python server.py"
if "%xtts_trigger%"=="true" (
set "python_command=%python_command% --gpu 0 --cuda-device=0"
)
if "%rvc_trigger%"=="true" (
set "python_command=%python_command% --rvc-save-file --max-content-length=1000"
set "modules_enable=%modules_enable%rvc,"
)
if "%talkinghead_trigger%"=="true" (
set "modules_enable=%modules_enable%talkinghead,"
)
if "%caption_trigger%"=="true" (
set "modules_enable=%modules_enable%caption,"
)
if "%summarize_trigger%"=="true" (
set "modules_enable=%modules_enable%summarize,"
)
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%"
) else (
set "python_command=%python_command%"
)
REM Save the constructed Python command to modules.txt for testing
echo start cmd /k python server.py %python_command%>>"%~dp0modules.txt"
echo %python_command%>>"%~dp0modules.txt"
REM echo start cmd /k python server.py %python_command%>>"%~dp0modules.txt"
REM Construct and execute the Python command
REM start cmd /k python server.py %python_command%

View File

@@ -162,7 +162,8 @@ home() {
echo "======== VERSION STATUS ========"
echo -e "SillyTavern branch: ${cyan_fg_strong}$current_branch${reset}"
echo -e "Update Status: $update_status"
echo -e "Sillytavern: $update_status"
echo -e "Launcher: V1.0.1"
echo "================================"
read -p "Choose Your Destiny: " home_choice
@@ -485,6 +486,132 @@ edit_environment() {
fi
}
# Function to print module options with color based on their status
printModule() {
if [ "$2" == "true" ]; then
echo -e "\e[32m$1 [Enabled]\e[0m"
else
echo -e "\e[31m$1 [Disabled]\e[0m"
fi
}
# Function to edit extras modules
edit_extras_modules() {
echo "SillyTavern [EDIT-MODULES]"
clear
echo -e "\e[34m/ Home / Toolbox / Edit Extras Modules\e[0m"
echo "-------------------------------------"
echo "Choose extras modules to enable or disable (e.g., '1 2 4' to enable XTTS, RVC, and Caption)"
echo
# Display module options with colors based on their status
printModule "1. XTTS (--gpu 0 --cuda-device=0)" "$xtts_trigger"
printModule "2. RVC (--enable-modules=rvc --rvc-save-file --max-content-length=1000)" "$rvc_trigger"
printModule "3. talkinghead (--enable-modules=talkinghead)" "$talkinghead_trigger"
printModule "4. caption (--enable-modules=caption)" "$caption_trigger"
printModule "5. summarize (--enable-modules=summarize)" "$summarize_trigger"
echo "6. Back to Toolbox"
python_command=""
read -p "Choose modules to enable/disable (1-5): " module_choices
# Handle the user's module choices and construct the Python command
for i in $module_choices; do
case $i in
1)
[ "$xtts_trigger" == "true" ] && xtts_trigger="false" || xtts_trigger="true"
# python_command="--gpu 0 --cuda-device=0"
;;
2)
[ "$rvc_trigger" == "true" ] && rvc_trigger="false" || rvc_trigger="true"
# python_command=" --enable-modules=rvc --rvc-save-file --max-content-length=1000"
;;
3)
[ "$talkinghead_trigger" == "true" ] && talkinghead_trigger="false" || talkinghead_trigger="true"
# python_command=" --enable-modules=talkinghead"
;;
4)
[ "$caption_trigger" == "true" ] && caption_trigger="false" || caption_trigger="true"
# python_command=" --enable-modules=caption"
;;
5)
[ "$summarize_trigger" == "true" ] && summarize_trigger="false" || summarize_trigger="true"
# python_command=" --enable-modules=summarize"
;;
6)
toolbox
;;
*)
;;
esac
done
}
# Initial module triggers
xtts_trigger="false"
rvc_trigger="false"
talkinghead_trigger="false"
caption_trigger="false"
summarize_trigger="false"
# Function to save the module flags to modules.txt
saveModuleFlags() {
echo "xtts_trigger=$xtts_trigger" > "$PWD/modules.txt"
echo "rvc_trigger=$rvc_trigger" >> "$PWD/modules.txt"
echo "talkinghead_trigger=$talkinghead_trigger" >> "$PWD/modules.txt"
echo "caption_trigger=$caption_trigger" >> "$PWD/modules.txt"
echo "summarize_trigger=$summarize_trigger" >> "$PWD/modules.txt"
}
# Function to compile the Python command
compilePythonCommand() {
modules_enable=""
python_command="start cmd /k python server.py"
if [ "$xtts_trigger" == "true" ]; then
python_command="$python_command --gpu 0 --cuda-device=0"
fi
if [ "$rvc_trigger" == "true" ]; then
python_command="$python_command --rvc-save-file --max-content-length=1000"
modules_enable="$modules_enable rvc,"
fi
if [ "$talkinghead_trigger" == "true" ]; then
modules_enable="$modules_enable talkinghead,"
fi
if [ "$caption_trigger" == "true" ]; then
modules_enable="$modules_enable caption,"
fi
if [ "$summarize_trigger" == "true" ]; then
modules_enable="$modules_enable summarize,"
fi
# Remove the last comma
if [ -n "$modules_enable" ]; then
modules_enable="${modules_enable%,}"
fi
# Check if modules_enable is not empty
if [ -n "$modules_enable" ]; then
python_command="$python_command --enable-modules=$modules_enable"
fi
# Save the constructed Python command to modules.txt for testing
echo "$python_command" >> "$PWD/modules.txt"
}
# Call the saveModuleFlags function
saveModuleFlags
# Call the compilePythonCommand function
compilePythonCommand
# Function to reinstall SillyTavern
reinstall_sillytavern() {
local script_name=$(basename "$0")