Skip to content

Commit

Permalink
add restore launch args bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
licyk committed Jun 27, 2024
1 parent 2a38e3c commit b39fa47
Show file tree
Hide file tree
Showing 11 changed files with 325 additions and 60 deletions.
41 changes: 36 additions & 5 deletions modules/a1111_sd_webui_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,7 @@ a1111_sd_webui_launch()
{
local a1111_sd_webui_launch_dialog

if [ ! -f "$start_path/term-sd/config/sd-webui-launch.conf" ]; then # 找不到启动配置时默认生成一个
term_sd_echo "未找到启动配置文件, 创建中"
echo "launch.py --theme dark --autolaunch --xformers --api --skip-load-model-at-start" > "$start_path"/term-sd/config/sd-webui-launch.conf
fi
add_a1111_sd_webui_normal_launch_args

while true
do
Expand All @@ -312,8 +309,9 @@ a1111_sd_webui_launch()
"1" "> 启动" \
"2" "> 配置预设启动参数" \
"3" "> 修改自定义启动参数" \
"4" "> 重置启动参数" \
3>&1 1>&2 2>&3)

case $a1111_sd_webui_launch_dialog in
1)
term_sd_launch
Expand All @@ -324,6 +322,9 @@ a1111_sd_webui_launch()
3)
a1111_sd_webui_launch_args_revise
;;
4)
restore_a1111_sd_webui_launch_args
;;
*)
break
;;
Expand Down Expand Up @@ -352,3 +353,33 @@ a1111_sd_webui_launch_args_revise()
term_sd_echo "取消启动参数修改"
fi
}

# 添加默认启动参数配置
add_a1111_sd_webui_normal_launch_args()
{
if [ ! -f "$start_path/term-sd/config/sd-webui-launch.conf" ]; then # 找不到启动配置时默认生成一个
if [ "$OSTYPE" = "darwin"* ];then
echo "launch.py --theme dark --autolaunch --api --skip-load-model-at-start --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate" > "$start_path"/term-sd/config/sd-webui-launch.conf
else
echo "launch.py --theme dark --autolaunch --xformers --api --skip-load-model-at-start" > "$start_path"/term-sd/config/sd-webui-launch.conf
fi
fi
}

# 重置启动参数
restore_a1111_sd_webui_launch_args()
{
if (dialog --erase-on-exit \
--title "Stable-Diffusion-WebUI 管理" \
--backtitle "Stable-Diffusion-WebUI 重置启动参数选项选项" \
--yes-label "" --no-label "" \
--yesno "是否重置 Stable-Diffusion-WebUI 启动参数" \
$term_sd_dialog_height $term_sd_dialog_width) then

term_sd_echo "重置启动参数"
rm -f "$start_path"/term-sd/config/sd-webui-launch.conf
add_a1111_sd_webui_normal_launch_args
else
term_sd_echo "取消重置操作"
fi
}
35 changes: 31 additions & 4 deletions modules/comfyui_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ comfyui_launch()
{
local comfyui_launch_dialog

if [ ! -f ""$start_path"/term-sd/config/comfyui-launch.conf" ]; then # 找不到启动配置时默认生成一个
term_sd_echo "未找到启动配置文件, 创建中"
echo "main.py --auto-launch" > "$start_path"/term-sd/config/comfyui-launch.conf
fi
add_comfyui_normal_launch_args

while true
do
Expand All @@ -184,6 +181,7 @@ comfyui_launch()
"1" "> 启动" \
"2" "> 配置预设启动参数" \
"3" "> 修改自定义启动参数" \
"4" "> 重置启动参数" \
3>&1 1>&2 2>&3)

case $comfyui_launch_dialog in
Expand All @@ -196,6 +194,9 @@ comfyui_launch()
3)
comfyui_launch_args_revise
;;
4)
restore_comfyui_launch_args
;;
*)
break
;;
Expand Down Expand Up @@ -223,4 +224,30 @@ comfyui_launch_args_revise()
else
term_sd_echo "取消启动参数修改"
fi
}

# 添加默认启动参数配置
add_comfyui_normal_launch_args()
{
if [ ! -f ""$start_path"/term-sd/config/comfyui-launch.conf" ]; then # 找不到启动配置时默认生成一个
echo "main.py --auto-launch" > "$start_path"/term-sd/config/comfyui-launch.conf
fi
}

# 重置启动参数
restore_comfyui_launch_args()
{
if (dialog --erase-on-exit \
--title "ComfyUI 管理" \
--backtitle "ComfyUI 重置启动参数选项选项" \
--yes-label "" --no-label "" \
--yesno "是否重置 ComfyUI 启动参数" \
$term_sd_dialog_height $term_sd_dialog_width) then

term_sd_echo "重置启动参数"
rm -f "$start_path"/term-sd/config/comfyui-launch.conf
add_comfyui_normal_launch_args
else
term_sd_echo "取消重置操作"
fi
}
35 changes: 31 additions & 4 deletions modules/fooocus_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,7 @@ fooocus_launch()
{
local fooocus_launch_dialog

if [ ! -f "$start_path/term-sd/config/fooocus-launch.conf" ]; then # 找不到启动配置时默认生成一个
term_sd_echo "未找到启动配置文件, 创建中"
echo "launch.py --language zh --preset term_sd" > "$start_path"/term-sd/config/fooocus-launch.conf
fi
add_fooocus_normal_launch_args

while true
do
Expand All @@ -247,6 +244,7 @@ fooocus_launch()
"1" "> 启动" \
"2" "> 配置预设启动参数" \
"3" "> 修改自定义启动参数" \
"4" "> 重置启动参数"
3>&1 1>&2 2>&3)

case $fooocus_launch_dialog in
Expand All @@ -259,6 +257,9 @@ fooocus_launch()
3)
fooocus_manual_launch
;;
4)
restore_fooocus_launch_args
;;
*)
break
;;
Expand Down Expand Up @@ -286,4 +287,30 @@ fooocus_manual_launch()
else
term_sd_echo "取消启动参数修改"
fi
}

# 添加默认启动参数配置
add_fooocus_normal_launch_args()
{
if [ ! -f "$start_path/term-sd/config/fooocus-launch.conf" ]; then # 找不到启动配置时默认生成一个
echo "launch.py --language zh --preset term_sd" > "$start_path"/term-sd/config/fooocus-launch.conf
fi
}

# 重置启动参数
restore_fooocus_launch_args()
{
if (dialog --erase-on-exit \
--title "Fooocus 管理" \
--backtitle "Fooocus 重置启动参数选项选项" \
--yes-label "" --no-label "" \
--yesno "是否重置 Fooocus 启动参数" \
$term_sd_dialog_height $term_sd_dialog_width) then

term_sd_echo "重置启动参数"
rm -f "$start_path"/term-sd/config/fooocus-launch.conf
add_fooocus_normal_launch_args
else
term_sd_echo "取消重置操作"
fi
}
43 changes: 36 additions & 7 deletions modules/invokeai_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
# 参考: https://invoke-ai.github.io/InvokeAI/features/UTILITIES
invokeai_launch()
{
if [ ! -f ""$start_path"/term-sd/config/invokeai-launch.conf" ]; then # 找不到启动配置时默认生成一个
term_sd_echo "未找到启动配置文件, 创建中"
echo "" > "$start_path"/term-sd/config/invokeai-launch.conf
fi
local invokeai_launch_dialog

add_invokeai_normal_launch_args

while true
do
Expand All @@ -21,8 +20,9 @@ invokeai_launch()
"1" "> (invokeai-web) 启动 WebUI 界面" \
"2" "> 配置预设启动参数" \
"3" "> 修改自定义启动参数" \
"4" "> (import-images) 启动图库导入界面" \
"5" "> (db-maintenance) 启动数据库修复" \
"4" "> 重置启动参数" \
"5" "> (import-images) 启动图库导入界面" \
"6" "> (db-maintenance) 启动数据库修复" \
3>&1 1>&2 2>&3)

case $invokeai_launch_dialog in
Expand All @@ -36,11 +36,14 @@ invokeai_launch()
invokeai_manual_launch
;;
4)
restore_invokeai_launch_args
;;
5)
term_sd_print_line "$term_sd_manager_info 启动"
invokeai-import-images --root "$invokeai_path"/invokeai
term_sd_pause
;;
5)
6)
term_sd_print_line "$term_sd_manager_info 启动"
invokeai-db-maintenance --operation all --root "$invokeai_path"/invokeai
term_sd_pause
Expand Down Expand Up @@ -162,3 +165,29 @@ invokeai_manual_launch()
term_sd_echo "取消启动参数修改"
fi
}

# 添加默认启动参数配置
add_invokeai_normal_launch_args()
{
if [ ! -f ""$start_path"/term-sd/config/invokeai-launch.conf" ]; then # 找不到启动配置时默认生成一个
echo "" > "$start_path"/term-sd/config/invokeai-launch.conf
fi
}

# 重置启动参数
restore_invokeai_launch_args()
{
if (dialog --erase-on-exit \
--title "InvokeAI 管理" \
--backtitle "InvokeAI 重置启动参数选项选项" \
--yes-label "" --no-label "" \
--yesno "是否重置 InvokeAI 启动参数" \
$term_sd_dialog_height $term_sd_dialog_width) then

term_sd_echo "重置启动参数"
rm -f "$start_path"/term-sd/config/invokeai-launch.conf
add_invokeai_normal_launch_args
else
term_sd_echo "取消重置操作"
fi
}
35 changes: 31 additions & 4 deletions modules/kohya_ss_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ kohya_ss_launch()
{
local kohya_ss_launch_dialog

if [ ! -f ""$start_path"/term-sd/config/kohya_ss-launch.conf" ]; then # 找不到启动配置时默认生成一个
term_sd_echo "未找到启动配置文件,创建中"
echo "kohya_gui.py --inbrowser --language zh-CN" > "$start_path"/term-sd/config/kohya_ss-launch.conf
fi
add_kohya_ss_normal_launch_args

while true
do
Expand All @@ -72,6 +69,7 @@ kohya_ss_launch()
"1" "> 启动" \
"2" "> 配置预设启动参数" \
"3" "> 修改自定义启动参数" \
"4" "> 重置启动参数" \
3>&1 1>&2 2>&3)

case $kohya_ss_launch_dialog in
Expand All @@ -84,6 +82,9 @@ kohya_ss_launch()
3)
kohya_ss_launch_args_revise
;;
4)
restore_kohya_ss_launch_args
;;
*)
break
;;
Expand Down Expand Up @@ -111,4 +112,30 @@ kohya_ss_launch_args_revise()
else
term_sd_echo "取消启动参数修改"
fi
}

# 添加默认启动参数配置
add_kohya_ss_normal_launch_args()
{
if [ ! -f ""$start_path"/term-sd/config/kohya_ss-launch.conf" ]; then # 找不到启动配置时默认生成一个
echo "kohya_gui.py --inbrowser --language zh-CN" > "$start_path"/term-sd/config/kohya_ss-launch.conf
fi
}

# 重置启动参数
restore_kohya_ss_launch_args()
{
if (dialog --erase-on-exit \
--title "kohya_ss 管理" \
--backtitle "kohya_ss 重置启动参数选项选项" \
--yes-label "" --no-label "" \
--yesno "是否重置 kohya_ss 启动参数" \
$term_sd_dialog_height $term_sd_dialog_width) then

term_sd_echo "重置启动参数"
rm -f "$start_path"/term-sd/config/kohya_ss-launch.conf
add_kohya_ss_normal_launch_args
else
term_sd_echo "取消重置操作"
fi
}
35 changes: 31 additions & 4 deletions modules/lora_scripts_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ lora_scripts_launch()
{
local lora_scripts_launch_dialog

if [ ! -f ""$start_path"/term-sd/config/lora-scripts-launch.conf" ]; then # 找不到启动配置时默认生成一个
term_sd_echo "未找到启动配置文件, 创建中"
echo "gui.py" > "$start_path"/term-sd/config/lora-scripts-launch.conf
fi
add_lora_scripts_normal_launch_args

while true
do
Expand All @@ -72,6 +69,7 @@ lora_scripts_launch()
"1" "> 启动" \
"2" "> 配置预设启动参数" \
"3" "> 修改自定义启动参数" \
"4" "> 重置启动参数" \
3>&1 1>&2 2>&3)

case $lora_scripts_launch_dialog in
Expand All @@ -84,6 +82,9 @@ lora_scripts_launch()
3)
lora_scripts_launch_args_revise
;;
4)
restore_lora_scripts_launch_args
;;
*)
break
;;
Expand Down Expand Up @@ -111,4 +112,30 @@ lora_scripts_launch_args_revise()
else
term_sd_echo "取消启动参数修改"
fi
}

# 添加默认启动参数配置
add_lora_scripts_normal_launch_args()
{
if [ ! -f ""$start_path"/term-sd/config/lora-scripts-launch.conf" ]; then # 找不到启动配置时默认生成一个
echo "gui.py" > "$start_path"/term-sd/config/lora-scripts-launch.conf
fi
}

# 重置启动参数
restore_lora_scripts_launch_args()
{
if (dialog --erase-on-exit \
--title "lora-scripts 管理" \
--backtitle "lora-scripts 重置启动参数选项选项" \
--yes-label "" --no-label "" \
--yesno "是否重置 lora-scripts 启动参数" \
$term_sd_dialog_height $term_sd_dialog_width) then

term_sd_echo "重置启动参数"
rm -f "$start_path"/term-sd/config/lora-scripts-launch.conf
add_lora_scripts_normal_launch_args
else
term_sd_echo "取消重置操作"
fi
}
Loading

0 comments on commit b39fa47

Please sign in to comment.