Git 메뉴(최신 받기·상태·기록) + Mac WebUI 이미지 설정 DB 맞춤
- 메인 메뉴 Git: ⬇ 최신 받기(수정 있으면 받지 않음, --ff-only, 받으면 다시 시작) · 상태 · 최근 기록 (Windows 20_git_menu.ps1 · Mac 21_git_menu.sh) - Mac 20_webui_image_sync.sh: Windows와 같은 DB 맞춤 + 이미지 편집 연결, WebUI 기동·재시작·연결 때 실행 - 두 플랫폼: WebUI에서 이미지 설정을 한 번도 하지 않은 DB면 생성 설정 전체를 기록 - wiki: 06_문제_해결 25-2, 07_변경_기록, PROJECT.md, README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HnDmXrFqktWwYa1cuJRAVZ
This commit is contained in:
@@ -10,8 +10,8 @@ Ollama · Open WebUI · ComfyUI를 한 곳에서 설치하고 운영하는 관
|
||||
| `jj_ollama_manager.ps1` | Windows 11 (PowerShell 5.1) — 설정 + `src/platform/windows/*.ps1` 불러오기 + 시작 |
|
||||
| `RUN.cmd` | Windows 실행용 (실행 정책과 상관없이 더블클릭으로 실행) |
|
||||
| `jj_ollama_manager.sh` | macOS (Intel Mac, 기본 bash 3.2) — 설정 + `src/platform/mac/*.sh` 불러오기 + 시작 |
|
||||
| `src/platform/windows/` | Windows 기능 소스 19개 (파일당 약 300~400줄, 번호 순서대로 불러옴) |
|
||||
| `src/platform/mac/` | Mac 기능 소스 19개 (파일당 약 300~400줄, 번호 순서대로 불러옴) |
|
||||
| `src/platform/windows/` | Windows 기능 소스 20개 (파일당 약 300~400줄, 번호 순서대로 불러옴) |
|
||||
| `src/platform/mac/` | Mac 기능 소스 21개 (파일당 약 300~400줄, 번호 순서대로 불러옴) |
|
||||
|
||||
> 실행 파일 하나만 복사하면 동작하지 않습니다. `src/` 폴더까지 저장소 전체를 받아 주세요 (`git pull`).
|
||||
|
||||
|
||||
@@ -232,7 +232,8 @@ foreach ($__src in @(
|
||||
'16_factory_reset.ps1',
|
||||
'17_podman_monitor.ps1',
|
||||
'18_podman_server.ps1',
|
||||
'19_ollama_restart.ps1'
|
||||
'19_ollama_restart.ps1',
|
||||
'20_git_menu.ps1'
|
||||
)) {
|
||||
$__path = Join-Path $SrcDir $__src
|
||||
if (-not (Test-Path -LiteralPath $__path)) {
|
||||
@@ -299,6 +300,7 @@ while ($true) {
|
||||
(New-MenuItem 'log' ' 서버 로그 보기')
|
||||
(New-MenuItem 'hw' ' PC 사양 확인 및 모델 적합도')
|
||||
(New-MenuItem '-' "${CYAN}───────────────────────────${RESET}" '-3')
|
||||
(New-MenuItem 'git' " Git ${GRAY}(⬇ 최신 받기 · 상태 · 최근 기록)${RESET}")
|
||||
(New-MenuItem 'quit' ' 종료')
|
||||
)
|
||||
|
||||
@@ -315,6 +317,7 @@ while ($true) {
|
||||
if ($sel -eq '__secret') { Invoke-FactoryReset; continue }
|
||||
|
||||
switch ($sel) {
|
||||
'git' { Show-GitMenu }
|
||||
'p_start' { Clear-Host; Start-PodmanServer; Wait-Return }
|
||||
'p_stop' { Clear-Host; Stop-PodmanServer; Wait-Return }
|
||||
'p_restart' { Clear-Host; Restart-PodmanServer; Wait-Return }
|
||||
|
||||
@@ -194,7 +194,9 @@ for __src in \
|
||||
16_factory_reset.sh \
|
||||
17_podman_monitor.sh \
|
||||
18_podman_server.sh \
|
||||
19_ollama_restart.sh; do
|
||||
19_ollama_restart.sh \
|
||||
20_webui_image_sync.sh \
|
||||
21_git_menu.sh; do
|
||||
if [ ! -f "$SRC_DIR/$__src" ]; then
|
||||
echo "${RED}❌ 소스 파일이 없습니다: $SRC_DIR/$__src (저장소를 다시 받아 주세요: git pull)${RESET}" >&2
|
||||
exit 1
|
||||
@@ -279,6 +281,7 @@ while true; do
|
||||
add_item "log" " 서버 로그 보기"
|
||||
add_item "-" "${CYAN}───────────────────────────${RESET}"
|
||||
add_item "setup" " ★ 처음 설치 ${GRAY}(Ollama·WebUI·ComfyUI 전체 자동 설정·기동, 있는 것은 건너뜀)${RESET}"
|
||||
add_item "git" " Git ${GRAY}(⬇ 최신 받기 · 상태 · 최근 기록)${RESET}"
|
||||
add_item "quit" " 종료"
|
||||
|
||||
HEADER="$(status_block)"$'\n'"${MAIN_KEY_HELP}"
|
||||
@@ -297,6 +300,7 @@ while true; do
|
||||
|
||||
case "$MENU_RESULT" in
|
||||
__secret) factory_reset ;;
|
||||
git) git_menu ;;
|
||||
p_start) clear; podman_server_start; pause_return ;;
|
||||
p_stop) clear; podman_server_stop; pause_return ;;
|
||||
p_restart) clear; podman_server_restart; pause_return ;;
|
||||
|
||||
@@ -203,6 +203,7 @@ webui_start() {
|
||||
case "$WU_STATE" in
|
||||
running)
|
||||
echo -e "${GREEN}\n✅ Open WebUI가 이미 실행 중입니다. (${WU_STATUS})${RESET}"
|
||||
webui_image_sync
|
||||
webui_print_urls
|
||||
return 0 ;;
|
||||
none)
|
||||
@@ -214,7 +215,8 @@ webui_start() {
|
||||
echo -e "${GREEN}\n멈춰 있는 Open WebUI 컨테이너를 기동합니다...${RESET}"
|
||||
podman start "$WEBUI_NAME" >/dev/null || return 1 ;;
|
||||
esac
|
||||
webui_wait_ready
|
||||
webui_wait_ready || return 1
|
||||
webui_image_sync # WebUI DB의 이미지 설정을 comfyui.env에 맞춤 (20_webui_image_sync.sh)
|
||||
}
|
||||
|
||||
# WebUI 종료 (컨테이너만 / 가상 머신까지)
|
||||
@@ -265,7 +267,8 @@ webui_restart() {
|
||||
echo -e "${YELLOW}\nOpen WebUI를 재시작합니다...${RESET}"
|
||||
podman restart -t 15 "$WEBUI_NAME" >/dev/null || return 1
|
||||
fi
|
||||
webui_wait_ready
|
||||
webui_wait_ready || return 1
|
||||
webui_image_sync
|
||||
}
|
||||
|
||||
# 이미지 업데이트 (데이터는 webui/data 에 그대로 유지)
|
||||
|
||||
@@ -243,6 +243,7 @@ webui_comfy_link() {
|
||||
local file="$1"
|
||||
comfy_preset "$file"
|
||||
comfy_workflow_json "$file" "$PR_W" "$PR_H" "$PR_STEPS" "$PR_CFG" "$PR_SAMPLER" "$PR_SCHED"
|
||||
comfy_edit_workflow_json "$file" "$PR_W" "$PR_H" "$PR_STEPS" "$PR_CFG" "$PR_SAMPLER" "$PR_SCHED"
|
||||
comfy_host
|
||||
mkdir -p "$WEBUI_DIR" "$COMFY_DIR"
|
||||
{
|
||||
@@ -254,6 +255,14 @@ webui_comfy_link() {
|
||||
echo "IMAGE_STEPS=${PR_STEPS}"
|
||||
echo "COMFYUI_WORKFLOW=${WF_JSON}"
|
||||
echo "COMFYUI_WORKFLOW_NODES=${COMFY_WORKFLOW_NODES}"
|
||||
# 이미지 편집(그림 → 그림): 같은 모델·크기, 편집용 작업흐름 (20_webui_image_sync.sh)
|
||||
echo "ENABLE_IMAGE_EDIT=true"
|
||||
echo "IMAGE_EDIT_ENGINE=comfyui"
|
||||
echo "IMAGE_EDIT_MODEL=${file}"
|
||||
echo "IMAGE_EDIT_SIZE=${PR_W}x${PR_H}"
|
||||
echo "IMAGES_EDIT_COMFYUI_BASE_URL=http://${CI_HOST}:8188"
|
||||
echo "IMAGES_EDIT_COMFYUI_WORKFLOW=${WF_EDIT_JSON}"
|
||||
echo "IMAGES_EDIT_COMFYUI_WORKFLOW_NODES=${COMFY_EDIT_WORKFLOW_NODES}"
|
||||
} > "$WEBUI_ENV_FILE"
|
||||
printf '%s|%s\n' "$CI_NAME" "$file" > "$COMFY_LINK_FILE"
|
||||
echo -e "${GREEN}✅ 연결 설정 저장: ${WEBUI_ENV_FILE}${RESET}"
|
||||
@@ -266,9 +275,11 @@ webui_comfy_link() {
|
||||
fi
|
||||
webui_create || return 1
|
||||
webui_wait_ready || return 1
|
||||
webui_image_sync force # WebUI DB에 저장된 이미지 설정도 이 값으로 맞춤 (DB 값이 환경변수보다 먼저 쓰임)
|
||||
webui_comfy_check
|
||||
echo -e "${CYAN}\n사용법: WebUI 대화창의 [+] 또는 도구 버튼에서 '이미지 생성'을 켜고 그림을 요청하세요.${RESET}"
|
||||
echo -e "${GRAY}※ WebUI 관리자 설정 → 이미지 화면에서 직접 저장한 적이 있으면 그 값이 우선합니다. 그때는 그 화면에서 엔진 ComfyUI, 주소 http://${CI_HOST}:8188 로 맞춰 주세요.${RESET}"
|
||||
echo -e "${CYAN}\n사용법: WebUI 대화창 입력칸 아래 왼쪽 두 번째 버튼(통합) → '이미지' 스위치를 켜고 그림을 요청하세요.${RESET}"
|
||||
echo -e "${CYAN}그림 고치기: 그림을 채팅에 올리거나 방금 만든 그림이 있는 채팅에서, '이미지'를 켠 채 고칠 내용을 보내세요. (원본을 60%만 바꿈)${RESET}"
|
||||
echo -e "${GRAY}※ 채팅 모델이 도구(tools)를 지원하지 않는다는 오류가 나면: 설정 → 일반 → 모델 매개변수 → '함수 호출'을 '레거시'로 바꾸고 저장하세요.${RESET}"
|
||||
}
|
||||
|
||||
# 최신 안정판 바로 설치 (버전 목록을 못 가져오면 고르기 창) → 성공하면 CI_* 가 새 버전
|
||||
|
||||
131
src/platform/mac/20_webui_image_sync.sh
Normal file
131
src/platform/mac/20_webui_image_sync.sh
Normal file
@@ -0,0 +1,131 @@
|
||||
# JJ Ollama Manager (Mac) — src/platform/mac/20_webui_image_sync.sh : Open WebUI 이미지 생성·편집 설정 (DB 맞춤)
|
||||
# jj_ollama_manager.sh 가 순서대로 불러옵니다 (직접 실행하지 않음). 2026-11-05 추가 (Windows 15_webui_image_sync.ps1과 같은 동작)
|
||||
#
|
||||
# Open WebUI는 한 번 저장된 설정(webui.db)을 환경변수(comfyui.env)보다 먼저 씀 → env를 바꿔도 반영되지 않는 문제 대응
|
||||
# 기본: 고장 난 값만 고침 (노드 ID가 비어 있음 / DB 주소로 ComfyUI 접속이 안 되고 env 주소는 됨 / 편집을 한 번도 설정하지 않음)
|
||||
# force: env 값 전체를 DB에 씀 ('Open WebUI와 연결'에서 모델을 고를 때)
|
||||
|
||||
# ---------- 이미지 편집 (그림 → 그림) ----------
|
||||
COMFY_EDIT_DENOISE="0.6" # 편집 강도: 0.3 = 원본 거의 그대로 · 0.6 = 기본 · 0.9 = 거의 새로 그림
|
||||
|
||||
# 편집용 작업흐름 → 전역 WF_EDIT_JSON
|
||||
# 올린 그림(1) → 크기 맞춤(11) → 잠재 공간(10) → KSampler(3, denoise) → 저장(9)
|
||||
comfy_edit_workflow_json() {
|
||||
local file="$1" w="$2" h="$3" steps="$4" cfg="$5" sampler="$6" sched="$7"
|
||||
WF_EDIT_JSON='{"1":{"inputs":{"image":"example.png"},"class_type":"LoadImage"},"11":{"inputs":{"upscale_method":"lanczos","width":'"$w"',"height":'"$h"',"crop":"center","image":["1",0]},"class_type":"ImageScale"},"10":{"inputs":{"pixels":["11",0],"vae":["4",2]},"class_type":"VAEEncode"},"3":{"inputs":{"seed":0,"steps":'"$steps"',"cfg":'"$cfg"',"sampler_name":"'"$sampler"'","scheduler":"'"$sched"'","denoise":'"$COMFY_EDIT_DENOISE"',"model":["4",0],"positive":["6",0],"negative":["7",0],"latent_image":["10",0]},"class_type":"KSampler"},"4":{"inputs":{"ckpt_name":"'"$file"'"},"class_type":"CheckpointLoaderSimple"},"6":{"inputs":{"text":"Prompt","clip":["4",1]},"class_type":"CLIPTextEncode"},"7":{"inputs":{"text":"low quality, blurry, bad anatomy, watermark, text","clip":["4",1]},"class_type":"CLIPTextEncode"},"8":{"inputs":{"samples":["3",0],"vae":["4",2]},"class_type":"VAEDecode"},"9":{"inputs":{"filename_prefix":"OpenWebUI_edit","images":["8",0]},"class_type":"SaveImage"}}'
|
||||
}
|
||||
|
||||
# 편집은 부정 프롬프트·단계를 넘기지 않으므로(Open WebUI) 그 두 가지는 연결하지 않음
|
||||
COMFY_EDIT_WORKFLOW_NODES='[{"type":"image","key":"image","node_ids":["1"]},{"type":"prompt","key":"text","node_ids":["6"]},{"type":"model","key":"ckpt_name","node_ids":["4"]},{"type":"width","key":"width","node_ids":["11"]},{"type":"height","key":"height","node_ids":["11"]},{"type":"seed","key":"seed","node_ids":["3"]}]'
|
||||
|
||||
# ---------- WebUI DB의 이미지 설정을 comfyui.env에 맞춤 (컨테이너 안 python으로) ----------
|
||||
# ※ bash 3.2는 $( ) 안의 heredoc을 잘못 해석하므로 read -d '' 로 읽습니다.
|
||||
read -r -d '' WEBUI_IMAGE_SYNC_PY <<'PYEOF'
|
||||
import os, sys, json, time, sqlite3, urllib.request
|
||||
e = os.environ
|
||||
force = e.get('JJ_FORCE') == '1'
|
||||
db = sqlite3.connect(e.get('JJ_DB', '/app/backend/data/webui.db'), timeout=15)
|
||||
def get(k):
|
||||
r = db.execute('select value from config where key=?', (k,)).fetchone()
|
||||
if not r: return None
|
||||
v = r[0]
|
||||
return json.loads(v) if isinstance(v, (str, bytes)) else v
|
||||
def same(a, b):
|
||||
try:
|
||||
if isinstance(a, str) and isinstance(b, str) and a.strip()[:1] in '{[' and b.strip()[:1] in '{[':
|
||||
return json.loads(a) == json.loads(b)
|
||||
except Exception:
|
||||
pass
|
||||
return a == b
|
||||
def ok(u):
|
||||
if not u: return False
|
||||
try:
|
||||
return urllib.request.urlopen(u.rstrip('/') + '/system_stats', timeout=5).status == 200
|
||||
except Exception:
|
||||
return False
|
||||
def jl(name):
|
||||
try:
|
||||
return json.loads(e.get(name) or '[]')
|
||||
except Exception:
|
||||
return []
|
||||
def empty_ids(nodes, types):
|
||||
for t in types:
|
||||
m = [n for n in (nodes or []) if isinstance(n, dict) and n.get('type') == t]
|
||||
if not m or not m[0].get('node_ids'):
|
||||
return True
|
||||
return False
|
||||
want = {}
|
||||
# 1) image generation (image_generation.*)
|
||||
if e.get('IMAGE_GENERATION_ENGINE', '').lower() == 'comfyui':
|
||||
nodes = jl('COMFYUI_WORKFLOW_NODES')
|
||||
url = (e.get('COMFYUI_BASE_URL') or '').strip()
|
||||
if force:
|
||||
want['image_generation.enable'] = True
|
||||
want['image_generation.engine'] = 'comfyui'
|
||||
if e.get('IMAGE_GENERATION_MODEL'): want['image_generation.model'] = e['IMAGE_GENERATION_MODEL']
|
||||
if e.get('IMAGE_SIZE'): want['image_generation.size'] = e['IMAGE_SIZE']
|
||||
if (e.get('IMAGE_STEPS') or '').isdigit(): want['image_generation.steps'] = int(e['IMAGE_STEPS'])
|
||||
if url: want['image_generation.comfyui.base_url'] = url
|
||||
if e.get('COMFYUI_WORKFLOW'): want['image_generation.comfyui.workflow'] = e['COMFYUI_WORKFLOW']
|
||||
if nodes: want['image_generation.comfyui.nodes'] = nodes
|
||||
elif get('image_generation.engine') != 'comfyui' and not (get('image_generation.comfyui.workflow') or '').strip():
|
||||
# never set up in WebUI yet (engine still default, no workflow) -> write all generation keys
|
||||
want['image_generation.enable'] = True
|
||||
want['image_generation.engine'] = 'comfyui'
|
||||
if e.get('IMAGE_GENERATION_MODEL'): want['image_generation.model'] = e['IMAGE_GENERATION_MODEL']
|
||||
if e.get('IMAGE_SIZE'): want['image_generation.size'] = e['IMAGE_SIZE']
|
||||
if (e.get('IMAGE_STEPS') or '').isdigit(): want['image_generation.steps'] = int(e['IMAGE_STEPS'])
|
||||
if url: want['image_generation.comfyui.base_url'] = url
|
||||
if e.get('COMFYUI_WORKFLOW'): want['image_generation.comfyui.workflow'] = e['COMFYUI_WORKFLOW']
|
||||
if nodes: want['image_generation.comfyui.nodes'] = nodes
|
||||
else:
|
||||
if nodes and empty_ids(get('image_generation.comfyui.nodes'), ['prompt']):
|
||||
want['image_generation.comfyui.nodes'] = nodes
|
||||
cur_url = get('image_generation.comfyui.base_url') or ''
|
||||
if url and cur_url.strip() != url and not ok(cur_url) and ok(url):
|
||||
want['image_generation.comfyui.base_url'] = url
|
||||
# 2) image edit (images.edit.*)
|
||||
if e.get('IMAGE_EDIT_ENGINE', '').lower() == 'comfyui':
|
||||
enodes = jl('IMAGES_EDIT_COMFYUI_WORKFLOW_NODES')
|
||||
eurl = (e.get('IMAGES_EDIT_COMFYUI_BASE_URL') or '').strip()
|
||||
full = {'images.edit.enable': e.get('ENABLE_IMAGE_EDIT', '').lower() == 'true',
|
||||
'images.edit.engine': 'comfyui'}
|
||||
if e.get('IMAGE_EDIT_MODEL'): full['images.edit.model'] = e['IMAGE_EDIT_MODEL']
|
||||
if e.get('IMAGE_EDIT_SIZE'): full['images.edit.size'] = e['IMAGE_EDIT_SIZE']
|
||||
if eurl: full['images.edit.comfyui.base_url'] = eurl
|
||||
if e.get('IMAGES_EDIT_COMFYUI_WORKFLOW'): full['images.edit.comfyui.workflow'] = e['IMAGES_EDIT_COMFYUI_WORKFLOW']
|
||||
if enodes: full['images.edit.comfyui.nodes'] = enodes
|
||||
if force or not (get('images.edit.comfyui.workflow') or '').strip():
|
||||
want.update(full) # forced, or edit never set up in WebUI yet
|
||||
else:
|
||||
if enodes and empty_ids(get('images.edit.comfyui.nodes'), ['image', 'prompt']):
|
||||
want['images.edit.comfyui.nodes'] = enodes
|
||||
cur_eurl = get('images.edit.comfyui.base_url') or ''
|
||||
if eurl and cur_eurl.strip() != eurl and not ok(cur_eurl) and ok(eurl):
|
||||
want['images.edit.comfyui.base_url'] = eurl
|
||||
if not want and e.get('IMAGE_GENERATION_ENGINE', '').lower() != 'comfyui' and e.get('IMAGE_EDIT_ENGINE', '').lower() != 'comfyui':
|
||||
print('SKIP'); sys.exit(0)
|
||||
changed = [k for k, v in want.items() if not same(get(k), v)]
|
||||
now = int(time.time())
|
||||
for k in changed:
|
||||
db.execute('insert into config(key, value, updated_at) values(?, ?, ?) '
|
||||
'on conflict(key) do update set value=excluded.value, updated_at=excluded.updated_at',
|
||||
(k, json.dumps(want[k], ensure_ascii=False), now))
|
||||
db.commit()
|
||||
print('CHANGED:' + ','.join(k.replace('image_generation.', '').replace('images.', '') for k in changed) if changed else 'OK')
|
||||
PYEOF
|
||||
|
||||
# webui_image_sync [force]
|
||||
webui_image_sync() {
|
||||
[ -f "$WEBUI_ENV_FILE" ] || return 0
|
||||
webui_info
|
||||
[ "$WU_STATE" = "running" ] || return 0
|
||||
local f=0 last
|
||||
[ "$1" = "force" ] && f=1
|
||||
last=$(printf '%s\n' "$WEBUI_IMAGE_SYNC_PY" | podman exec -i -e "JJ_FORCE=$f" "$WEBUI_NAME" python3 - 2>&1 | tail -n 1)
|
||||
case "$last" in
|
||||
CHANGED:*) echo -e "${GREEN}✅ WebUI 이미지 설정(DB)을 연결 설정에 맞췄습니다: ${last#CHANGED:}${RESET}" ;;
|
||||
OK|SKIP|"") ;;
|
||||
*) echo -e "${YELLOW}⚠️ WebUI 이미지 설정(DB)을 확인하지 못했습니다: ${last}${RESET}" ;;
|
||||
esac
|
||||
}
|
||||
83
src/platform/mac/21_git_menu.sh
Normal file
83
src/platform/mac/21_git_menu.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
# JJ Ollama Manager (Mac) — src/platform/mac/21_git_menu.sh : Git 메뉴 (상태 · 최신 받기 · 최근 기록)
|
||||
# jj_ollama_manager.sh 가 순서대로 불러옵니다 (직접 실행하지 않음). 2026-11-05 추가
|
||||
#
|
||||
# - 최신 받기: 바뀐 파일(커밋 안 한 수정)이 있으면 받지 않음, 앞으로 이어 붙일 수 있을 때만 받음(git pull --ff-only)
|
||||
# - 새 코드를 받으면 스크립트를 다시 시작할지 물어봄 (소스는 시작할 때만 읽기 때문)
|
||||
|
||||
git_in_repo() { git -C "$SCRIPT_DIR" "$@"; }
|
||||
|
||||
git_ready() {
|
||||
if ! command -v git >/dev/null 2>&1; then echo -e "${YELLOW}git이 없습니다. (터미널에서 xcode-select --install)${RESET}"; return 1; fi
|
||||
if ! git_in_repo rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo -e "${YELLOW}이 폴더는 Git 저장소가 아닙니다: ${SCRIPT_DIR}${RESET}"; return 1; fi
|
||||
return 0
|
||||
}
|
||||
|
||||
git_status_show() {
|
||||
echo -e "${CYAN}저장소: ${SCRIPT_DIR}${RESET}"
|
||||
echo -e "원격: $(git_in_repo remote get-url origin 2>/dev/null)"
|
||||
echo -e "${CYAN}\nGitea에서 새 기록을 확인합니다 (git fetch)...${RESET}"
|
||||
git_in_repo fetch -q origin 2>&1 | tail -n 3
|
||||
local ab behind ahead
|
||||
ab=$(git_in_repo rev-list --left-right --count 'HEAD...@{u}' 2>/dev/null)
|
||||
ahead=$(echo "$ab" | awk '{print $1}'); behind=$(echo "$ab" | awk '{print $2}')
|
||||
echo
|
||||
git_in_repo status -sb
|
||||
if [ -n "$ab" ]; then
|
||||
if [ "${behind:-0}" -gt 0 ]; then echo -e "${YELLOW}\n⬇ Gitea에 새 커밋 ${behind}개가 있습니다. '최신 받기'로 받을 수 있습니다.${RESET}"
|
||||
else echo -e "${GREEN}\n✅ Gitea와 같거나 더 최신입니다.${RESET}"; fi
|
||||
[ "${ahead:-0}" -gt 0 ] && echo -e "${YELLOW}⬆ 이 Mac에만 있는 커밋 ${ahead}개 (아직 올리지 않음)${RESET}"
|
||||
fi
|
||||
}
|
||||
|
||||
git_pull_latest() {
|
||||
local dirty old new
|
||||
dirty=$(git_in_repo status --porcelain --untracked-files=no)
|
||||
if [ -n "$dirty" ]; then
|
||||
echo -e "${YELLOW}커밋하지 않은 수정이 있어 받지 않았습니다 (덮어쓰기 방지):${RESET}"
|
||||
echo "$dirty"
|
||||
echo -e "${GRAY}수정을 지키려면 터미널에서: git -C \"${SCRIPT_DIR}\" stash (받은 뒤 git stash pop)${RESET}"
|
||||
return 1
|
||||
fi
|
||||
old=$(git_in_repo rev-parse HEAD)
|
||||
echo -e "${CYAN}최신을 받습니다 (git pull --ff-only)...${RESET}"
|
||||
if ! git_in_repo pull --ff-only; then
|
||||
restore_tty
|
||||
echo -e "${RED}❌ 받지 못했습니다. 위 메시지를 확인해 주세요. (이 Mac에만 있는 커밋이 있으면 바로 이어 붙일 수 없음)${RESET}"
|
||||
return 1
|
||||
fi
|
||||
restore_tty
|
||||
new=$(git_in_repo rev-parse HEAD)
|
||||
if [ "$old" = "$new" ]; then echo -e "${GREEN}✅ 이미 최신입니다. ($(git_in_repo log -1 --format='%h %s'))${RESET}"; return 0; fi
|
||||
echo -e "${GREEN}\n✅ 받았습니다: ${old:0:7} → ${new:0:7}${RESET}"
|
||||
git_in_repo log --oneline "${old}..${new}"
|
||||
git_in_repo diff --stat "${old}" "${new}" | tail -n 1
|
||||
if confirm "새 코드로 스크립트를 다시 시작할까요? (지금 실행 중인 것은 예전 코드)"; then
|
||||
restore_tty
|
||||
exec bash "$SCRIPT_PATH"
|
||||
fi
|
||||
echo -e "${YELLOW}※ 새 코드는 스크립트를 다시 시작해야 적용됩니다.${RESET}"
|
||||
}
|
||||
|
||||
git_menu() {
|
||||
git_ready || { pause_return; return; }
|
||||
while true; do
|
||||
local br head
|
||||
br=$(git_in_repo rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||
head=$(git_in_repo log -1 --format='%h %s' 2>/dev/null)
|
||||
menu_reset
|
||||
add_item "pull" " ⬇ 최신 받기 ${GRAY}(Gitea에서 git pull, 받으면 스크립트 다시 시작)${RESET}"
|
||||
add_item "status" " 상태 보기 ${GRAY}(브랜치 · 바뀐 파일 · Gitea와 차이)${RESET}"
|
||||
add_item "log" " 최근 기록 15개"
|
||||
add_item "back" "${GRAY}← 메인 메뉴로 돌아가기${RESET}"
|
||||
menu_select "${BLUE}${BOLD}Git${RESET} ${GRAY}${SCRIPT_DIR} · 브랜치 ${br} · ${head}${RESET}"$'\n'"${KEY_HELP}"
|
||||
local rc=$?
|
||||
[ $rc -eq 1 ] && return
|
||||
[ $rc -eq 2 ] && continue
|
||||
case "$MENU_RESULT" in
|
||||
back) return ;;
|
||||
pull) clear; git_pull_latest; pause_return ;;
|
||||
status) clear; git_status_show; pause_return ;;
|
||||
log) clear; git_in_repo log --oneline --decorate -15; pause_return ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
@@ -76,6 +76,16 @@ if e.get('IMAGE_GENERATION_ENGINE', '').lower() == 'comfyui':
|
||||
if url: want['image_generation.comfyui.base_url'] = url
|
||||
if e.get('COMFYUI_WORKFLOW'): want['image_generation.comfyui.workflow'] = e['COMFYUI_WORKFLOW']
|
||||
if nodes: want['image_generation.comfyui.nodes'] = nodes
|
||||
elif get('image_generation.engine') != 'comfyui' and not (get('image_generation.comfyui.workflow') or '').strip():
|
||||
# never set up in WebUI yet (engine still default, no workflow) -> write all generation keys
|
||||
want['image_generation.enable'] = True
|
||||
want['image_generation.engine'] = 'comfyui'
|
||||
if e.get('IMAGE_GENERATION_MODEL'): want['image_generation.model'] = e['IMAGE_GENERATION_MODEL']
|
||||
if e.get('IMAGE_SIZE'): want['image_generation.size'] = e['IMAGE_SIZE']
|
||||
if (e.get('IMAGE_STEPS') or '').isdigit(): want['image_generation.steps'] = int(e['IMAGE_STEPS'])
|
||||
if url: want['image_generation.comfyui.base_url'] = url
|
||||
if e.get('COMFYUI_WORKFLOW'): want['image_generation.comfyui.workflow'] = e['COMFYUI_WORKFLOW']
|
||||
if nodes: want['image_generation.comfyui.nodes'] = nodes
|
||||
else:
|
||||
if nodes and empty_ids(get('image_generation.comfyui.nodes'), ['prompt']):
|
||||
want['image_generation.comfyui.nodes'] = nodes
|
||||
|
||||
76
src/platform/windows/20_git_menu.ps1
Normal file
76
src/platform/windows/20_git_menu.ps1
Normal file
@@ -0,0 +1,76 @@
|
||||
# JJ Ollama Manager (Windows) — src/platform/windows/20_git_menu.ps1 : Git 메뉴 (상태 · 최신 받기 · 최근 기록)
|
||||
# jj_ollama_manager.ps1 가 순서대로 불러옵니다 (직접 실행하지 않음). 2026-11-05 추가
|
||||
#
|
||||
# - 최신 받기: 바뀐 파일(커밋 안 한 수정)이 있으면 받지 않음, 앞으로 이어 붙일 수 있을 때만 받음(git pull --ff-only)
|
||||
# - 새 코드를 받으면 새 창에서 RUN.cmd로 다시 시작할지 물어봄 (소스는 시작할 때만 읽기 때문)
|
||||
|
||||
function Invoke-GitRepo { & git -C $ScriptDir @args }
|
||||
|
||||
function Test-GitReady {
|
||||
if (-not (Get-Command git -ErrorAction SilentlyContinue)) { Write-C "${YELLOW}git이 없습니다. (winget install --id Git.Git -e)${RESET}"; return $false }
|
||||
$null = & git -C $ScriptDir rev-parse --is-inside-work-tree 2>$null
|
||||
if ($LASTEXITCODE -ne 0) { Write-C "${YELLOW}이 폴더는 Git 저장소가 아닙니다: $ScriptDir${RESET}"; return $false }
|
||||
return $true
|
||||
}
|
||||
|
||||
function Show-GitStatus {
|
||||
Write-C "${CYAN}저장소: $ScriptDir${RESET}"
|
||||
Write-C "원격: $(Invoke-GitRepo remote get-url origin 2>$null)"
|
||||
Write-C "${CYAN}`nGitea에서 새 기록을 확인합니다 (git fetch)...${RESET}"
|
||||
Invoke-GitRepo fetch -q origin 2>&1 | Select-Object -Last 3 | ForEach-Object { Write-Host "$_" }
|
||||
$ab = "$(Invoke-GitRepo rev-list --left-right --count 'HEAD...@{u}' 2>$null)".Trim() -split '\s+'
|
||||
Write-Host ''
|
||||
Invoke-GitRepo status -sb | ForEach-Object { Write-Host "$_" }
|
||||
if ($ab.Count -ge 2) {
|
||||
$ahead = [int]$ab[0]; $behind = [int]$ab[1]
|
||||
if ($behind -gt 0) { Write-C "${YELLOW}`n⬇ Gitea에 새 커밋 ${behind}개가 있습니다. '최신 받기'로 받을 수 있습니다.${RESET}" }
|
||||
else { Write-C "${GREEN}`n✅ Gitea와 같거나 더 최신입니다.${RESET}" }
|
||||
if ($ahead -gt 0) { Write-C "${YELLOW}⬆ 이 PC에만 있는 커밋 ${ahead}개 (아직 올리지 않음)${RESET}" }
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-GitPullLatest {
|
||||
$dirty = @(Invoke-GitRepo status --porcelain --untracked-files=no 2>$null | Where-Object { "$_".Trim() })
|
||||
if ($dirty.Count -gt 0) {
|
||||
Write-C "${YELLOW}커밋하지 않은 수정이 있어 받지 않았습니다 (덮어쓰기 방지):${RESET}"
|
||||
$dirty | ForEach-Object { Write-Host "$_" }
|
||||
Write-C "${GRAY}수정을 지키려면: git -C `"$ScriptDir`" stash (받은 뒤 git stash pop)${RESET}"
|
||||
return
|
||||
}
|
||||
$old = "$(Invoke-GitRepo rev-parse HEAD)".Trim()
|
||||
Write-C "${CYAN}최신을 받습니다 (git pull --ff-only)...${RESET}"
|
||||
Invoke-GitRepo pull --ff-only 2>&1 | ForEach-Object { Write-Host "$_" }
|
||||
if ($LASTEXITCODE -ne 0) { Write-C "${RED}❌ 받지 못했습니다. 위 메시지를 확인해 주세요. (이 PC에만 있는 커밋이 있으면 바로 이어 붙일 수 없음)${RESET}"; return }
|
||||
$new = "$(Invoke-GitRepo rev-parse HEAD)".Trim()
|
||||
if ($old -eq $new) { Write-C "${GREEN}✅ 이미 최신입니다. ($(Invoke-GitRepo log -1 --format='%h %s'))${RESET}"; return }
|
||||
Write-C "${GREEN}`n✅ 받았습니다: $($old.Substring(0,7)) → $($new.Substring(0,7))${RESET}"
|
||||
Invoke-GitRepo log --oneline "$old..$new" | ForEach-Object { Write-Host "$_" }
|
||||
Invoke-GitRepo diff --stat $old $new | Select-Object -Last 1 | ForEach-Object { Write-Host "$_" }
|
||||
$run = Join-Path $ScriptDir 'RUN.cmd'
|
||||
if ((Test-Path -LiteralPath $run) -and (Confirm-Choice '새 코드로 다시 시작할까요? (새 창에서 RUN.cmd 실행, 이 창은 닫힘)')) {
|
||||
Start-Process -FilePath $run -WorkingDirectory $ScriptDir
|
||||
exit 0
|
||||
}
|
||||
Write-C "${YELLOW}※ 새 코드는 스크립트를 다시 시작해야 적용됩니다 (RUN.cmd).${RESET}"
|
||||
}
|
||||
|
||||
function Show-GitMenu {
|
||||
if (-not (Test-GitReady)) { Wait-Return; return }
|
||||
while ($true) {
|
||||
$br = "$(Invoke-GitRepo rev-parse --abbrev-ref HEAD 2>$null)".Trim()
|
||||
$head = "$(Invoke-GitRepo log -1 --format='%h %s' 2>$null)".Trim()
|
||||
$items = @(
|
||||
(New-MenuItem 'pull' " ⬇ 최신 받기 ${GRAY}(Gitea에서 git pull, 받으면 다시 시작)${RESET}")
|
||||
(New-MenuItem 'status' " 상태 보기 ${GRAY}(브랜치 · 바뀐 파일 · Gitea와 차이)${RESET}")
|
||||
(New-MenuItem 'log' ' 최근 기록 15개')
|
||||
(New-MenuItem 'back' "${GRAY}← 메인 메뉴로 돌아가기${RESET}")
|
||||
)
|
||||
$sel = Show-Menu -Header "${BLUE}${BOLD}Git${RESET} ${GRAY}$ScriptDir · 브랜치 $br · $head${RESET}`n$($script:KeyHelp)" -Items $items
|
||||
if (-not $sel -or $sel -eq 'back') { return }
|
||||
switch ($sel) {
|
||||
'pull' { Clear-Host; Invoke-GitPullLatest; Wait-Return }
|
||||
'status' { Clear-Host; Show-GitStatus; Wait-Return }
|
||||
'log' { Clear-Host; Invoke-GitRepo log --oneline --decorate -15 | ForEach-Object { Write-Host "$_" }; Wait-Return }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,3 +252,7 @@ launchctl bootout gui/$(id -u)/com.ollama.serve; sleep 3; launchctl bootstrap gu
|
||||
- 사용 (레거시): 최근 대화에 그림이 있고 이미지 편집이 켜져 있으면, `이미지`를 켠 채 보낸 글로 새로 그리지 않고 그 그림을 고침
|
||||
- 편집 강도는 `15_webui_image_sync.ps1`의 `$ComfyEditDenoise` (0.3 원본 거의 그대로 ~ 0.9 거의 새로)
|
||||
|
||||
### 25-2. Mac WebUI에 이미지 스위치가 없음 (2026-11-05)
|
||||
- 원인: Windows에서 한 이미지 설정은 Windows WebUI DB에만 들어감. Mac WebUI DB는 `image_generation.enable=false`, 엔진 `openai`, 주소·노드 비어 있음 (`podman exec open-webui python3 …` 로 확인)
|
||||
- 해결: Mac `src/platform/mac/20_webui_image_sync.sh` (Windows와 같은 python) → ComfyUI (Podman) 관리 → 'Open WebUI와 연결' 실행
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ updated: 2026-11-03
|
||||
## 커밋
|
||||
| 날짜 | 커밋 | 내용 |
|
||||
|---|---|---|
|
||||
| 2026-11-05 | (이번) | Ollama 서버 재시작: 모델 저장 위치 그대로 / 바꾸고 기존 모델 옮기기 / 위치만 바꾸기 (Windows·Mac `19_ollama_restart`, 위치 변경 함수에 옮기지 않기 추가) |
|
||||
| 2026-11-05 | (이번) | 메인 메뉴 Git(⬇ 최신 받기 · 상태 · 최근 기록, 받으면 다시 시작) (Windows `20_git_menu` · Mac `21_git_menu`) |
|
||||
| 2026-11-05 | (이번) | Mac: WebUI 이미지 생성·편집 DB 맞춤(`20_webui_image_sync.sh`) · 두 플랫폼: WebUI에서 이미지 설정을 한 번도 안 한 DB면 생성 설정 전체 기록 |
|
||||
| 2026-11-05 | f567af2 | Ollama 서버 재시작: 모델 저장 위치 그대로 / 바꾸고 기존 모델 옮기기 / 위치만 바꾸기 (Windows·Mac `19_ollama_restart`, 위치 변경 함수에 옮기지 않기 추가) |
|
||||
| 2026-11-05 | cd003bf | 메인 메뉴 Podman 서버 기동·종료·재시작(그대로/CPU·메모리 바꿔서, 멈추기 전 컨테이너 다시 켬) · 서버 → Ollama 서버 (Windows·Mac `18_podman_server`) |
|
||||
| 2026-11-05 | fcea2ab | 상태 화면 맨 위에 Podman 줄: 상태·버전·가상 머신 크기·컨테이너 수 / CPU(컨테이너 합계)·메모리·디스크 사용, 매번 새로 읽음 (Windows·Mac `17_podman_monitor`) |
|
||||
| 2026-11-05 | 907a999 | 완전 초기화(메인 메뉴 검색창에 `0000000000`): Windows `16_factory_reset.ps1` · Mac `16_factory_reset.sh` — 백업 zip → 가상 머신·데이터·프로그램 삭제, 모델은 매번 물어봄 |
|
||||
|
||||
@@ -37,9 +37,9 @@ Ollama · Open WebUI · ComfyUI 통합 운영·관리 스크립트 (Windows `jj_
|
||||
## 소스
|
||||
| 파일 | 대상 | 줄 수 (2026-11-05) |
|
||||
|---|---|---|
|
||||
| `jj_ollama_manager.ps1` | Windows 11 (PowerShell 5.1) 실행 파일: 설정 + 소스 불러오기 + 시작 | 341줄 |
|
||||
| `jj_ollama_manager.ps1` | Windows 11 (PowerShell 5.1) 실행 파일: 설정 + 소스 불러오기 + 시작 | 344줄 |
|
||||
| `RUN.cmd` | Windows 실행용 | 4줄 |
|
||||
| `jj_ollama_manager.sh` | macOS (Intel Mac, bash 3.2) 실행 파일: 설정 + 소스 불러오기 + 시작 — Linux는 아직 미지원 ([[10_프로젝트/08_MacPro_확장_검토]]) | 322줄 |
|
||||
| `jj_ollama_manager.sh` | macOS (Intel Mac, bash 3.2) 실행 파일: 설정 + 소스 불러오기 + 시작 — Linux는 아직 미지원 ([[10_프로젝트/08_MacPro_확장_검토]]) | 326줄 |
|
||||
| `src/platform/windows/01_common_hardware_menu.ps1` | Windows 기능 소스 | 337줄 |
|
||||
| `src/platform/windows/02_menu_library.ps1` | Windows 기능 소스 | 397줄 |
|
||||
| `src/platform/windows/03_library_monitor.ps1` | Windows 기능 소스 | 375줄 |
|
||||
@@ -54,11 +54,12 @@ Ollama · Open WebUI · ComfyUI 통합 운영·관리 스크립트 (Windows `jj_
|
||||
| `src/platform/windows/12_comfy_install.ps1` | Windows 기능 소스 | 372줄 |
|
||||
| `src/platform/windows/13_comfy_stack_storage.ps1` | Windows 기능 소스 | 383줄 |
|
||||
| `src/platform/windows/14_storage_quickopen.ps1` | Windows 기능 소스 | 285줄 |
|
||||
| `src/platform/windows/15_webui_image_sync.ps1` | Windows 기능 소스 (WebUI 이미지 생성·편집 DB 맞춤) | 127줄 |
|
||||
| `src/platform/windows/15_webui_image_sync.ps1` | Windows 기능 소스 (WebUI 이미지 생성·편집 DB 맞춤) | 137줄 |
|
||||
| `src/platform/windows/16_factory_reset.ps1` | Windows 기능 소스 (완전 초기화) | 177줄 |
|
||||
| `src/platform/windows/17_podman_monitor.ps1` | Windows 기능 소스 (상태 화면 맨 위 Podman 줄) | 88줄 |
|
||||
| `src/platform/windows/18_podman_server.ps1` | Windows 기능 소스 (Podman 서버 기동·종료·재시작) | 139줄 |
|
||||
| `src/platform/windows/19_ollama_restart.ps1` | Windows 기능 소스 (Ollama 서버 재시작 · 모델 저장 위치 선택) | 31줄 |
|
||||
| `src/platform/windows/20_git_menu.ps1` | Windows 기능 소스 (Git 메뉴: 최신 받기·상태·기록) | 76줄 |
|
||||
| `src/platform/mac/01_common_launchd_menu.sh` | Mac 기능 소스 | 355줄 |
|
||||
| `src/platform/mac/02_library_monitor.sh` | Mac 기능 소스 | 412줄 |
|
||||
| `src/platform/mac/03_monitor_preview.sh` | Mac 기능 소스 | 408줄 |
|
||||
@@ -66,10 +67,10 @@ Ollama · Open WebUI · ComfyUI 통합 운영·관리 스크립트 (Windows `jj_
|
||||
| `src/platform/mac/05_loaded_model_action.sh` | Mac 기능 소스 | 358줄 |
|
||||
| `src/platform/mac/06_model_menus.sh` | Mac 기능 소스 | 375줄 |
|
||||
| `src/platform/mac/07_launch_podman.sh` | Mac 기능 소스 | 385줄 |
|
||||
| `src/platform/mac/08_webui.sh` | Mac 기능 소스 | 386줄 |
|
||||
| `src/platform/mac/08_webui.sh` | Mac 기능 소스 | 389줄 |
|
||||
| `src/platform/mac/09_webui_menu_comfy.sh` | Mac 기능 소스 | 400줄 |
|
||||
| `src/platform/mac/10_comfy_network_install.sh` | Mac 기능 소스 | 381줄 |
|
||||
| `src/platform/mac/11_comfy_models_link.sh` | Mac 기능 소스 | 341줄 |
|
||||
| `src/platform/mac/11_comfy_models_link.sh` | Mac 기능 소스 | 352줄 |
|
||||
| `src/platform/mac/12_comfy_stack_storage.sh` | Mac 기능 소스 | 398줄 |
|
||||
| `src/platform/mac/13_storage_paths.sh` | Mac 기능 소스 | 403줄 |
|
||||
| `src/platform/mac/14_setup.sh` | Mac 기능 소스 | 206줄 |
|
||||
@@ -78,5 +79,7 @@ Ollama · Open WebUI · ComfyUI 통합 운영·관리 스크립트 (Windows `jj_
|
||||
| `src/platform/mac/17_podman_monitor.sh` | Mac 기능 소스 (상태 화면 맨 위 Podman 줄) | 66줄 |
|
||||
| `src/platform/mac/18_podman_server.sh` | Mac 기능 소스 (Podman 서버 기동·종료·재시작) | 136줄 |
|
||||
| `src/platform/mac/19_ollama_restart.sh` | Mac 기능 소스 (Ollama 서버 재시작 · 모델 저장 위치 선택) | 32줄 |
|
||||
| `src/platform/mac/20_webui_image_sync.sh` | Mac 기능 소스 (WebUI 이미지 생성·편집 DB 맞춤) | 131줄 |
|
||||
| `src/platform/mac/21_git_menu.sh` | Mac 기능 소스 (Git 메뉴: 최신 받기·상태·기록) | 83줄 |
|
||||
|
||||
> 소스 규칙(파일당 300~400줄, 700줄 이하) 준수 — 2026-11-05 분리. 검사: `python wiki/tools/check_lines.py .` (`.sh`·`.ps1` 포함)
|
||||
|
||||
Reference in New Issue
Block a user