Files
tensors/TODO.md
T
Adam Ladachowski e257a029da Phase 6: Tests for database, server, and client modules
- Add tests/test_db.py with 33 tests for Database class:
  - Schema initialization and migrations
  - Local file CRUD operations (scan, list, link)
  - CivitAI model caching (cache_model, tags, versions, files)
  - Query operations (search, get_model, get_triggers)
  - Statistics and context manager

- Extend tests/test_server.py with 27 tests for API endpoints:
  - Gallery endpoints (list, get, meta, edit, delete, stats)
  - Database endpoints (files, models, stats)
  - Gallery class unit tests

- Add tests/test_client.py with 33 tests for TsrClient:
  - Server status operations
  - Gallery image operations (list, get, delete, edit, download)
  - Model management (list, active, switch, loras)
  - Image generation
  - CivitAI download operations
  - Database query operations
  - Error handling and context manager

Total: 191 tests passing with 61% coverage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 01:54:00 +01:00

68 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TODO: tsr Server/Client Architecture
## Phase 1: Model-Specific Docker Images (SKIPPED)
- [x] Step 1.1: ~~Create `rocm-docker/model-defaults.toml`~~ (skipped)
- [x] Step 1.2: ~~Parameterize `Dockerfile.sd-server`~~ (skipped)
- [x] Step 1.3: ~~Create `rocm-docker/build-all.sh`~~ (skipped)
## Phase 2: Models Database in tensors
- [x] Step 2.1: Create `tensors/db.py` + `tensors/schema.sql` (SQLite wrapper, schema, CRUD)
- [x] Step 2.2: Add `tsr db` CLI commands (scan, link, cache, list, search, triggers, stats)
- [x] Step 2.3: Add `/api/db/*` endpoints (files, models, triggers, scan, link, cache, stats)
## Phase 3: Enhanced Server API
- [x] Step 3.1: Add `/api/images` gallery endpoints (list, get, delete, edit)
- [x] Step 3.2: Add `/api/models` endpoints (list, active, switch, loras)
- [x] Step 3.3: Add `/api/download` endpoint (CivitAI proxy download)
- [x] Step 3.4: Enhance `/api/generate` (gallery integration, full params)
## Phase 4: Client Mode for tsr CLI
- [x] Step 4.1: Create `tensors/client.py` (TsrClient HTTP wrapper)
- [x] Step 4.2: Add `[remotes]` config section + `--remote` flag support
- [x] Step 4.3: Update CLI commands with `--remote` support (generate, images, models, dl, db)
## Phase 5: Docker Deployment Automation (SKIPPED)
- [x] Step 5.1: ~~Create `rocm-docker/docker-compose.yml`~~ (skipped)
- [x] Step 5.2: ~~Create `rocm-docker/deploy.sh`~~ (skipped)
- [x] Step 5.3: ~~Create `rocm-docker/tsr-server.service`~~ (skipped)
## Phase 6: Tests
- [x] Step 6.1: `tests/test_db.py` (database module tests)
- [x] Step 6.2: `tests/test_server.py` (API endpoint tests)
- [x] Step 6.3: `tests/test_client.py` (client module tests)
---
## Quick Reference
### ROCm Docker Run (Unrestricted)
```bash
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 image
- `GET /sdapi/v1/loras` — List LoRAs
- `GET /sdapi/v1/samplers` — List samplers
- `GET /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 |