Windows: VS Code Continue 설정 자동 갱신 + 내부망 주소 고르기 수정

- Update-ContinueConfig: ~/.continue/config.json 을 로컬 PC + macpro01 설치 모델 전체로
  ([묶음][추천·가능·느림·확인 필요·불가]), 모델 받기·지우기 뒤 / 시작할 때 / 메뉴
  'VS Code Continue 설정 갱신'에서 실행. 바뀔 때만 백업(최근 5개), 연결 실패 시 지난 목록 유지,
  자동완성·임베딩·다른 제공자 항목 유지. 정렬은 판정 → 추천 순서 → 이름(문자 코드 순)
- Get-LanIp / Find-LanIp: $LanIpFixed(기본 192.168.88.249) → 기본 경로 있는 어댑터 → 유선 먼저 →
  경로 우선순위. 예전 정렬 기준(InterfaceMetric)이 Get-NetIPAddress 에 없어 Wi-Fi 주소가 뽑혀
  WebUI → Ollama 연결이 실패하던 문제
- PowerShell 7.6.8 에서 모의 시험 통과. Windows PowerShell 5.1 실제 실행 확인은 아직

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HnDmXrFqktWwYa1cuJRAVZ
This commit is contained in:
Claude
2026-11-05 00:41:06 +00:00
parent 5886220cd3
commit 42819b558b

View File

@@ -9,6 +9,7 @@
(인기순·최신순·기능별 분류(비전·멀티모달 분리) + 검색어, 1시간 캐시, 오프라인이면 추천 목록 사용) (인기순·최신순·기능별 분류(비전·멀티모달 분리) + 검색어, 1시간 캐시, 오프라인이면 추천 목록 사용)
- PC 사양(CPU, 램, GPU, VRAM)을 확인해 모델·태그마다 적합도 표시, 성능 설정 자동 조정 - PC 사양(CPU, 램, GPU, VRAM)을 확인해 모델·태그마다 적합도 표시, 성능 설정 자동 조정
- 설치된 모델 실행 / ⭐추천 모델 / 도구 연동(ollama launch) / 일괄 다운로드 - 설치된 모델 실행 / ⭐추천 모델 / 도구 연동(ollama launch) / 일괄 다운로드
- VS Code Continue 설정(config.json) 자동 갱신: 로컬 PC + 원격(macpro01) 모델 전체, 추천·가능·느림·불가 표시
- Open WebUI를 Podman 컨테이너로 실행 (데이터: 스크립트 폴더\webui) - Open WebUI를 Podman 컨테이너로 실행 (데이터: 스크립트 폴더\webui)
WSL2 확인·Podman 자동 설치(winget), 가상 머신 생성(CPU·메모리 선택), WSL2 확인·Podman 자동 설치(winget), 가상 머신 생성(CPU·메모리 선택),
기동·종료·재시작·이미지 업데이트·로그·브라우저 열기·백업·모니터링 - ComfyUI(그림 생성)를 Podman 컨테이너로 실행 (데이터: 스크립트 폴더\comfyui) 기동·종료·재시작·이미지 업데이트·로그·브라우저 열기·백업·모니터링 - ComfyUI(그림 생성)를 Podman 컨테이너로 실행 (데이터: 스크립트 폴더\comfyui)
@@ -65,9 +66,24 @@ $CacheDir = Join-Path $env:LOCALAPPDATA 'jj_ollama_manager_cache' # 인터넷
$OldCacheDir = Join-Path $env:LOCALAPPDATA 'ollama_manager_cache' $OldCacheDir = Join-Path $env:LOCALAPPDATA 'ollama_manager_cache'
if ((Test-Path $OldCacheDir) -and -not (Test-Path $CacheDir)) { try { Move-Item -LiteralPath $OldCacheDir -Destination $CacheDir -ErrorAction Stop } catch { } } if ((Test-Path $OldCacheDir) -and -not (Test-Path $CacheDir)) { try { Move-Item -LiteralPath $OldCacheDir -Destination $CacheDir -ErrorAction Stop } catch { } }
$CacheTtlMin = 60 # 캐시 유지 시간(분) $CacheTtlMin = 60 # 캐시 유지 시간(분)
# VS Code Continue 설정 자동 갱신 (Update-ContinueConfig)
$ContinueConfig = Join-Path $env:USERPROFILE '.continue\config.json'
$ContinueRemoteName = 'macpro01' # 원격 Ollama 이름 (모델 이름 앞 [macpro01])
$ContinueRemoteBase = 'https://ollama.joynala.com:443' # 원격 Ollama 주소 (NAS 역방향 프록시)
$ContinueRemoteRamGB = 128 # 원격 PC 램 (판정 기준)
$ContinueRemoteCtx = 32768 # 원격 서버 OLLAMA_CONTEXT_LENGTH 와 같게
$ContinueRemoteThreads = 12
# 추천 모델 (적은 순서대로 위에 나옴, 첫 번째가 Continue 기본 모델)
$ContinueRemoteRec = [ordered]@{ 'qwen3-coder:30b' = '메인 코딩'; 'qwen3.6:35b' = '에이전트 코딩·이미지 입력'; 'qwen3-vl:2b-instruct' = '이미지 분석·OCR 빠름' }
$ContinueLocalRec = [ordered]@{ 'qwen:4b' = '빠른 대화'; 'qwen3-vl:2b-instruct' = '이미지 분석 빠름' }
$LibraryUrl = 'https://ollama.com/library' $LibraryUrl = 'https://ollama.com/library'
# Open WebUI (Podman) 설정 # Open WebUI (Podman) 설정
# 컨테이너가 이 PC의 Ollama를 부를 때 쓰는 이 PC 주소 (비우면 자동: 기본 경로가 있는 어댑터 중 유선 먼저)
# - 이 PC에 그 주소가 없으면(이더넷 빠짐 등) 무시하고 자동으로 고름
# - 2026-11-05: 이더넷(192.168.88.249)과 Wi-Fi(10.224.x)가 같이 켜져 Wi-Fi 주소가 뽑혀 WebUI → Ollama 연결 실패
$LanIpFixed = '192.168.88.249'
$ScriptDir = $PSScriptRoot $ScriptDir = $PSScriptRoot
if (-not $ScriptDir) { $ScriptDir = (Get-Location).Path } if (-not $ScriptDir) { $ScriptDir = (Get-Location).Path }
$WebuiDir = Join-Path $ScriptDir 'webui' # 이 폴더 아래에 데이터가 쌓입니다 $WebuiDir = Join-Path $ScriptDir 'webui' # 이 폴더 아래에 데이터가 쌓입니다
@@ -1792,6 +1808,142 @@ function Show-HardwareInfo {
# 모델 관리 # 모델 관리
# -------------------------------------------------- # --------------------------------------------------
# --------------------------------------------------
# VS Code Continue 설정 자동 갱신 (~/.continue/config.json)
# - 로컬 PC(localhost)와 원격(macpro01) 두 묶음, 설치된 모델 전체
# - 이름 앞에 [추천]·[가능]·[느림]·[확인 필요]·[불가] (판정 = Get-Fit 과 같은 기준)
# - 모델 받기·지우기 뒤, 스크립트 시작 때, 메뉴 'Continue 설정 갱신'에서 실행
# - 서버에 연결 못 하면 그 묶음은 지난 목록을 그대로 둠
# - tabAutocompleteModel · embeddingsProvider · 다른 제공자(anthropic 등) 항목은 그대로 둠
# --------------------------------------------------
function Get-ContinueTags([string]$Base, [int]$TimeoutSec = 5) {
try {
$r = Invoke-RestMethod -Uri "$Base/api/tags" -TimeoutSec $TimeoutSec -ErrorAction Stop
return @($r.models | ForEach-Object { [pscustomobject]@{ Name = [string]$_.name; Size = [double]$_.size } })
} catch {
return $null
}
}
# 모델 하나의 판정 → @{ Grade; Note }
function Get-ContinueGrade([string]$Tag, [double]$Bytes, [double]$RamGB, $Rec) {
$gb = $Bytes / 1e9
$gbText = '{0:N1}GB' -f $gb
if ($Tag -match '(?i)embed|^bge-') { return @{ Grade = '불가'; Note = '임베딩 전용' } }
if ($Tag -match '(?i)z-image|flux|stable-diffusion|sdxl') { return @{ Grade = '불가'; Note = '그림 생성 전용' } }
if ($Tag -match '(?i)-base(\b|$)') { return @{ Grade = '불가'; Note = '자동완성 전용(base)' } }
if ($Bytes -lt 100MB) { return @{ Grade = '확인 필요'; Note = ('모델 파일이 아님({0:N0}KB), 동작 확인 필요' -f ($Bytes / 1KB)) } }
$need = [int][math]::Ceiling($gb * 1.2) + 1
$avail = [int][math]::Floor($RamGB * 0.8)
if ($need -gt $avail) { return @{ Grade = '불가'; Note = "메모리 부족(필요 약 ${need}GB > 사용 가능 약 ${avail}GB)" } }
$moe = Test-MoeTag $Tag
if ($moe -or $gb -le 10) {
$kind = '소형'
if ($moe) { $kind = 'MoE' }
if ($Rec -and $Rec.Contains($Tag)) { return @{ Grade = '추천'; Note = "$($Rec[$Tag]) · $kind · $gbText" } }
return @{ Grade = '가능'; Note = "$kind · $gbText" }
}
return @{ Grade = '느림'; Note = "dense · $gbText" }
}
# 서버 하나의 모델 목록 → Continue models 항목들
function New-ContinueModels($Tags, [string]$Label, [string]$Base, [double]$RamGB, [int]$Ctx, [int]$Threads, $Rec) {
$order = @{ '추천' = 0; '가능' = 1; '느림' = 2; '확인 필요' = 3; '불가' = 4 }
$recKeys = @()
if ($Rec) { $recKeys = @($Rec.Keys) }
$rows = New-Object System.Collections.Generic.List[object]
foreach ($t in $Tags) {
$g = Get-ContinueGrade $t.Name $t.Size $RamGB $Rec
$p = [array]::IndexOf($recKeys, $t.Name)
if ($p -lt 0) { $p = 99 }
$rows.Add([pscustomobject]@{ O = $order[$g.Grade]; P = $p; Name = $t.Name; Grade = $g.Grade; Note = $g.Note })
}
# 판정 → 추천 순서 → 이름(문자 코드 순). 문화권 정렬은 '-' '.' 처리가 실행마다 달라질 수 있어 쓰지 않음
$rows.Sort([Comparison[object]]{
param($a, $b)
if ($a.O -ne $b.O) { return $a.O.CompareTo($b.O) }
if ($a.P -ne $b.P) { return $a.P.CompareTo($b.P) }
return [string]::CompareOrdinal($a.Name, $b.Name)
})
$out = foreach ($r in $rows) {
$temp = 0.3
if ($r.Name -like 'qwen3-coder*') { $temp = 0.7 }
[ordered]@{
title = "[$Label][$($r.Grade)] $($r.Name) — $($r.Note)"
model = $r.Name
apiBase = $Base
provider = 'ollama'
requestOptions = [ordered]@{ numCtx = $Ctx; temperature = $temp; numThread = $Threads }
}
}
return @($out)
}
# config.json 갱신 (바뀐 게 있을 때만 백업 후 저장). -Quiet 이면 바뀌었을 때만 한 줄 안내
function Update-ContinueConfig([switch]$Quiet) {
$dir = Split-Path -Parent $ContinueConfig
if (-not (Test-Path $dir)) {
if (-not $Quiet) { Write-C "${YELLOW}Continue 설정 폴더가 없습니다: $dir (VS Code Continue 확장 설치 후 다시 실행)${RESET}" }
return
}
$old = $null
if (Test-Path $ContinueConfig) {
try { $old = [IO.File]::ReadAllText($ContinueConfig) | ConvertFrom-Json -ErrorAction Stop } catch {
if (-not $Quiet) { Write-C "${RED}❌ $ContinueConfig 를 읽지 못했습니다 (JSON 형식 오류). 갱신하지 않습니다.${RESET}" }
return
}
}
$oldModels = @()
if ($old -and $old.models) { $oldModels = @($old.models) }
$localBase = "http://localhost:$ApiPort"
$msgs = @()
# 원격 (macpro01)
$rTags = Get-ContinueTags $ContinueRemoteBase
if ($null -ne $rTags) {
$remote = New-ContinueModels $rTags $ContinueRemoteName $ContinueRemoteBase $ContinueRemoteRamGB $ContinueRemoteCtx $ContinueRemoteThreads $ContinueRemoteRec
$msgs += "$ContinueRemoteName $($rTags.Count)개"
} else {
$remote = @($oldModels | Where-Object { $_.apiBase -eq $ContinueRemoteBase })
$msgs += "$ContinueRemoteName 연결 안 됨(지난 목록 $($remote.Count)개 유지)"
}
# 로컬 PC
$lTags = Get-ContinueTags $localBase 3
if ($null -ne $lTags) {
$ram = 16; $threads = 4; $ctx = 8192
if ($script:HW) { $ram = [double]$script:HW.RamGB; $threads = [int]$script:HW.Cores }
if ($script:Perf) { $ctx = [int]$script:Perf.ContextLength }
$local = New-ContinueModels $lTags '로컬 PC' $localBase $ram $ctx $threads $ContinueLocalRec
$msgs += "로컬 PC $($lTags.Count)개"
} else {
$local = @($oldModels | Where-Object { $_.apiBase -eq $localBase })
$msgs += "로컬 서버 꺼짐(지난 목록 $($local.Count)개 유지)"
}
# 다른 제공자 항목은 그대로
$others = @($oldModels | Where-Object { $_.apiBase -ne $ContinueRemoteBase -and $_.apiBase -ne $localBase })
$new = [ordered]@{ models = @($remote) + @($local) + @($others) }
if ($old) {
foreach ($p in $old.PSObject.Properties) { if ($p.Name -ne 'models') { $new[$p.Name] = $p.Value } }
}
$json = ConvertTo-Json -InputObject $new -Depth 10
$cur = ''
if (Test-Path $ContinueConfig) { $cur = [IO.File]::ReadAllText($ContinueConfig) }
if ($cur.Trim() -eq $json.Trim()) {
if (-not $Quiet) { Write-C "${GREEN}✅ Continue 설정이 이미 최신입니다. ($($msgs -join ' · '))${RESET}" }
return
}
if (Test-Path $ContinueConfig) {
$bak = "$ContinueConfig.bak_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
Copy-Item -LiteralPath $ContinueConfig -Destination $bak -Force
# 자동 백업은 최근 5개만 남김
Get-ChildItem -Path $dir -Filter 'config.json.bak_????????_??????' -ErrorAction SilentlyContinue |
Sort-Object Name -Descending | Select-Object -Skip 5 | Remove-Item -Force -ErrorAction SilentlyContinue
}
[IO.File]::WriteAllText($ContinueConfig, $json + "`n", $Utf8NoBom)
Write-C "${GREEN}✅ VS Code Continue 설정을 갱신했습니다: $ContinueConfig ($($msgs -join ' · '))${RESET}"
}
# 모델이 없으면 크기·적합도 안내 후 물어보고 다운로드 # 모델이 없으면 크기·적합도 안내 후 물어보고 다운로드
function Confirm-Model([string]$Tag, [string]$SizeText = '') { function Confirm-Model([string]$Tag, [string]$SizeText = '') {
Update-Installed Update-Installed
@@ -1818,6 +1970,7 @@ function Confirm-Model([string]$Tag, [string]$SizeText = '') {
Update-Installed Update-Installed
if (Test-Installed $Tag) { if (Test-Installed $Tag) {
Write-C "${GREEN}✅ $Tag 다운로드가 끝났습니다.${RESET}" Write-C "${GREEN}✅ $Tag 다운로드가 끝났습니다.${RESET}"
try { Update-ContinueConfig -Quiet } catch { }
return $true return $true
} }
Write-C "${RED}❌ $Tag 다운로드에 실패했거나 중단되었습니다.${RESET}" Write-C "${RED}❌ $Tag 다운로드에 실패했거나 중단되었습니다.${RESET}"
@@ -2111,6 +2264,7 @@ function Remove-OllamaModel([string]$Tag) {
if ($ok) { if ($ok) {
Write-C "${GREEN}✅ '$base' 모델을 삭제했습니다. 디스크 남은 공간: $(Get-FreeDiskGB)GB${RESET}" Write-C "${GREEN}✅ '$base' 모델을 삭제했습니다. 디스크 남은 공간: $(Get-FreeDiskGB)GB${RESET}"
} }
try { Update-ContinueConfig -Quiet } catch { }
return $ok return $ok
} }
@@ -2674,6 +2828,7 @@ function Show-BulkDownloadMenu {
} }
} }
Write-C "${CYAN}`n완료: 성공 ${okCount}개, 실패 ${failCount}개${RESET}" Write-C "${CYAN}`n완료: 성공 ${okCount}개, 실패 ${failCount}개${RESET}"
if ($okCount -gt 0) { try { Update-ContinueConfig -Quiet } catch { } }
Wait-Return Wait-Return
} }
@@ -2729,15 +2884,49 @@ function Test-Wsl {
# (서버 재시작 · WebUI 기동 때, 또는 -Refresh 로 새로 알아냄) # (서버 재시작 · WebUI 기동 때, 또는 -Refresh 로 새로 알아냄)
function Get-LanIp([switch]$Refresh) { function Get-LanIp([switch]$Refresh) {
if (-not $Refresh -and $script:LanIpKnown) { return $script:LanIp } if (-not $Refresh -and $script:LanIpKnown) { return $script:LanIp }
$ip = Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue | $script:LanIp = Find-LanIp
Where-Object { $_.IPAddress -notmatch '^(127\.|169\.254\.)' -and $_.InterfaceAlias -notmatch 'vEthernet|WSL|Loopback|Hyper-V' } |
Sort-Object InterfaceMetric | Select-Object -First 1
$script:LanIp = ''
if ($ip) { $script:LanIp = $ip.IPAddress }
$script:LanIpKnown = $true $script:LanIpKnown = $true
return $script:LanIp return $script:LanIp
} }
# 무선 어댑터인지 (매체 종류 → 안 되면 이름으로)
function Test-WirelessAdapter([int]$Index, [string]$Alias) {
try {
$na = Get-NetAdapter -InterfaceIndex $Index -ErrorAction Stop
if ("$($na.PhysicalMediaType)" -match '802\.11|Wireless') { return $true }
if ("$($na.PhysicalMediaType)" -match '802\.3') { return $false }
} catch { }
return ($Alias -match '(?i)Wi-?Fi|Wireless|WLAN|무선')
}
# 내부망 주소 고르기: 고정 주소($LanIpFixed) → 기본 경로가 있는 어댑터 → 유선 먼저 → 경로 우선순위
# (Get-NetIPAddress 결과에는 InterfaceMetric 이 없어 예전 정렬은 순서가 정해지지 않았음)
function Find-LanIp {
$all = @(Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
Where-Object { $_.IPAddress -notmatch '^(127\.|169\.254\.)' -and $_.InterfaceAlias -notmatch 'vEthernet|WSL|Loopback|Hyper-V' })
if ($all.Count -eq 0) { return '' }
if ($LanIpFixed -and @($all | Where-Object { $_.IPAddress -eq $LanIpFixed }).Count -gt 0) { return $LanIpFixed }
$routes = @(Get-NetRoute -DestinationPrefix '0.0.0.0/0' -ErrorAction SilentlyContinue)
$cands = foreach ($a in $all) {
$r = $routes | Where-Object { $_.ifIndex -eq $a.InterfaceIndex } | Sort-Object RouteMetric | Select-Object -First 1
$metric = 9999
if ($r) {
$ifm = 0
try { $ifm = [int](Get-NetIPInterface -InterfaceIndex $a.InterfaceIndex -AddressFamily IPv4 -ErrorAction Stop).InterfaceMetric } catch { }
$metric = [int]$r.RouteMetric + $ifm
}
[pscustomobject]@{
Ip = $a.IPAddress
HasRoute = [bool]$r
Wireless = (Test-WirelessAdapter $a.InterfaceIndex $a.InterfaceAlias)
Metric = $metric
}
}
$best = @($cands | Sort-Object @{ Expression = 'HasRoute'; Descending = $true }, @{ Expression = 'Wireless'; Descending = $false }, @{ Expression = 'Metric'; Descending = $false }) | Select-Object -First 1
if ($best) { return $best.Ip }
return ''
}
# Windows 경로 → Podman 가상 머신(WSL) 안의 경로 (M:\webui\data → /mnt/m/webui/data) # Windows 경로 → Podman 가상 머신(WSL) 안의 경로 (M:\webui\data → /mnt/m/webui/data)
function ConvertTo-WslPath([string]$Path) { function ConvertTo-WslPath([string]$Path) {
$full = [IO.Path]::GetFullPath($Path) $full = [IO.Path]::GetFullPath($Path)
@@ -5164,6 +5353,7 @@ Write-C "${CYAN}PC 사양을 확인하는 중입니다...${RESET}"
$script:HW = Get-Hardware $script:HW = Get-Hardware
$script:Perf = Get-PerfSettings $script:HW $script:Perf = Get-PerfSettings $script:HW
$WebuiOllamaUrl = Get-WebuiOllamaUrl # WebUI 컨테이너가 이 PC의 Ollama를 부를 주소 $WebuiOllamaUrl = Get-WebuiOllamaUrl # WebUI 컨테이너가 이 PC의 Ollama를 부를 주소
if ($env:JJ_OM_NOMENU -ne '1') { try { Update-ContinueConfig -Quiet } catch { } } # VS Code Continue 설정 (바뀌었을 때만 안내)
# -------------------------------------------------- # --------------------------------------------------
# 메인 메뉴 # 메인 메뉴
@@ -5186,6 +5376,7 @@ while ($true) {
(New-MenuItem 'bulk' ' 추천 모델 일괄 다운로드') (New-MenuItem 'bulk' ' 추천 모델 일괄 다운로드')
(New-MenuItem 'ko' " 한국어 전용 모드: $(Get-KoModeLabel) ${GRAY}(답변에 한자·중국어 섞임 방지)${RESET}") (New-MenuItem 'ko' " 한국어 전용 모드: $(Get-KoModeLabel) ${GRAY}(답변에 한자·중국어 섞임 방지)${RESET}")
(New-MenuItem 'storage' " 모델 저장 위치 ${GRAY}(Ollama · ComfyUI 폴더 확인·변경)${RESET}") (New-MenuItem 'storage' " 모델 저장 위치 ${GRAY}(Ollama · ComfyUI 폴더 확인·변경)${RESET}")
(New-MenuItem 'continue' " VS Code Continue 설정 갱신 ${GRAY}(로컬 PC + $ContinueRemoteName 모델 전체를 config.json에)${RESET}")
(New-MenuItem '-' "${CYAN}──────── Open WebUI · ComfyUI ────────${RESET}" '-w') (New-MenuItem '-' "${CYAN}──────── Open WebUI · ComfyUI ────────${RESET}" '-w')
(New-MenuItem 'stack' " ▶ 통합 운영 ${GRAY}(Ollama + WebUI + ComfyUI 전체 기동·종료·점검)${RESET}") (New-MenuItem 'stack' " ▶ 통합 운영 ${GRAY}(Ollama + WebUI + ComfyUI 전체 기동·종료·점검)${RESET}")
(New-MenuItem 'webui' " Open WebUI (Podman) 관리 ${GRAY}(기동·종료·업데이트·로그·백업)${RESET}") (New-MenuItem 'webui' " Open WebUI (Podman) 관리 ${GRAY}(기동·종료·업데이트·로그·백업)${RESET}")
@@ -5221,6 +5412,7 @@ while ($true) {
'bulk' { Show-BulkDownloadMenu } 'bulk' { Show-BulkDownloadMenu }
'ko' { Show-KoMenu } 'ko' { Show-KoMenu }
'storage' { Show-StorageMenu } 'storage' { Show-StorageMenu }
'continue' { Clear-Host; Write-C "${CYAN}로컬 PC와 $ContinueRemoteName 의 모델 목록을 읽는 중...${RESET}"; Update-ContinueConfig; Wait-Return }
'live' { Show-LiveMonitor } 'live' { Show-LiveMonitor }
'status' { Clear-Host; Show-ServerStatus; Wait-Return } 'status' { Clear-Host; Show-ServerStatus; Wait-Return }
'log' { Clear-Host; Show-ServerLog } 'log' { Clear-Host; Show-ServerLog }