999 웹 화면 바로 열기 추가, ComfyUI 안내 개선

- 모든 메뉴 맨 아래 '999 웹 화면 바로 열기' (검색창·번호 입력에서 999)
- Open WebUI·ComfyUI 버전을 골라 브라우저로 열기, 꺼져 있으면 켠 뒤 열기
- ComfyUI 미설치·그림 모델 없음일 때 바로 설치·다운로드 제안

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K3UWnbHEdCxxWhyNx7Cpd2
This commit is contained in:
2026-10-28 03:57:06 +00:00
parent ead7f16744
commit 8243a2754e
3 changed files with 297 additions and 9 deletions

View File

@@ -366,7 +366,7 @@ status_block() {
monitor_print
}
menu_select() {
menu_select_core() {
local header="$1" preview="$2" height="${3:-100%}" action="$4"
MENU_RESULT=""
MENU_ACTION=""
@@ -424,10 +424,12 @@ menu_select() {
echo -e "$label"
continue
fi
[ "$key" = "__999" ] && continue # 999 바로 열기는 번호를 따로 붙여 맨 아래에 표시
idx=$((idx + 1))
keys+=("$key")
echo -e "${idx}. ${label}"
done
[ "$MENU_QUICK" = "1" ] && echo -e "999. ▶ 웹 화면 바로 열기 ${GRAY}(Open WebUI · ComfyUI)${RESET}"
echo -e "${BLUE}--------------------------------------------------${RESET}"
local sel
restore_tty
@@ -446,6 +448,10 @@ menu_select() {
case "$sel" in
''|*[!0-9]*) return 1 ;;
esac
if [ "$MENU_QUICK" = "1" ] && [ "$sel" = "999" ]; then
MENU_RESULT="__999"
return 0
fi
if [ "$sel" -lt 1 ] || [ "$sel" -gt "$idx" ]; then
return 1
fi
@@ -453,6 +459,38 @@ menu_select() {
return 0
}
# 메뉴 표시 (모든 메뉴 공통 입구): menu_select <머리말> [미리보기 명령] [높이] [방식]
# 전체 화면 메뉴에는 맨 아래에 '999 웹 화면 바로 열기'를 붙이고, 그것을 고르면
# (검색창에 999 입력 후 Enter, 번호 입력 방식에서는 999) 바로 열기 창을 띄운 뒤 원래 메뉴로 돌아옴.
# 반환값·MENU_RESULT·MENU_ACTION은 menu_select_core와 같음.
MENU_QUICK=0
IN_QUICK_OPEN=0
menu_select() {
local height="${3:-100%}" action="$4" rc saved
if [ "$STATUS_IN_MENUS" != "1" ] || [ "$height" != "100%" ] || [ "$action" = "confirm" ] || [ "$IN_QUICK_OPEN" = "1" ]; then
menu_select_core "$@"
return $?
fi
saved=("${MENU_ITEMS[@]}")
while true; do
MENU_ITEMS=("${saved[@]}")
add_item "__999" "${YELLOW}999${RESET} ▶ 웹 화면 바로 열기 ${GRAY}(Open WebUI · ComfyUI)${RESET}"
MENU_QUICK=1
menu_select_core "$@"
rc=$?
MENU_QUICK=0
if [ $rc -eq 0 ] && [ "$MENU_RESULT" = "__999" ]; then
# 바로 열기 창이 ComfyUI 버전 정보(CI_*)를 바꾸므로, 부른 메뉴가 쓰던 버전을 되돌림
local keep_ci="$CI_NAME"
quick_open
[ -n "$keep_ci" ] && comfy_load "$keep_ci"
continue
fi
MENU_ITEMS=("${saved[@]}")
return $rc
done
}
# 예/아니오 확인 (예 0, 아니오·취소 1)
confirm() {
local question="$1"
@@ -932,6 +970,14 @@ print_preview() {
local key="$1"
case "$key" in
-|"") return ;;
__999)
echo -e "${CYAN}999 · 웹 화면 바로 열기${RESET}"
echo
echo "Open WebUI와 설치된 ComfyUI 버전 중 하나를 골라 브라우저로 엽니다."
echo "꺼져 있으면 먼저 켠 뒤 엽니다."
echo
echo "어느 메뉴에서나 검색창에 999를 입력하고 Enter를 누르면 됩니다."
return ;;
back)
echo -e "${GRAY}Enter를 누르면 이전 메뉴로 돌아갑니다.${RESET}"; return ;;
interactive)
@@ -3856,12 +3902,34 @@ webui_comfy_link() {
echo -e "${GRAY}※ WebUI 관리자 설정 → 이미지 화면에서 직접 저장한 적이 있으면 그 값이 우선합니다. 그때는 그 화면에서 엔진 ComfyUI, 주소 http://${CI_HOST}:8188 로 맞춰 주세요.${RESET}"
}
# 최신 안정판 바로 설치 (버전 목록을 못 가져오면 고르기 창) → 성공하면 CI_* 가 새 버전
comfy_install_quick() {
local latest
latest=$(comfy_releases | head -n 1 | cut -d'|' -f1)
if [ -n "$latest" ]; then comfy_install "$latest"; else comfy_install; fi
}
# 그림 모델이 없을 때 ⭐ 추천 모델(DreamShaper 8 LCM)을 바로 받기 (받았으면 0)
comfy_starter_model() {
comfy_catalog_load "DreamShaper8_LCM.safetensors" || return 1
if ! confirm "⭐ ${CM_NAME} (${CM_SIZE}GB, CPU 추천)을 지금 받을까요?"; then
echo -e "${GRAY}'ComfyUI → 그림 모델 다운로드'에서 다른 모델을 받을 수도 있습니다.${RESET}"
return 1
fi
comfy_download "$CM_URL" "$COMFY_MODELS/$CM_TYPE/$CM_FILE"
}
comfy_link_flow() {
local n cnt files f star note
ensure_podman || return 1
ensure_machine || return 1
cnt=$(comfy_count)
[ "$cnt" -gt 0 ] || { echo -e "${YELLOW}먼저 ComfyUI 버전을 설치해 주세요.${RESET}"; return 1; }
if [ "$cnt" -eq 0 ]; then
echo -e "${YELLOW}아직 설치된 ComfyUI 버전이 없습니다.${RESET}"
confirm "ComfyUI 최신 안정판을 지금 설치할까요? (처음에는 5~15분 걸립니다)" || return 0
comfy_install_quick || return 1
cnt=$(comfy_count)
fi
n=$(comfy_names | head -n 1)
if [ "$cnt" -gt 1 ]; then
menu_reset
@@ -3872,7 +3940,12 @@ comfy_link_flow() {
n="$MENU_RESULT"
fi
files=$(ls -1 "$COMFY_MODELS/checkpoints" 2>/dev/null | grep -E '\.(safetensors|ckpt|sft)$')
[ -n "$files" ] || { echo -e "${YELLOW}그림 모델이 없습니다. 'ComfyUI → 그림 모델 다운로드'에서 ⭐ 모델을 먼저 받아 주세요.${RESET}"; return 1; }
if [ -z "$files" ]; then
echo -e "${YELLOW}그림 모델이 아직 없습니다.${RESET}"
comfy_starter_model || return 0
files=$(ls -1 "$COMFY_MODELS/checkpoints" 2>/dev/null | grep -E '\.(safetensors|ckpt|sft)$')
[ -n "$files" ] || return 1
fi
menu_reset
while IFS= read -r f; do
note="${GRAY}(목록 밖 모델: 512x512 · 20단계 기본값)${RESET}"
@@ -3901,7 +3974,12 @@ comfy_test_generate() {
local files f body resp res id st t0 el w h steps
comfy_stats "$CI_PORT" 3 || { echo -e "${YELLOW}ComfyUI ${CI_NAME}이 응답하지 않습니다. 먼저 기동해 주세요.${RESET}"; return 1; }
files=$(ls -1 "$COMFY_MODELS/checkpoints" 2>/dev/null | grep -E '\.(safetensors|ckpt|sft)$')
[ -n "$files" ] || { echo -e "${YELLOW}그림 모델이 없습니다. 먼저 '그림 모델 다운로드'에서 받아 주세요.${RESET}"; return 1; }
if [ -z "$files" ]; then
echo -e "${YELLOW}그림 모델이 아직 없습니다.${RESET}"
comfy_starter_model || return 0
files=$(ls -1 "$COMFY_MODELS/checkpoints" 2>/dev/null | grep -E '\.(safetensors|ckpt|sft)$')
[ -n "$files" ] || return 1
fi
menu_reset
while IFS= read -r f; do add_item "$f" " $f"; done <<< "$files"
add_item "back" "${GRAY}← 취소${RESET}"
@@ -4204,6 +4282,81 @@ stack_menu() {
done
}
# --------------------------------------------------
# 999 웹 화면 바로 열기 (어느 메뉴에서나)
# --------------------------------------------------
quick_open() {
local n st wst cst sel pod_on=0 code
IN_QUICK_OPEN=1
while true; do
if has_podman; then machine_info; [ "$MC_STATE" = "running" ] && pod_on=1; fi
menu_reset
add_item "-" "${CYAN}──────── Open WebUI (대화) ────────${RESET}"
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 2 "http://127.0.0.1:${WEBUI_PORT}/health" 2>/dev/null)
wst="${GRAY}[꺼짐 → 켠 뒤 열기]${RESET}"; [ "$code" = "200" ] && wst="${GREEN}[실행 중]${RESET}"
add_item "webui" " Open WebUI http://localhost:${WEBUI_PORT} ${wst}"
add_item "-" "${CYAN}──────── ComfyUI (그림 생성) ────────${RESET}"
if [ "$(comfy_count)" -eq 0 ]; then
add_item "c_install" " + ComfyUI 설치 후 열기 ${GRAY}(최신 안정판, 처음에는 5~15분)${RESET}"
else
COMFY_STATES=""
[ $pod_on -eq 1 ] && comfy_refresh_states
while IFS= read -r n; do
[ -n "$n" ] || continue
comfy_load "$n" || continue
st=$(comfy_state_of "$CI_CONT")
cst="${GRAY}[꺼짐 → 켠 뒤 열기]${RESET}"; [ "$st" = "running" ] && cst="${GREEN}[실행 중]${RESET}"
add_item "c:$n" " ComfyUI ${n} http://localhost:${CI_PORT} ${cst}"
done <<< "$(comfy_names)"
fi
add_item "back" "${GRAY}← 원래 메뉴로 돌아가기${RESET}"
if ! menu_select_core "${BLUE}${BOLD}999 · 웹 화면 바로 열기${RESET} ${GRAY}고르면 브라우저로 엽니다 (꺼져 있으면 먼저 켭니다)${RESET}"$'\n'"${KEY_HELP}"; then
IN_QUICK_OPEN=0; return
fi
sel="$MENU_RESULT"
[ "$sel" = "back" ] && { IN_QUICK_OPEN=0; return; }
[ "$sel" = "-" ] && continue
clear
case "$sel" in
webui)
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 2 "http://127.0.0.1:${WEBUI_PORT}/health" 2>/dev/null)
if [ "$code" != "200" ]; then
echo -e "${CYAN}Open WebUI가 꺼져 있어 먼저 켭니다...${RESET}"
webui_start
fi
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 3 "http://127.0.0.1:${WEBUI_PORT}/health" 2>/dev/null)
if [ "$code" = "200" ]; then
open "http://localhost:${WEBUI_PORT}"
echo -e "${GREEN}\n✅ 브라우저로 열었습니다: http://localhost:${WEBUI_PORT}${RESET}"
webui_print_urls
else
echo -e "${RED}❌ Open WebUI가 응답하지 않아 열지 못했습니다.${RESET}"
fi ;;
c_install|c:*)
if [ "$sel" = "c_install" ]; then
comfy_install_quick || { pause_return; IN_QUICK_OPEN=0; return; }
else
comfy_load "${sel#c:}"
if ! comfy_stats "$CI_PORT" 2; then
echo -e "${CYAN}ComfyUI ${CI_NAME}이 꺼져 있어 먼저 켭니다...${RESET}"
comfy_start
comfy_load "${sel#c:}"
fi
fi
if comfy_stats "$CI_PORT" 2; then
open "http://localhost:${CI_PORT}"
echo -e "${GREEN}\n✅ 브라우저로 열었습니다: http://localhost:${CI_PORT}${RESET}"
comfy_print_urls
else
echo -e "${RED}❌ ComfyUI ${CI_NAME}이 응답하지 않아 열지 못했습니다.${RESET}"
fi ;;
esac
pause_return
IN_QUICK_OPEN=0
return
done
}
# --------------------------------------------------
# 모델 저장 위치 (Ollama 대화 모델 · ComfyUI 그림 모델) 표시·변경
# - Ollama: 설정 파일(캐시 폴더/ollama_models_dir)에 저장, 스크립트가 켜는 서버와