## Problem
'цивитай в comfy models нужен скорее' — the CivitAI URL transformation
(model page → API download URL, token append) was only applied to llama
model downloads via `/api/models/download`. ComfyUI model downloads via
`/api/comfy/models/add` just passed the raw URL straight to
model-worker, so CivitAI model page URLs would download HTML instead of
the actual file, and gated/NSFW models would 401 without a token.
## Fix
### Backend
#### `dashboard/src/lib/docker.ts` — addComfyModel()
Now applies the same `prepareCivitaiUrl()` transformation as
`startModelDownload()`:
1. Loads settings (to get the saved civitaiToken)
2. Calls `prepareCivitaiUrl(rawUrl, token)`:
- civitai.com/models/12345 → civitai.com/api/download/models/12345
- civitai.red/... → normalize host to civitai.com
- append ?token=XXX if missing
3. Passes the transformed URL to `modelWorkerExec('add', url, type)`
4. Returns `originalUrl`, `transformedUrl`, `urlNote` in the response
so the frontend can show what happened
Uses lazy `await import('./downloads')` to avoid a circular import
between docker.ts (which exports paths) and downloads.ts (which imports
them).
#### `dashboard/src/app/api/comfy/models/add/route.ts`
Returns the transformation metadata (`originalUrl`, `transformedUrl`,
`urlNote`) in the JSON response.
### Frontend
#### `dashboard/src/app/page.tsx`
- New state: `comfyUrlPreview` — separate from `urlPreview` (which is
for the llama Models tab) so switching tabs doesn't mix them up.
- New debounced effect: watches `comfyAddUrl` and calls
`POST /api/settings {action:'preview-url'}` to get the transformed URL.
- `handleComfyAddModel()` now reads `urlNote` and `transformedUrl`
from the response and includes them in the toast message (multi-line)
so the user sees what happened to their pasted URL.
- `<ComfyTab>` now accepts `civitaiToken`, `onSaveCivitaiToken`, and
`urlPreview` props.
- ComfyTab 'Queue Download' section:
- 'CivitAI token' button (with badge 'set' / 'empty') in the header —
opens a settings panel with password input, Save/Clear buttons, and
a link to https://civitai.com/user/account.
- The settings panel notes that the token is shared with the
llama-models downloader (same settings.json).
- URL input placeholder updated to show CivitAI URLs are accepted.
- Enter key in the URL field queues the download (no need to click
Queue button).
- URL preview card appears below the input when the URL will be
transformed (e.g. civitai.com/models/12345 →
civitai.com/api/download/models/12345?token=...), showing the
transformed URL + note.
## How it works end-to-end
1. User opens Comfy tab → 'CivitAI token' button → pastes token → Save
(stored in `gpu/dashboard/settings.json`, shared with llama downloader)
2. User pastes `https://civitai.com/models/12345` in URL field
3. URL preview card shows:
```
[CivitAI] converted model page → API download URL, added API token
https://civitai.com/api/download/models/12345?token=XXX...
```
4. User selects type (checkpoints/loras/etc) and clicks Queue (or Enter)
5. Backend `addComfyModel()` transforms URL → calls
`docker exec model-worker python3 /app/worker.py add <transformed-url> <type>`
6. Worker downloads the file with token auth → saves to
`gpu/comfy/models/<type>/<filename>`
7. Toast shows: 'Queued: checkpoints\nconverted model page → API download
URL, added API token\n→ https://civitai.com/api/download/models/...'
## Verification
- `npm run build` — OK, 26 routes
- `bash dashboard/validate-build.sh` — all 8 COPY sources ✓, standalone ✓
## After deploy
```sh
git pull && sh build.sh
docker compose up -d --force-recreate dashboard
```
Open Comfy tab → 'CivitAI token' button → paste token → Save.
Paste any CivitAI URL (model page or API download URL) → see preview →
Queue. The model fetches with token auth and lands in the right type
subdirectory.
## Files changed
- dashboard/src/lib/docker.ts — addComfyModel() applies prepareCivitaiUrl
- dashboard/src/app/api/comfy/models/add/route.ts — returns transformation metadata
- dashboard/src/app/page.tsx — comfyUrlPreview state, debounced preview
effect, handleComfyAddModel shows transformation in toast, ComfyTab
gets civitai token UI + URL preview + Enter-to-queue
GPU-Node Dashboard
A small Next.js web dashboard for managing the llama.cpp instance running on the
GPU node. Replaces the need to manually edit .env and call gpuctl over SSH.
Features
- Status overview — live view of all containers (llama, ssh, comfyui, etc.) for the current node instance, with health check + auto-refresh.
- Models list — scans
gpu/llama_models/*.ggufand shows sizes / modified time; click "Use" to switch the active model in the launch config. - Launch config — structured form for
--ctx-size,--parallel,--n-gpu-layers,--threads,--batch-size,--context-overflow, speculative decoding (--spec-type,--model-draft,--spec-draft-n-max), and a free-form extra args textarea for anything else. - Presets — save named configurations and reload them with one click.
- Start / Restart / Stop / Remove llama container via docker compose.
- Live logs — streaming
docker logs -fwith color-coded output. - GPU status — runs
nvidia-smiviadocker execon the llama container (or falls back todocker compose run --rm gpu-test nvidia-smi ...). - Auto-writes
.env— every "Apply / Start" persists the currentLLAMA_MODELandLLAMA_EXTRA_ARGSback to.env, so the existing workflow keeps working.
How it integrates
The dashboard runs as a new dashboard service in compose.yaml. It mounts:
/var/run/docker.sock→ can rundocker composeanddocker pscommands- The host project path (read/write so it can edit
.envand save presets)
On every "Start / Apply" action, the dashboard:
- Persists the structured config to
gpu/dashboard-config.json. - Writes
LLAMA_MODELandLLAMA_EXTRA_ARGSto.env(preserving other vars). - Runs
docker compose --profile llama up -d --force-recreate llamawith the same env vars inlined — identical togpuctl start llama <model> <args>.
The dashboard is exposed via Tailscale serve on port 8090.
Local development
cd dashboard
npm install
npm run dev
You will need to set the same env vars the container would set:
export HOST_PROJECT_PATH=/path/to/GPU-Node # absolute path on host
export PROJECT_DIR=/path/to/GPU-Node # path mounted inside the dev shell
export NODE_INSTANCE=gpu-node
You also need docker and docker compose available on your $PATH, and the
current user must be in a group that can access /var/run/docker.sock.
Building the image
docker build -t gpu-node-dashboard ./dashboard
Or via the project's build.sh after this PR merges — that script will be
extended to build the dashboard image as well.
Tech stack
- Next.js 16 (standalone output, App Router)
- React 19 + TypeScript 5
- Tailwind CSS 4 + shadcn-style components
- Radix UI primitives (select, tabs, switch, label)
- lucide-react icons