diff --git a/jj_ollama_manager.sh b/jj_ollama_manager.sh index e9b8e3f..25632ed 100755 --- a/jj_ollama_manager.sh +++ b/jj_ollama_manager.sh @@ -29,7 +29,7 @@ BOLD=$'\033[1m' RESET=$'\033[0m' TAB=$'\t' -APP_VERSION="2.1.1" # JJ Ollama Manager 버전 (메이저.마이너.수정) +APP_VERSION="2.2.0" # JJ Ollama Manager 버전 (메이저.마이너.수정) SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")" # -------------------------------------------------- @@ -377,14 +377,113 @@ normalize_tag() { esac } +# -------------------------------------------------- +# VS Code Continue 설정 자동 갱신 (~/.continue/config.json) +# - 이 Mac Ollama(localhost:11434)의 설치 모델 전부 → "[macpro01][판정] 모델 — 설명" +# - 판정: 추천 · 가능 · 느림 · 확인 필요 · 불가 (fit_check와 같은 기준: 필요 = 올림(GB×1.2)+1, 사용 가능 = 램×0.8) +# - 자동 불러오기(AUTODETECT) 끔: Continue 2.0은 config.yaml이 있으면 그것만 읽으므로 config.yaml은 백업으로 옮김 +# - 내용이 바뀔 때만 쓰고, 바뀌기 전 파일은 config.json.bak_날짜 (최근 5개만 남김) +# -------------------------------------------------- +CONTINUE_DIR="$HOME/.continue" +CONTINUE_HOST="macpro01" +CONTINUE_REC="qwen3-coder:30b=메인 코딩|qwen3.6:35b=에이전트 코딩·이미지|qwen3-vl:2b-instruct=이미지·OCR" +CONTINUE_AUTOCOMPLETE="qwen2.5-coder:1.5b-base" +CONTINUE_EMBED="nomic-embed-text" +read -r -d '' PERL_CONTINUE <<'PERL' +use strict; use warnings; use utf8; use JSON::PP; use Encode qw(decode_utf8); use POSIX qw(ceil floor strftime); +binmode STDOUT, ':utf8'; +my %E = map { $_ => decode_utf8($ENV{$_} // '') } qw(CONT_DIR CONT_HOST CONT_RAM CONT_API CONT_MODE CONT_REC CONT_AC CONT_EMBED); +local $/; my $raw = ; $raw = '' unless defined $raw; +my $tags = eval { JSON::PP->new->utf8->decode($raw) }; +if (!$tags || ref $tags->{models} ne 'ARRAY') { print "ERR|Ollama 모델 목록을 읽지 못했습니다\n"; exit 1 } +my ($dir, $host, $ram, $api) = @E{qw(CONT_DIR CONT_HOST CONT_RAM CONT_API)}; +my %rec; my @reco; my $i = 0; +for (split /\|/, $E{CONT_REC}) { my ($n, $d) = split /=/, $_, 2; next unless $n; $rec{$n} = [$i++, $d]; push @reco, $n } +my $avail = floor($ram * 0.8); +my $moe = qr/-a[0-9.]+b|^gpt-oss:|^mixtral|^llama4|^qwen3-coder:(30b|latest)|^qwen3\.6:35b|^qwen3\.6:latest|^gemma4:26b|^qwen3:(30b|235b)|^qwen3-vl:(30b|235b)|^deepseek-(v2|v3)|^kimi|^glm-4\.[0-9]+-flash|^granite.*moe|^olmoe/; +my %rank = ('추천' => 0, '가능' => 1, '느림' => 2, '확인 필요' => 3, '불가' => 4); +my (@rows, %have); +for my $m (@{ $tags->{models} }) { + my $n = $m->{name} // next; my $b = $m->{size} // 0; my $gb = $b / 1e9; + $have{$n} = 1; (my $base = $n) =~ s/:latest$//; $have{$base} = 1; + my $need = ceil($gb * 1.2) + 1; my ($v, $d); + if ($n =~ /embed|bge-/i) { ($v, $d) = ('불가', '임베딩 전용 (채팅 불가)') } + elsif ($n =~ /z-image|flux/i) { ($v, $d) = ('불가', '그림 생성 전용') } + elsif ($n =~ /-base(?:[-:]|$)/) { ($v, $d) = ('불가', '자동완성 전용') } + elsif ($b < 100e6) { ($v, $d) = ('확인 필요', '크기 정보 없음 (다른 서버 연결용 이름으로 보임)') } + elsif ($need > $avail) { ($v, $d) = ('불가', "메모리 부족 (필요 약 ${need}GB > ${avail}GB)") } + elsif ($rec{$n}) { ($v, $d) = ('추천', $rec{$n}[1]) } + elsif ($n =~ $moe || $gb <= 10) { ($v, $d) = ('가능', "필요 약 ${need}GB") } + else { ($v, $d) = ('느림', "큰 모델이라 CPU에서 느림 (필요 약 ${need}GB)") } + push @rows, { n => $n, v => $v, d => $d, r => $rank{$v}, o => ($rec{$n} ? $rec{$n}[0] : 99) }; +} +# 정렬: 판정 → 추천 순서 → 이름(문자 코드 순, 실행마다 같게) +@rows = sort { $a->{r} <=> $b->{r} || $a->{o} <=> $b->{o} || $a->{n} cmp $b->{n} } @rows; +my $f = "$dir/config.json"; +my $old = ''; if (open my $fh, '<:raw', $f) { local $/; $old = <$fh>; close $fh } +my $cfg = eval { JSON::PP->new->utf8->decode($old) }; $cfg = {} unless ref $cfg eq 'HASH'; +$cfg->{models} = [ map { { title => "[$host][$_->{v}] $_->{n} — $_->{d}", provider => 'ollama', model => $_->{n}, apiBase => $api } } @rows ]; +my $ac = $E{CONT_AC}; +if ($ac ne '' && $have{$ac}) { $cfg->{tabAutocompleteModel} = { title => "[$host][자동완성] $ac", provider => 'ollama', model => $ac, apiBase => $api } } +else { delete $cfg->{tabAutocompleteModel} } +my $em = $E{CONT_EMBED}; +if ($em ne '' && $have{$em}) { $cfg->{embeddingsProvider} = { provider => 'ollama', model => $em, apiBase => $api } } +else { delete $cfg->{embeddingsProvider} } +my $new = JSON::PP->new->utf8->canonical->pretty->encode($cfg); +my $stamp = strftime('%Y%m%d_%H%M%S', localtime); +my @msg; +my $yaml = "$dir/config.yaml"; +if (-e $yaml) { rename $yaml, "$yaml.bak_$stamp" and push @msg, "config.yaml → config.yaml.bak_$stamp (자동 불러오기 끔)" } +my %cnt; $cnt{$_->{v}}++ for @rows; +my $sum = join(' · ', map { "$_ " . ($cnt{$_} // 0) . "개" } ('추천', '가능', '느림', '확인 필요', '불가')); +if ($new eq $old) { print "SAME|" . scalar(@rows) . "개 · $sum" . (@msg ? " · @msg" : '') . "\n"; exit 0 } +if ($old ne '') { + if (open my $o, '>:raw', "$f.bak_$stamp") { print $o $old; close $o; push @msg, "이전 설정 → config.json.bak_$stamp" } + my @baks = sort glob("$dir/config.json.bak_*"); unlink @baks[0 .. $#baks - 5] if @baks > 5; +} +open my $w, '>:raw', "$f.tmp_$$" or do { print "ERR|$f 를 쓸 수 없습니다\n"; exit 1 }; +print $w $new; close $w; rename "$f.tmp_$$", $f or do { print "ERR|$f 를 바꿀 수 없습니다\n"; exit 1 }; +print "NEW|" . scalar(@rows) . "개 · $sum" . (@msg ? " · " . join(' · ', @msg) : '') . "\n"; +PERL + +# Continue 설정 갱신: continue_config_update [show] (show = 결과를 화면에 표시, 없으면 조용히) +continue_config_update() { + local mode="$1" tags res + if [ ! -d "$CONTINUE_DIR" ]; then + [ "$mode" = "show" ] && echo -e "${GRAY}VS Code Continue 설정 폴더가 없습니다 (${CONTINUE_DIR}) — Continue를 설치한 뒤 다시 실행하세요.${RESET}" + return 0 + fi + tags=$(curl -s --max-time 5 "http://127.0.0.1:${OLLAMA_PORT:-11434}/api/tags" 2>/dev/null) + if [ -z "$tags" ]; then + [ "$mode" = "show" ] && echo -e "${YELLOW}Ollama 서버에 연결하지 못해 Continue 설정을 바꾸지 않았습니다. (서버를 먼저 켜 주세요)${RESET}" + return 1 + fi + res=$(printf '%s' "$tags" | CONT_DIR="$CONTINUE_DIR" CONT_HOST="$CONTINUE_HOST" CONT_RAM="$RAM_GB" \ + CONT_API="http://127.0.0.1:${OLLAMA_PORT:-11434}" CONT_REC="$CONTINUE_REC" \ + CONT_AC="$CONTINUE_AUTOCOMPLETE" CONT_EMBED="$CONTINUE_EMBED" perl -e "$PERL_CONTINUE") + printf '%s %s\n' "$(date '+%m-%d %H:%M:%S')" "$res" > "$CACHE_DIR/continue_last.txt" 2>/dev/null + [ "$mode" = "show" ] || return 0 + case "$res" in + NEW\|*) echo -e "${GREEN}✅ Continue 설정을 새로 만들었습니다: ${res#NEW|}${RESET}" + echo -e "${GRAY} ${CONTINUE_DIR}/config.json · VS Code Continue 창에서 모델 목록을 다시 열면 보입니다.${RESET}" ;; + SAME\|*) echo -e "${GREEN}✅ Continue 설정이 이미 최신입니다: ${res#SAME|}${RESET}" ;; + *) echo -e "${RED}❌ ${res#ERR|}${RESET}"; return 1 ;; + esac +} + # 설치된 모델 목록 갱신 (서버가 켜져 있을 때만 정확함) +# 목록이 바뀌면(처음 켤 때·모델 받기·지우기 뒤) VS Code Continue 설정도 조용히 갱신 INSTALLED_LIST="" refresh_installed() { + local prev="$INSTALLED_LIST" if is_server_running; then INSTALLED_LIST=$(ollama list 2>/dev/null | awk 'NR>1 {print $1}') else INSTALLED_LIST="" fi + if [ -n "$INSTALLED_LIST" ] && [ "$INSTALLED_LIST" != "$prev" ]; then + continue_config_update + fi } # 모델 설치 여부 확인 (설치됨 0, 아니면 1) @@ -2469,6 +2568,7 @@ launch_menu() { done add_item "-" "${CYAN}───────────────────────────${RESET}" add_item "interactive" " Ollama 대화형 선택 ${GRAY}(ollama launch, 새 연동 확인용)${RESET}" + add_item "continue" " VS Code Continue 설정 다시 만들기 ${GRAY}(이 Mac 모델 전부 · 판정 표시 · 모델이 바뀌면 자동)${RESET}" add_item "back" "${GRAY}← 이전 메뉴로 돌아가기${RESET}" local header="${BLUE}도구 연동 (ollama launch) - 1단계: 연동할 도구 선택${RESET}" @@ -2479,6 +2579,11 @@ launch_menu() { [ $rc -eq 2 ] && continue case "$MENU_RESULT" in back) return ;; + continue) + clear + ensure_server && continue_config_update show + pause_return + ;; interactive) clear if ensure_server; then @@ -5335,6 +5440,7 @@ fi # 메인 메뉴 # -------------------------------------------------- [ -s "$OLLAMA_MODELS_FILE" ] && ollama_models_apply_env # 재부팅 후에도 Ollama 앱이 바꾼 위치를 쓰도록 +is_server_running && continue_config_update # VS Code Continue 설정을 지금 모델 목록에 맞춤 (바뀔 때만 씀) STATUS_IN_MENUS=1 while true; do menu_reset diff --git a/wiki/01_사용자지시/00_지시목록.md b/wiki/01_사용자지시/00_지시목록.md index ee4add5..b59a105 100644 --- a/wiki/01_사용자지시/00_지시목록.md +++ b/wiki/01_사용자지시/00_지시목록.md @@ -16,3 +16,4 @@ | 2026-11-03 20:50 | 멀티모달 분류를 일반적인 뜻으로 (+ 음성 분류) | 완료 | [[20261103_2050_멀티모달_뜻_바로잡기]] | | 2026-11-03 20:55 | 멀티모달로 통합, 안에서 사진·음성 선택 | 완료 | [[20261103_2055_멀티모달_안에서_사진음성_선택]] | | 2026-11-04 19:30 | Continue 원격 모델(macpro01) 오류 해결 + 설정 파일 정리 + 문제 해결 기록 | 완료 | [[20261104_1930_원격모델_오류_해결]] | +| 2026-11-04 20:36 | 맥 Continue 설정 정리 (작업현황 0-4장) | 진행중 | [[20261104_2036_맥_Continue_설정_정리]] | diff --git a/wiki/01_사용자지시/20261104_2036_맥_Continue_설정_정리.md b/wiki/01_사용자지시/20261104_2036_맥_Continue_설정_정리.md new file mode 100644 index 0000000..5cf4a45 --- /dev/null +++ b/wiki/01_사용자지시/20261104_2036_맥_Continue_설정_정리.md @@ -0,0 +1,83 @@ +--- +일시: 2026-11-04 20:36 (KST) +제목: 맥 VS Code Continue 설정 정리 (프로젝트 문서 작업현황 0-4장 이어서) +status: 진행중 +--- +# 사용자 지시 원문 (수정 없이 보관) +```text +프로젝트 문서 claude/작업현황_2026-11-03.md 의 0-4장(맥 Continue 설정 정리)을 이어서 해줘 +``` + +# 처리 결과 +## 1단계 확인 (읽기만, 2026-11-04 20:36~) +- 맥 Continue 확장 **2.0.0** (`~/.vscode/extensions/continue.continue-2.0.0-darwin-x64`) — Windows와 같은 버전 +- `~/.continue/`에 **`config.yaml`과 `config.json`이 둘 다** 있음 + - `config.yaml` (10/15): Llama 3.1 8B(chat·edit·apply), Qwen2.5-Coder 1.5B(autocomplete), Nomic Embed(embed), **Autodetect(`model: AUTODETECT`)** ← 맥 Ollama 모델이 전부 `(autodetected)`로 나오는 원인 + - `config.json` (10/15): `qwen3.8` 하나 (쓰이지 않음) +- Continue 2.0.0 코드(`out/extension.js` `getPrimaryConfigFilePath`): **`config.yaml`이 있으면 그것을 쓰고, 없을 때만 `config.json`** → Windows처럼 `config.json`만 고치면 맥에서는 반영 안 됨 +- 지금 선택(`index/globalContext.json`): chat·edit·apply = Llama 3.1 8B, autocomplete = Qwen2.5-Coder 1.5B, embed = Transformers.js(내장) +- 맥 git: `24a1d78` (Gitea 최신 `5886220`보다 뒤) → `git pull` 필요 +- "Continue tried to read skill docs" 오류: 확장 코드에 `read_skill` 도구가 있음까지 확인, 원인은 확인 못 함 +## 만든 것 (Mac `.sh` v2.2.0) +- `continue_config_update` + `PERL_CONTINUE`: 맥 Ollama `/api/tags` 전부 → `~/.continue/config.json` + - 제목 `[macpro01][판정] 모델 — 설명`, 판정 기준은 `.sh` `fit_check`·`is_moe_tag`(= Windows `Get-Fit`·`Test-MoeTag`)와 같음 + 임베딩(`embed`·`bge-`)·그림(`z-image`·`flux`)·자동완성(`-base`) 전용은 불가, 100MB 미만은 확인 필요 + - 정렬: 판정(추천→가능→느림→확인 필요→불가) → 추천 순서 → 이름(문자 코드 순) + - 자동완성 `qwen2.5-coder:1.5b-base`, 임베딩 `nomic-embed-text` (설치돼 있을 때만) + - **`config.yaml`은 `config.yaml.bak_날짜`로 옮김** (Continue 2.0은 yaml이 있으면 json을 안 읽음 → 자동 불러오기 꺼짐) + - 내용이 바뀔 때만 쓰고 이전 파일은 `config.json.bak_날짜` (최근 5개), 다른 설정 키는 그대로 둠 + - 결과 한 줄은 `~/.jj_ollama_manager_cache/continue_last.txt` +- 언제: 스크립트 켤 때(서버가 켜져 있으면) · 설치 목록이 바뀔 때(받기·지우기 뒤 `refresh_installed`) · 메뉴 "도구 연동 → VS Code Continue 설정 다시 만들기" +- 시험: 11/4 20:39 맥 `/api/tags`(41개)와 맥 `~/.continue` 복사본으로 실행 → 추천 3 · 가능 25 · 느림 7 · 확인 필요 2 · 불가 4, 두 번째 실행은 "변경 없음", 백업 5개 유지 확인 +- 백업 `_test/jj_ollama_manager.sh.bak_before_continue`, 실행 권한 그대로, `bash -n` 통과 + +### 만들어질 모델 목록 (41개, 이 순서) +```text +[macpro01][추천] qwen3-coder:30b — 메인 코딩 +[macpro01][추천] qwen3.6:35b — 에이전트 코딩·이미지 +[macpro01][추천] qwen3-vl:2b-instruct — 이미지·OCR +[macpro01][가능] deepseek-r1:14b — 필요 약 12GB +[macpro01][가능] gemma4:12b — 필요 약 11GB +[macpro01][가능] gemma4:26b — 필요 약 24GB +[macpro01][가능] gemma4:e4b — 필요 약 13GB +[macpro01][가능] gemma4:latest — 필요 약 13GB +[macpro01][가능] gpt-oss:120b — 필요 약 80GB +[macpro01][가능] gpt-oss:20b — 필요 약 18GB +[macpro01][가능] llama3.1:8b — 필요 약 7GB +[macpro01][가능] llama3.2:latest — 필요 약 4GB +[macpro01][가능] llama3:latest — 필요 약 7GB +[macpro01][가능] mistral:7b — 필요 약 7GB +[macpro01][가능] mistral:latest — 필요 약 7GB +[macpro01][가능] parable/fable:latest — 필요 약 8GB +[macpro01][가능] parable/granite4.1-fable:latest — 필요 약 8GB +[macpro01][가능] parable/qwen3-fable:latest — 필요 약 4GB +[macpro01][가능] qwen2.5-coder:1.5B — 필요 약 3GB +[macpro01][가능] qwen2.5-coder:7b — 필요 약 7GB +[macpro01][가능] qwen2.5-coder:latest — 필요 약 7GB +[macpro01][가능] qwen2.5:3b — 필요 약 4GB +[macpro01][가능] qwen2.5:7b — 필요 약 7GB +[macpro01][가능] qwen3-coder:30b-ko — 필요 약 24GB +[macpro01][가능] qwen3-coder:latest — 필요 약 24GB +[macpro01][가능] qwen3.5:4b — 필요 약 5GB +[macpro01][가능] qwen3.6:35b-ko — 필요 약 29GB +[macpro01][가능] qwen3.6:latest — 필요 약 29GB +[macpro01][느림] coney_/gpt-oss_claude-sonnet4.6:latest — 큰 모델이라 CPU에서 느림 (필요 약 18GB) +[macpro01][느림] deepseek-r1:32b — 큰 모델이라 CPU에서 느림 (필요 약 25GB) +[macpro01][느림] qwen2.5-coder:32b — 큰 모델이라 CPU에서 느림 (필요 약 25GB) +[macpro01][느림] qwen2.5:72b — 큰 모델이라 CPU에서 느림 (필요 약 58GB) +[macpro01][느림] qwen3.8:27b — 큰 모델이라 CPU에서 느림 (필요 약 23GB) +[macpro01][느림] qwen3.8:latest — 큰 모델이라 CPU에서 느림 (필요 약 23GB) +[macpro01][느림] qwen3.8:latest-ko — 큰 모델이라 CPU에서 느림 (필요 약 23GB) +[macpro01][확인 필요] amanago81/claude-sonnet-4-5:latest — 크기 정보 없음 (다른 서버 연결용 이름으로 보임) +[macpro01][확인 필요] treyleo16/haiku-4-5:latest — 크기 정보 없음 (다른 서버 연결용 이름으로 보임) +[macpro01][불가] bge-m3:latest — 임베딩 전용 (채팅 불가) +[macpro01][불가] nomic-embed-text:latest — 임베딩 전용 (채팅 불가) +[macpro01][불가] qwen2.5-coder:1.5b-base — 자동완성 전용 +[macpro01][불가] x/z-image-turbo:latest — 그림 생성 전용 +``` +## 가정 +- 맥에서도 이름표는 `[macpro01]` (Windows 쪽과 같은 이름), 주소는 `http://127.0.0.1:11434` +- 버전 v2.1.1 → **v2.2.0** (새 기능) +## 남은 일 +- 맥 실제 실행 확인 (VS Code Continue 모델 목록) +- "Continue tried to read skill docs" 오류 원인 (확인 못 함) +- Windows `.ps1` `Update-ContinueConfig`는 PC에만 있음 (커밋 전)