Commit Graph

220 Commits

Author SHA1 Message Date
Adam Ladachowski 43a76b068b Version 0.1.18+65cbd37 2026-02-18 17:33:55 +01:00
Adam Ladachowski 65cbd372f5 Add hash-suffixed versioning and git-based reinstall command 2026-02-18 17:33:31 +01:00
Adam Ladachowski 2364580742 Version 0.1.18+82570e7 2026-02-18 17:32:54 +01:00
Adam Ladachowski 82570e783d Version 0.1.18+1c884d2 2026-02-18 17:32:25 +01:00
Adam Ladachowski 1c884d2c97 Version 0.1.18+98bb467 2026-02-18 17:32:07 +01:00
Adam Ladachowski 98bb467790 Version 0.1.18+e2f7a7c 2026-02-18 17:31:41 +01:00
Adam Ladachowski e2f7a7c49b Version 0.1.18+066756f 2026-02-18 17:26:16 +01:00
Adam Ladachowski 066756f931 Version 0.1.18+8bdd319 2026-02-18 17:25:41 +01:00
Adam Ladachowski 8bdd31927e Version 0.1.18+093179c 2026-02-18 17:24:42 +01:00
Adam Ladachowski 093179cb3b Add /api/comfyui/image endpoint for fetching generated images
Allows web clients to retrieve images by filename after generation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 01:46:26 +01:00
Adam Ladachowski e8667617dd Fix OpenAPI schema: exclude proxy routes from schema
The /comfy/{path} proxy route was generating duplicate operationIds
for each HTTP method, causing OpenAPI validation to fail.

Exclude all ComfyUI proxy/auth routes from schema - they're not meant
to be used by API clients.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 01:43:35 +01:00
Adam Ladachowski 9fde26fb83 💬 Commit message: Update 2026-02-17 00:06:05, 2 files, 414 lines
📁 Files changed: 2
📝 Lines changed: 414

  • pyproject.toml
  • uv.lock
2026-02-17 00:06:05 +01:00
Adam Ladachowski 90f2fdd494 💬 Commit message: Update 2026-02-16 18:14:33, 1 files, 8 lines
📁 Files changed: 1
📝 Lines changed: 8

  • deploy.rb
2026-02-16 18:14:33 +01:00
Adam Ladachowski ca1aa5d8d7 docs: Add ComfyUI integration to README
- Add ComfyUI CLI commands (tsr comfy status/models/generate/etc.)
- Add ComfyUI API endpoints documentation
- Add ComfyUI generate options table
- Add ComfyUI configuration section
- Update features list and description
- Update coverage badge to 50%

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 16:59:50 +01:00
Adam Ladachowski 279e66a276 2026-02-16_16:40:53 Update 2026-02-16 16:40:53 +01:00
Adam Ladachowski 2e5d7058c5 💬 Commit message: Update 2026-02-16 16:40:44, 1 files, 0 lines
📁 Files changed: 1
📝 Lines changed: 0

  • .coverage
2026-02-16 16:40:44 +01:00
Adam Ladachowski 87ec0bef6a Phase 4: Configuration (config.py)
Add ComfyUI configuration functions:
- `get_comfyui_url()` - URL resolution (env var -> config -> default)
- `get_comfyui_defaults()` - Default generation parameters from config

Config section in config.toml:
    [comfyui]
    url = "http://127.0.0.1:8188"
    default_model = "flux1-dev-fp8.safetensors"
    width = 1024
    height = 1024
    steps = 20
    cfg = 7.0
    sampler = "euler"
    scheduler = "normal"

Updated comfyui.py to use config functions instead of hardcoded values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 16:20:25 +01:00
Adam Ladachowski 484c52faf3 Phase 3: Server API Routes (/api/comfyui/*)
Add FastAPI routes for ComfyUI programmatic API:

Query endpoints:
- GET /api/comfyui/status - System stats (GPU, RAM, etc.)
- GET /api/comfyui/queue - Queue status (running/pending)
- DELETE /api/comfyui/queue - Clear the queue
- GET /api/comfyui/models - List available models
- GET /api/comfyui/history - List generation history
- GET /api/comfyui/history/{prompt_id} - Get specific result

Generation endpoints:
- POST /api/comfyui/generate - Text-to-image with full params
- POST /api/comfyui/workflow - Queue arbitrary API-format workflow

All endpoints protected with API key auth (X-API-Key header).
Pydantic models for request/response validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 16:11:19 +01:00
Adam Ladachowski c8c93596c8 Phase 2: CLI Commands (tsr comfy)
Add ComfyUI CLI subcommand group with:
- `tsr comfy status` - System stats (GPU, RAM, PyTorch, queue)
- `tsr comfy queue` - Show queue status (running/pending)
- `tsr comfy queue --clear` - Clear the queue
- `tsr comfy models` - List available checkpoints, LoRAs, VAE, etc.
- `tsr comfy history [ID]` - View generation history
- `tsr comfy generate` - Text-to-image with full parameter control
  - prompt, negative, model, width, height, steps, cfg, seed
  - sampler, scheduler selection
  - optional --output to save locally
- `tsr comfy run workflow.json` - Run arbitrary API-format workflows

All commands support --json output and --url for custom server.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 16:07:49 +01:00
Adam Ladachowski e776f9846e Phase 1: Core Client (tensors/comfyui.py)
Add ComfyUI API client module with:
- Basic query functions: get_system_stats(), get_queue_status(),
  get_loaded_models(), get_history(), clear_queue(), get_object_info()
- Workflow execution: queue_prompt(), run_workflow() with progress tracking
- Text-to-image: generate_image() with embedded SDXL/Flux workflow template
- Data classes: GenerationResult, WorkflowResult
- Helper: get_image() to download generated images

Follows existing api.py patterns with console: Console | None for optional
Rich progress output, httpx for HTTP requests, and proper error handling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 16:03:49 +01:00
Adam Ladachowski e9d1745c62 💬 Commit message: Update 2026-02-16 16:00:31, 1 files, 126 lines
📁 Files changed: 1
📝 Lines changed: 126

  • TODO.md
2026-02-16 16:00:31 +01:00
Adam Ladachowski b11b43fc2a ci: add comprehensive GitHub Actions workflow
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 14:39:56 +01:00
Adam Ladachowski 5bdbd6ef5f Rename /deploy to /tensors:deploy and rewrite in Ruby
Move deploy command to tensors namespace and replace bash script with
Ruby for better error handling. Adds API health check after restart.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 13:45:11 +01:00
Adam Ladachowski 74a5136d6e 💬 Commit message: Update 2026-02-16 13:42:41, 2 files, 6 lines
📁 Files changed: 2
📝 Lines changed: 6

  • settings.local.json
  • .coverage
2026-02-16 13:42:41 +01:00
Adam Ladachowski 574cdb6abd Add configurable model paths
- Add [paths] section to config.toml for custom model directories
- Add get_model_paths() function that merges config with defaults
- Update get_default_output_path() to check config first
- Add --set-path option to tsr config command
- Update download_routes.py to use centralized path function
- Add tests for path configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 13:40:45 +01:00
Adam Ladachowski 79657a7b1f Fix lint errors in OAuth routes
- Break long SVG path lines in login pages (E501)
- Remove unused request parameter from callbacks (ARG001)
- Add noqa for too-many-returns in OAuth callbacks (PLR0911)
- Remove unused CORSMiddleware import
- Fix type narrowing in logout redirect

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 10:15:34 +01:00
Adam Ladachowski 4c946c9536 Add shared OAuth authentication routes
Support cross-domain auth for tensors-web with return_url parameter.
New endpoints: /auth/login, /auth/github, /auth/callback, /auth/verify

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 00:59:55 +01:00
Adam Ladachowski 8d70723be3 💬 Commit message: Update 2026-02-16 00:45:18, 1 files, 13 lines
📁 Files changed: 1
📝 Lines changed: 13

  • icon.svg
2026-02-16 00:45:18 +01:00
Adam Ladachowski 36b686ba6b 💬 Commit message: Update 2026-02-16 00:44:07, 3 files, 15 lines
📁 Files changed: 3
📝 Lines changed: 15

  • logo.png
  • logo.svg
  • screenshot.png
2026-02-16 00:44:07 +01:00
Adam Ladachowski 27d119f920 Replace username/password auth with GitHub OAuth for ComfyUI proxy
- Add GitHub OAuth flow with /comfy/auth/github and /comfy/auth/callback
- User allowlist via GITHUB_ALLOWED_USERS environment variable
- CSRF protection with state parameter
- Keep same dark mode login page design (saved screenshot)
- Strip Origin header from proxied requests (fixes ComfyUI 403s)
- Add manual CORS headers to proxy responses

Env vars: GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GITHUB_ALLOWED_USERS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 00:36:11 +01:00
Adam Ladachowski 4302d76d61 Strip Origin header - ComfyUI blocks CORS requests 2026-02-15 23:57:35 +01:00
Adam Ladachowski 1692789a01 Add debug logging 2026-02-15 23:56:34 +01:00
Adam Ladachowski 3dbd72233b Add manual CORS headers to ComfyUI proxy 2026-02-15 23:56:00 +01:00
Adam Ladachowski 34f683ad56 Disable CORS entirely 2026-02-15 23:54:51 +01:00
Adam Ladachowski ff9736dbe6 Fix CORS: allow_credentials must be False for wildcard origins
CORS spec doesn't allow credentials with wildcard origins.
This was causing 403 for all crossorigin module preloads.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 23:53:53 +01:00
Adam Ladachowski 2ea8bbeafd Allow entire assets/ path without auth for ComfyUI proxy
Simpler approach - just allow all requests to assets/ directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 23:40:40 +01:00
Adam Ladachowski 7caed3bbea Allow CORS preflight OPTIONS requests without auth
CORS preflight requests don't send cookies, so they were failing auth.
Now OPTIONS requests are allowed through without authentication.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 23:38:23 +01:00
Adam Ladachowski d589957cf1 Allow static assets without auth for ComfyUI proxy
modulepreload links use crossorigin attribute which doesn't send
cookies, so static assets (JS, CSS, fonts, images, JSON) are now
allowed without session authentication.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 23:35:11 +01:00
Adam Ladachowski ff2319a50e 💬 Commit message: Update 2026-02-15 23:33:18, 3 files, 91 lines
📁 Files changed: 3
📝 Lines changed: 91

  • .coverage
  • CLAUDE.md
  • uv.lock
2026-02-15 23:33:18 +01:00
Adam Ladachowski f1ab0d6f05 Add ComfyUI reverse proxy with session authentication
- New /comfy/* routes that proxy to local ComfyUI instance
- Dark mode login page with session-based auth (HMAC-signed cookies)
- HTTP proxy for all ComfyUI requests
- WebSocket proxy for real-time features
- Environment variables: COMFYUI_URL, COMFYUI_USER, COMFYUI_PASS, SESSION_SECRET
- Added websockets and python-multipart to server dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 23:29:48 +01:00
Adam Ladachowski 023eae66d7 💬 Commit message: Update 2026-02-15 23:19:02, 1 files, 116 lines
📁 Files changed: 1
📝 Lines changed: 116

  • CLAUDE.md
2026-02-15 23:19:02 +01:00
Adam Ladachowski c9d76dc382 Disable CORS 2026-02-15 21:45:23 +01:00
Adam Ladachowski 08e612ffa0 Add HuggingFace model caching to database
- New tables: hf_models, hf_model_tags, hf_safetensor_files
- Cache HF search results automatically
- Add search_hf_models(), get_hf_model() methods
- Include hf_models in stats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 21:18:24 +01:00
Adam Ladachowski d79861df53 Remove redundant /api/civitai/search endpoint
Unified search at /api/search handles both CivitAI and HuggingFace.
CivitAI routes now only provide:
- /api/civitai/model/{id} - get model by ID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 21:15:24 +01:00
Adam Ladachowski 081bb3d371 Update README with unified search and TypeScript client
- Document unified search with --provider flag (civitai, hf, all)
- Add /api/search to server endpoints
- Add TypeScript client section (@saiden/tensors)
- Add public API info (tensors-api.saiden.dev)
- Update search options table with provider column

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 21:09:11 +01:00
Adam Ladachowski a47237e5f7 💬 Commit message: Update 2026-02-15 21:04:01, 1 files, 0 lines
📁 Files changed: 1
📝 Lines changed: 0

  • .coverage
2026-02-15 21:04:01 +01:00
Adam Ladachowski 87ab5c44bb Make console parameter optional in search_civitai
- Console is now optional for headless/server usage
- Progress spinner only shown when console is provided
- Error messages print only when console is provided

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 19:59:55 +01:00
Adam Ladachowski fb27f8a9b0 Fix formatting issues
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 19:57:55 +01:00
Adam Ladachowski 24aaca2a48 Fix lint ignores for test files
- Add PLC0415, ARG001, ARG005, F841 to test file ignores
- Remove now-redundant inline noqa comments

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 19:56:49 +01:00
Adam Ladachowski 9f9f137f68 Unify CivitAI and HuggingFace search into single endpoint
- Add --provider flag to search command (civitai, hf, or all)
- Default to searching both providers simultaneously
- Add /api/search unified REST endpoint
- Map common parameters (sort, author, tag) across providers
- Remove separate `hf search` subcommand (use `search -P hf`)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 19:35:38 +01:00