The .env.example told users to "copy this to .env", but nothing called
load_dotenv — so os.environ.get("CIVITAI_TOKEN") was None and downloads
failed with "Download requires a valid CIVITAI_TOKEN" (HTTP 401).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
downloads.py: streamed CivitAI downloads into the right ComfyUI folder,
in-memory progress (polled), cancel, and local model deletion. Adapted
from the legacy civitai.py — trimmed to download/cancel/delete and wired
into the new hash index:
- destination folder is derived from CivitAI's model type unless forced
- finished downloads are hashed into the index (shows in /imagelab/hashes)
- deletes drop the model from the index via hashing.forget()
- skip-if-present so persistent-volume pods don't re-download
- IMAGELAB_AUTO_DOWNLOAD env var: comma/newline list of version ids,
CivitAI URLs, model:<id>, or <folder>::<entry> — queued on startup
api.py: POST/GET/DELETE /imagelab/downloads + DELETE /imagelab/models/...
hashing.py: forget() — remove a model's .index sidecar + in-memory entry
__init__.py: queue startup downloads via the aiohttp on_startup hook
Token via CIVITAI_TOKEN env var. Legacy civitai*.py / websocket.py left
untouched as reference.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Clean-slate rebuild. The previous entrypoint and modules (routes.py,
workflows.py, imagelab_nodes.py, resources.py, etc.) are kept for
reference as __init__.py.legacy + untouched files, not loaded.
New surface:
- hashing.py: SHA256 model hashing keyed by path relative to the models
dir (no more bare-filename collisions). .index sidecars under
model_index/. Maintains an in-memory index + ETag-style version token.
- api.py: GET /imagelab/hashes serves the full cache from memory in one
request, with ETag/If-None-Match -> 304 support.
- __init__.py: registers the API and builds the hash index in a
background thread on startup.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>