18b3268738
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>
2.6 KiB
2.6 KiB
TODO: tsr Server/Client Architecture
Phase 1: Model-Specific Docker Images (SKIPPED)
- Step 1.1:
Create(skipped)rocm-docker/model-defaults.toml - Step 1.2:
Parameterize(skipped)Dockerfile.sd-server - Step 1.3:
Create(skipped)rocm-docker/build-all.sh
Phase 2: Models Database in tensors
- Step 2.1: Create
tensors/db.py+tensors/schema.sql(SQLite wrapper, schema, CRUD) - Step 2.2: Add
tsr dbCLI commands (scan, link, cache, list, search, triggers, stats) - Step 2.3: Add
/api/db/*endpoints (files, models, triggers, scan, link, cache, stats)
Phase 3: Enhanced Server API
- Step 3.1: Add
/api/imagesgallery endpoints (list, get, delete, edit) - Step 3.2: Add
/api/modelsendpoints (list, active, switch, loras) - Step 3.3: Add
/api/downloadendpoint (CivitAI proxy download) - Step 3.4: Enhance
/api/generate(gallery integration, full params)
Phase 4: Client Mode for tsr CLI
- Step 4.1: Create
tensors/client.py(TsrClient HTTP wrapper) - Step 4.2: Add
[remotes]config section +--remoteflag support - Step 4.3: Update CLI commands with
--remotesupport (generate, images, models, dl, db)
Phase 5: Docker Deployment Automation (SKIPPED)
- Step 5.1:
Create(skipped)rocm-docker/docker-compose.yml - Step 5.2:
Create(skipped)rocm-docker/deploy.sh - Step 5.3:
Create(skipped)rocm-docker/tsr-server.service
Phase 6: Tests
- Step 6.1:
tests/test_db.py(database module tests) - Step 6.2:
tests/test_server.py(API endpoint tests) - Step 6.3:
tests/test_client.py(client module tests)
Quick Reference
ROCm Docker Run (Unrestricted)
docker run -d --name sd-server \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
--group-add video \
--ipc=host \
--shm-size=8G \
-v /path/to/models:/models \
-p 1234:1234 \
-e MODEL=/models/model.safetensors \
sd-server:rocm
sd-server API Endpoints
POST /sdapi/v1/txt2img— Generate image (A1111 compatible)POST /sdapi/v1/img2img— Edit imageGET /sdapi/v1/loras— List LoRAsGET /sdapi/v1/samplers— List samplersGET /sdapi/v1/schedulers— List schedulers
Model Family Defaults (from models.md)
| Family | Resolution | Steps | CFG | Sampler | Scheduler |
|---|---|---|---|---|---|
| SD 1.5 | 512×512 | 20-30 | 7-8 | DPM++ 2M | Karras |
| SDXL | 1024×1024 | 25-30 | 5-7 | DPM++ 2M | Karras |
| Pony | 1024×1024 | 25-30 | 5-7 | Euler a | simple |
| Illustrious | 1024×1024 | 25-30 | 5-7 | Euler a | simple |
| Flux | 1024×1024 | 20-30 | 1-3 | Euler | simple |