- Create tensors/client.py with TsrClient HTTP wrapper for all server APIs
- Add remote server configuration to config.py (get_remotes, resolve_remote, save_remote, set_default_remote)
- Add images command group: list, show, delete, download
- Add models command group: list, active, switch, loras
- Add remote command group: list, add, default
- Update generate command with --remote support
- Update dl command with --remote support
- Update status command with --remote support
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive server API for remote operations:
Step 3.1 - Gallery endpoints:
- GET /api/images - List images (paginated, newest first)
- GET /api/images/{id} - Get image file
- GET /api/images/{id}/meta - Get generation metadata
- POST /api/images/{id}/edit - Update metadata (tags, notes)
- DELETE /api/images/{id} - Delete image + sidecar
- Gallery module with image management and sidecar JSON support
Step 3.2 - Model management:
- GET /api/models - List available checkpoints
- GET /api/models/active - Current loaded model info
- POST /api/models/switch - Switch model (hot reload)
- GET /api/models/loras - List available LoRAs
- GET /api/models/scan - Scan all model directories
Step 3.3 - Download proxy:
- POST /api/download - Start background download from CivitAI
- GET /api/download/status/{id} - Check download progress
- GET /api/download/active - List active downloads
- Auto-scan and link files after download
Step 3.4 - Enhanced generation:
- POST /api/generate - Generate with gallery integration
- Saves images to gallery with metadata sidecar
- Supports all sd-server params
- GET /api/samplers, /api/schedulers - List options
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add database REST API endpoints to FastAPI server:
- GET /api/db/files - List local files with CivitAI info
- GET /api/db/files/{id} - Get file by ID
- GET /api/db/models - Search cached models
- GET /api/db/models/{civitai_id} - Get model by CivitAI ID
- GET /api/db/triggers - Get triggers by file path
- GET /api/db/triggers/{version_id} - Get triggers by version ID
- GET /api/db/stats - Database statistics
- POST /api/db/scan - Scan directory for safetensors
- POST /api/db/link - Link unlinked files to CivitAI
- POST /api/db/cache - Fetch and cache CivitAI model data
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add database management commands to CLI:
- tsr db scan <directory> - Scan safetensors, compute hashes, store metadata
- tsr db link - Match unlinked files to CivitAI by hash lookup
- tsr db cache <model_id> - Fetch and cache full CivitAI model data
- tsr db list - List local files with CivitAI info
- tsr db search - Search cached models offline
- tsr db triggers <file> - Show trigger words for a LoRA
- tsr db stats - Show database statistics
Update API functions to accept optional console for quiet/batch operations.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create database infrastructure for local model file tracking and CivitAI cache:
- schema.sql: Full schema with local_files, CivitAI cache tables, and views
- db.py: Database class with CRUD operations for file scanning, CivitAI linking,
model caching, search, and trigger word retrieval
- Update compute_sha256 to support optional console for silent batch operations
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>