feat(installer): remove dialog references in the launcher

The launcher isn't well served by the additional complexity of two different UIs.
This commit is contained in:
psychedelicious 2024-03-25 17:14:02 +11:00
parent c856fab7d1
commit 8205c56c8a

View File

@ -25,22 +25,6 @@ cd "$scriptdir"
export INVOKEAI_ROOT="$scriptdir" export INVOKEAI_ROOT="$scriptdir"
PARAMS=$@ PARAMS=$@
# Check to see if dialog is installed (it seems to be fairly standard, but good to check regardless) and if the user has passed the --no-tui argument to disable the dialog TUI
tui=true
if command -v dialog &>/dev/null; then
# This must use $@ to properly loop through the arguments passed by the user
for arg in "$@"; do
if [ "$arg" == "--no-tui" ]; then
tui=false
# Remove the --no-tui argument to avoid errors later on when passing arguments to InvokeAI
PARAMS=$(echo "$PARAMS" | sed 's/--no-tui//')
break
fi
done
else
tui=false
fi
# Set required env var for torch on mac MPS # Set required env var for torch on mac MPS
if [ "$(uname -s)" == "Darwin" ]; then if [ "$(uname -s)" == "Darwin" ]; then
export PYTORCH_ENABLE_MPS_FALLBACK=1 export PYTORCH_ENABLE_MPS_FALLBACK=1
@ -89,36 +73,9 @@ do_choice() {
clear clear
} }
# Dialog-based TUI for launcing Invoke functions
do_dialog() {
options=(
1 "Generate images with a browser-based interface"
2 "Open the developer console"
3 "Update InvokeAI (DEPRECATED - please use the installer)"
4 "Run the InvokeAI image database maintenance script"
5 "Command-line help"
)
choice=$(dialog --clear \
--backtitle "\Zb\Zu\Z3InvokeAI" \
--colors \
--title "What would you like to do?" \
--ok-label "Run" \
--cancel-label "Exit" \
--help-button \
--help-label "CLI Help" \
--menu "Select an option:" \
0 0 0 \
"${options[@]}" \
2>&1 >/dev/tty) || clear
do_choice "$choice"
clear
}
# Command-line interface for launching Invoke functions # Command-line interface for launching Invoke functions
do_line_input() { do_line_input() {
clear clear
printf " ** For a more attractive experience, please install the 'dialog' utility using your package manager. **\n\n"
printf "What would you like to do?\n" printf "What would you like to do?\n"
printf "1: Generate images using the browser-based interface\n" printf "1: Generate images using the browser-based interface\n"
printf "2: Open the developer console\n" printf "2: Open the developer console\n"
@ -132,16 +89,10 @@ do_line_input() {
clear clear
} }
# Main IF statement for launching Invoke with either the TUI or CLI, and for checking if the user is in the developer console # Main IF statement for launching Invoke, and for checking if the user is in the developer console
if [ "$0" != "bash" ]; then if [ "$0" != "bash" ]; then
while true; do while true; do
if $tui; then do_line_input
# .dialogrc must be located in the same directory as the invoke.sh script
export DIALOGRC="./.dialogrc"
do_dialog
else
do_line_input
fi
done done
else # in developer console else # in developer console
python --version python --version