## What
Adds a 'Download from URL' section to the Models tab. Paste a HuggingFace
URL (or any direct .gguf URL) and the dashboard fetches it into
gpu/llama_models/ with live progress, speed, ETA, and cancel support.
## Backend
### `dashboard/src/lib/downloads.ts` (new)
In-memory download tracker. Single Node process, so no DB needed.
- `startModelDownload(url, filenameOverride?)` — validates URL (http/https
only), sanitizes filename (.gguf only, no path traversal), spawns curl:
curl -L -f -S --progress-bar -o <dest>.part <url>
curl follows redirects (HuggingFace, Cloudflare R2), fails on HTTP 4xx/5xx,
writes to <dest>.part for atomic rename on success.
- `subscribeToJob(id, cb)` — pub/sub for progress updates
- `cancelDownload(id)` — sends SIGTERM to curl, deletes .part file
- `listJobs()` / `getJob(id)` — read access
- `publicJob(job)` — strips internal fields (_child, _subscribers) before
returning to API caller
Progress tracking:
- Parses curl --progress-bar stderr for percent (looks like '#### 54.3%')
- Periodically stats the .part file for actual bytes downloaded (more
reliable than parsing curl output)
- Does HEAD request via curl -I to get Content-Length for total bytes
History: keeps last 50 finished jobs to avoid memory bloat.
### API routes (all under /api/models/download/)
- `POST /api/models/download` — body: {url, filename?}, returns job
- `GET /api/models/download/status` — returns all jobs (active + recent)
- `GET /api/models/download/[id]/stream` — SSE push of progress events:
event: progress
data: {id, status, percent, bytesDownloaded, bytesTotal, ...}
Plus 'end' event when job reaches terminal state.
- `POST /api/models/download/[id]/cancel` — SIGTERMs curl, deletes .part
### Dockerfile
Added `curl` to the apk add list — needed for the actual download.
`wget` was already present (kept for compatibility with the rest of the
codebase that uses it for health checks).
## Frontend
### ModelsTab additions
- URL input + Download button — Enter to submit
- 'Active downloads' list with progress bars, bytes downloaded / total,
speed (e.g. '1.5 MB/s'), elapsed time, Cancel button
- 'Recent' list (last 5 finished) — shows final size + duration
### DownloadJobRow component
Reusable row for both active and finished jobs. Two modes:
- Full (default): badge + filename + progress bar + stats + source URL link
- Compact: smaller, just badge + filename + final size/duration
### Main component state
- `downloadJobs: DownloadJob[]` — full job list
- `downloadUrl: string` — URL input state
- `downloadsActiveRef` — guards SSE subscription lifecycle
- `downloadSSERef` — Map<jobId, EventSource> for cleanup
On mount, fetches existing download jobs (in case page was refreshed
mid-download). For each active job, opens an EventSource subscription.
On 'end' event, closes the SSE and refreshes the models list (file
should now be on disk).
### Handlers
- `handleDownload()` — POST /api/models/download, then start SSE
- `handleCancelDownload(id)` — POST /api/models/download/[id]/cancel,
closes SSE, refreshes job list
- `refreshDownloadJobs()` — GET /api/models/download/status, manages
SSE subscriptions based on which jobs are active
## Verification
- `npm run build` — OK, 25 routes (4 new download 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 Models tab, paste a URL like
'https://huggingface.co/bartowski/Qwen2.5-7B-Instruct-Q8_0.gguf' (or any
direct .gguf link), click Download. Watch progress live, cancel if needed.
File appears in the models list automatically when download completes.
## Files changed
- dashboard/src/lib/downloads.ts — new (download tracker + curl wrapper)
- dashboard/src/app/api/models/download/route.ts — new (POST start)
- dashboard/src/app/api/models/download/status/route.ts — new (GET list)
- dashboard/src/app/api/models/download/[id]/stream/route.ts — new (SSE)
- dashboard/src/app/api/models/download/[id]/cancel/route.ts — new (POST cancel)
- dashboard/Dockerfile — added curl to apk add
- dashboard/src/app/page.tsx — ModelsTab gets Download section,
DownloadJobRow component, DownloadJob type, SSE-based handlers
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