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:
@@ -519,7 +519,7 @@ function New-SepItem([string]$Label, [string]$Name) {
|
||||
# -ActionKey : → 키로 고르면 $script:MenuAction = 'right' (Enter면 '')
|
||||
# -NoLeftBack : ← 키를 눌러도 아무 동작 안 함 (메인 메뉴용)
|
||||
# -NoRightKey : → 키로 선택하지 않음 (예/아니오 확인창에서 실수로 '예'가 되지 않도록)
|
||||
function Show-Menu {
|
||||
function Show-MenuCore {
|
||||
param(
|
||||
[string]$Header,
|
||||
[object[]]$Items,
|
||||
@@ -528,7 +528,8 @@ function Show-Menu {
|
||||
[switch]$ActionKey,
|
||||
[switch]$NoLeftBack,
|
||||
[switch]$NoRightKey,
|
||||
[switch]$NoMonitor
|
||||
[switch]$NoMonitor,
|
||||
[switch]$Quick
|
||||
)
|
||||
$script:MenuAction = ''
|
||||
|
||||
@@ -607,10 +608,12 @@ function Show-Menu {
|
||||
$idx = 0
|
||||
foreach ($it in $Items) {
|
||||
if ($it.Id -eq '-') { Write-C $it.Label; continue }
|
||||
if ($it.Id -eq '__999') { continue } # 999 바로 열기는 번호를 따로 붙여 맨 아래에 표시
|
||||
$idx++
|
||||
$ids += $it.Id
|
||||
Write-C "$idx. $($it.Label)"
|
||||
}
|
||||
if ($Quick) { Write-C "999. ▶ 웹 화면 바로 열기 ${GRAY}(Open WebUI · ComfyUI)${RESET}" }
|
||||
Write-C "${BLUE}--------------------------------------------------${RESET}"
|
||||
if ($ActionKey) {
|
||||
$sel = Read-Host '번호를 입력하세요 (번호 뒤에 > 를 붙이면 작업 메뉴(삭제 등), 예: 3> · 엔터만 누르면 취소)'
|
||||
@@ -620,10 +623,41 @@ function Show-Menu {
|
||||
}
|
||||
$n = 0
|
||||
if (-not [int]::TryParse($sel, [ref]$n)) { $script:MenuAction = ''; return $null }
|
||||
if ($Quick -and $n -eq 999) { return '__999' }
|
||||
if ($n -lt 1 -or $n -gt $idx) { return $null }
|
||||
return $ids[$n - 1]
|
||||
}
|
||||
|
||||
# 메뉴 표시 (모든 메뉴 공통 입구)
|
||||
# 전체 화면 메뉴에는 맨 아래에 '999 웹 화면 바로 열기'를 붙이고,
|
||||
# 그것을 고르거나(검색창에 999 입력 후 Enter, 번호 입력 방식에서는 999) 고르면
|
||||
# 바로 열기 창을 띄운 뒤 원래 메뉴로 돌아옴. 반환값은 Show-MenuCore와 같음.
|
||||
# -NoQuick: 999 항목을 붙이지 않음
|
||||
function Show-Menu {
|
||||
param(
|
||||
[string]$Header,
|
||||
[object[]]$Items,
|
||||
[switch]$Preview,
|
||||
[string]$Height = '100%',
|
||||
[switch]$ActionKey,
|
||||
[switch]$NoLeftBack,
|
||||
[switch]$NoRightKey,
|
||||
[switch]$NoMonitor,
|
||||
[switch]$NoQuick
|
||||
)
|
||||
$quick = (-not $NoQuick) -and (-not $script:InQuickOpen) -and $script:StatusInMenus -and ($Height -eq '100%')
|
||||
while ($true) {
|
||||
$its = @($Items)
|
||||
if ($quick) {
|
||||
$pv = New-PreviewFile '__quick999' "${CYAN}999 · 웹 화면 바로 열기${RESET}`n`nOpen WebUI와 설치된 ComfyUI 버전 중 하나를 골라 브라우저로 엽니다.`n꺼져 있으면 먼저 켠 뒤 엽니다.`n`n어느 메뉴에서나 검색창에 999를 입력하고 Enter를 누르면 됩니다."
|
||||
$its += New-MenuItem '__999' "${YELLOW}999${RESET} ▶ 웹 화면 바로 열기 ${GRAY}(Open WebUI · ComfyUI)${RESET}" $pv
|
||||
}
|
||||
$r = Show-MenuCore -Header $Header -Items $its -Preview:$Preview -Height $Height -ActionKey:$ActionKey -NoLeftBack:$NoLeftBack -NoRightKey:$NoRightKey -NoMonitor:$NoMonitor -Quick:$quick
|
||||
if ($r -ne '__999') { return $r }
|
||||
Invoke-QuickOpen
|
||||
}
|
||||
}
|
||||
|
||||
# 예/아니오 확인
|
||||
function Confirm-Choice([string]$Question) {
|
||||
if ($script:UseFzf) {
|
||||
@@ -4074,11 +4108,34 @@ function Test-WebuiComfyConnection($Inst) {
|
||||
return $false
|
||||
}
|
||||
|
||||
# 최신 안정판 바로 설치 (버전 목록을 못 가져오면 고르기 창) → 인스턴스 / $null
|
||||
function Install-ComfyQuick {
|
||||
$rel = @(Get-ComfyReleases)
|
||||
if ($rel.Count -gt 0) { return (Install-ComfyVersion (($rel[0] -split '\|')[0])) }
|
||||
return (Install-ComfyVersion)
|
||||
}
|
||||
|
||||
# 그림 모델이 없을 때 ⭐ 추천 모델(DreamShaper 8 LCM)을 바로 받기 → 받았으면 $true
|
||||
function Get-ComfyStarterModel {
|
||||
$m = Get-ComfyCatalog | Where-Object { $_.File -eq 'DreamShaper8_LCM.safetensors' } | Select-Object -First 1
|
||||
if (-not (Confirm-Choice "⭐ $($m.Name) ($($m.SizeGB)GB, CPU 추천)을 지금 받을까요?")) {
|
||||
Write-C "${GRAY}'ComfyUI → 그림 모델 다운로드'에서 다른 모델을 받을 수도 있습니다.${RESET}"
|
||||
return $false
|
||||
}
|
||||
return (Invoke-ComfyDownload $m.Url (Get-ComfyModelPath $m))
|
||||
}
|
||||
|
||||
function Invoke-WebuiComfyLinkFlow {
|
||||
if (-not (Confirm-Podman)) { return }
|
||||
if (-not (Confirm-PodmanMachine)) { return }
|
||||
$list = @(Get-ComfyInstances)
|
||||
if ($list.Count -eq 0) { Write-C "${YELLOW}먼저 ComfyUI 버전을 설치해 주세요.${RESET}"; return }
|
||||
if ($list.Count -eq 0) {
|
||||
Write-C "${YELLOW}아직 설치된 ComfyUI 버전이 없습니다.${RESET}"
|
||||
if (-not (Confirm-Choice 'ComfyUI 최신 안정판을 지금 설치할까요? (처음에는 5~15분 걸립니다)')) { return }
|
||||
$newInst = Install-ComfyQuick
|
||||
if (-not $newInst) { return }
|
||||
$list = @(Get-ComfyInstances)
|
||||
}
|
||||
$inst = $list[0]
|
||||
if ($list.Count -gt 1) {
|
||||
$items = @($list | ForEach-Object { New-MenuItem $_.Name " $($_.Name) ${GRAY}포트 $($_.Port)${RESET}" }) + (Get-BackItem '← 취소')
|
||||
@@ -4087,7 +4144,12 @@ function Invoke-WebuiComfyLinkFlow {
|
||||
$inst = Find-ComfyInstance $n
|
||||
}
|
||||
$ckpts = @(Get-ChildItem (Join-Path $ComfyModels 'checkpoints') -File -ErrorAction SilentlyContinue | Where-Object { $_.Extension -in '.safetensors', '.ckpt', '.sft' })
|
||||
if ($ckpts.Count -eq 0) { Write-C "${YELLOW}그림 모델이 없습니다. 'ComfyUI → 그림 모델 다운로드'에서 ⭐ 모델을 먼저 받아 주세요.${RESET}"; return }
|
||||
if ($ckpts.Count -eq 0) {
|
||||
Write-C "${YELLOW}그림 모델이 아직 없습니다.${RESET}"
|
||||
if (-not (Get-ComfyStarterModel)) { return }
|
||||
$ckpts = @(Get-ChildItem (Join-Path $ComfyModels 'checkpoints') -File -ErrorAction SilentlyContinue | Where-Object { $_.Extension -in '.safetensors', '.ckpt', '.sft' })
|
||||
if ($ckpts.Count -eq 0) { return }
|
||||
}
|
||||
$items = @()
|
||||
foreach ($c in $ckpts) {
|
||||
$p = Get-ComfyCatalog | Where-Object { $_.File -eq $c.Name } | Select-Object -First 1
|
||||
@@ -4109,7 +4171,12 @@ function Test-ComfyGenerate($Inst) {
|
||||
$s = Get-ComfyStats $Inst.Port 3
|
||||
if (-not $s) { Write-C "${YELLOW}ComfyUI $($Inst.Name)이 응답하지 않습니다. 먼저 기동해 주세요.${RESET}"; return }
|
||||
$ckpts = @(Get-ChildItem (Join-Path $ComfyModels 'checkpoints') -File -ErrorAction SilentlyContinue | Where-Object { $_.Extension -in '.safetensors', '.ckpt', '.sft' })
|
||||
if ($ckpts.Count -eq 0) { Write-C "${YELLOW}그림 모델이 없습니다. 먼저 '그림 모델 다운로드'에서 받아 주세요.${RESET}"; return }
|
||||
if ($ckpts.Count -eq 0) {
|
||||
Write-C "${YELLOW}그림 모델이 아직 없습니다.${RESET}"
|
||||
if (-not (Get-ComfyStarterModel)) { return }
|
||||
$ckpts = @(Get-ChildItem (Join-Path $ComfyModels 'checkpoints') -File -ErrorAction SilentlyContinue | Where-Object { $_.Extension -in '.safetensors', '.ckpt', '.sft' })
|
||||
if ($ckpts.Count -eq 0) { return }
|
||||
}
|
||||
$items = @($ckpts | ForEach-Object { New-MenuItem $_.Name " $($_.Name)" }) + (Get-BackItem '← 취소')
|
||||
$file = Show-Menu -Header "${BLUE}그림 생성 시험 - 모델 선택${RESET} ${GRAY}(작은 그림 한 장으로 끝까지 동작하는지 확인)${RESET}`n$($script:KeyHelp)" -Items $items
|
||||
if (-not $file -or $file -eq 'back') { return }
|
||||
@@ -4644,6 +4711,73 @@ function Show-StorageMenu {
|
||||
}
|
||||
}
|
||||
|
||||
# --------------------------------------------------
|
||||
# 999 웹 화면 바로 열기 (어느 메뉴에서나)
|
||||
# --------------------------------------------------
|
||||
function Invoke-QuickOpen {
|
||||
$script:InQuickOpen = $true
|
||||
try {
|
||||
while ($true) {
|
||||
$podOn = (Test-Podman) -and ((Get-MachineInfo -Cached).State -eq 'running')
|
||||
$items = @()
|
||||
$items += New-MenuItem '-' "${CYAN}──────── Open WebUI (대화) ────────${RESET}" '-q1'
|
||||
$wst = "${GRAY}[꺼짐 → 켠 뒤 열기]${RESET}"
|
||||
if (Test-WebuiHealth) { $wst = "${GREEN}[실행 중]${RESET}" }
|
||||
$items += New-MenuItem 'webui' " Open WebUI http://localhost:$WebuiPort $wst"
|
||||
$items += New-MenuItem '-' "${CYAN}──────── ComfyUI (그림 생성) ────────${RESET}" '-q2'
|
||||
$list = @(Get-ComfyInstances)
|
||||
if ($list.Count -eq 0) {
|
||||
$items += New-MenuItem 'c_install' " + ComfyUI 설치 후 열기 ${GRAY}(최신 안정판, 처음에는 5~15분)${RESET}"
|
||||
} else {
|
||||
$states = @{}
|
||||
if ($podOn) { $states = Get-ComfyStates }
|
||||
foreach ($i in $list) {
|
||||
$cst = "${GRAY}[꺼짐 → 켠 뒤 열기]${RESET}"
|
||||
if ($states[$i.Container] -eq 'running') { $cst = "${GREEN}[실행 중]${RESET}" }
|
||||
$items += New-MenuItem "c:$($i.Name)" " ComfyUI $($i.Name) http://localhost:$($i.Port) $cst"
|
||||
}
|
||||
}
|
||||
$items += Get-BackItem '← 원래 메뉴로 돌아가기'
|
||||
$sel = Show-Menu -Header "${BLUE}${BOLD}999 · 웹 화면 바로 열기${RESET} ${GRAY}고르면 브라우저로 엽니다 (꺼져 있으면 먼저 켭니다)${RESET}`n$($script:KeyHelp)" -Items $items -NoQuick
|
||||
if (-not $sel -or $sel -eq 'back') { return }
|
||||
if ($sel -eq '-') { continue }
|
||||
Clear-Host
|
||||
if ($sel -eq 'webui') {
|
||||
if (-not (Test-WebuiHealth)) {
|
||||
Write-C "${CYAN}Open WebUI가 꺼져 있어 먼저 켭니다...${RESET}"
|
||||
Start-Webui
|
||||
}
|
||||
if (Test-WebuiHealth) {
|
||||
Start-Process "http://localhost:$WebuiPort"
|
||||
Write-C "${GREEN}`n✅ 브라우저로 열었습니다: http://localhost:$WebuiPort${RESET}"
|
||||
Show-WebuiUrls
|
||||
} else {
|
||||
Write-C "${RED}❌ Open WebUI가 응답하지 않아 열지 못했습니다.${RESET}"
|
||||
}
|
||||
} elseif ($sel -eq 'c_install' -or $sel -like 'c:*') {
|
||||
if ($sel -eq 'c_install') { $inst = Install-ComfyQuick } else { $inst = Find-ComfyInstance ($sel.Substring(2)) }
|
||||
if ($inst) {
|
||||
if (-not (Get-ComfyStats $inst.Port 2)) {
|
||||
Write-C "${CYAN}ComfyUI $($inst.Name)이 꺼져 있어 먼저 켭니다...${RESET}"
|
||||
[void](Start-ComfyInstance $inst)
|
||||
}
|
||||
if (Get-ComfyStats $inst.Port 2) {
|
||||
Start-Process "http://localhost:$($inst.Port)"
|
||||
Write-C "${GREEN}`n✅ 브라우저로 열었습니다: http://localhost:$($inst.Port)${RESET}"
|
||||
Show-ComfyUrls $inst
|
||||
} else {
|
||||
Write-C "${RED}❌ ComfyUI $($inst.Name)이 응답하지 않아 열지 못했습니다.${RESET}"
|
||||
}
|
||||
}
|
||||
}
|
||||
Wait-Return
|
||||
return
|
||||
}
|
||||
} finally {
|
||||
$script:InQuickOpen = $false
|
||||
}
|
||||
}
|
||||
|
||||
# --------------------------------------------------
|
||||
# 시작 준비 (서버는 기동하지 않음)
|
||||
# --------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user