Commit Graph

22 Commits

Author SHA1 Message Date
aladac c911abfe69 feat(generate): accept YAML in --input alongside JSON
`tsr generate --input <file>` previously only understood JSON, which was
awkward for hand-authored template libraries (e.g. ~/Projects/draw/templates/
ships *.yml scene files with embedded newlines and unquoted keys that mirror
the `tsr template` output shape).

Behavior:
- Files with .yml / .yaml extension parse as YAML; .json (or unknown
  extensions whose first non-whitespace char is '{' or '[') parse as JSON.
- Inline strings starting with '{' still parse as JSON (regression-safe).
- Inline strings without leading '{' now parse as YAML, enabling
  `tsr generate --input 'prompt: foo\nmodel: bar.safetensors'` without
  shell-quoting a JSON object.
- All downstream key-mapping / CLI-override / character / scene / lora
  / count handling is identical to the JSON path — parsing only differs.

Implementation:
- New `_parse_generate_input(value)` helper in tensors/cli.py centralizes
  source detection (file vs inline), format selection (extension or
  content sniff), and rich-formatted error reporting via typer.Exit(1).
- The pre-existing inline JSON merge block in `generate` is reduced to a
  single call to the helper.
- Adds pyyaml>=6.0 as a runtime dep. It was already transitively pulled
  in by huggingface_hub, but we depend on it directly so the surface
  contract is explicit and survives a hub re-pin.
- mypy override added for the yaml module (no upstream stubs in tree).

Tests:
- 20 new tests in tests/test_generate_input.py covering inline JSON,
  inline YAML, file by extension (.json/.yml/.yaml), unknown extension
  content sniffing, non-mapping rejection, malformed input handling,
  CLI-flag-wins-over-input precedence, and a full smoke against the
  exact draw template shape (with embedded newlines in the scene list).
- 359 -> 379 total tests. Lint clean on changed lines.

Co-Authored-By: OpenCode <noreply@anomaly.co>
2026-05-18 21:16:11 +02:00
Adam Ladachowski 82eb0d3b5c Update 2026-02-22 06:23:25 +00: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 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 c9d76dc382 Disable CORS 2026-02-15 21:45:23 +01:00
Adam Ladachowski eb151dac8d Add Hugging Face Hub integration for safetensor files
- Add `tsr hf search` to search HF models with safetensor files
- Add `tsr hf get` to view model info and list safetensor files
- Add `tsr hf files` to list safetensor files in a model
- Add `tsr hf dl` to download safetensor files from HF

Uses official huggingface_hub library for API access.
Only safetensor files are supported (enforced at search and download).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 19:27:23 +01:00
Adam Ladachowski 1d41f924bf 💬 Commit message: Update 2026-02-15 17:55:57, 7 files, 47 lines
📁 Files changed: 7
📝 Lines changed: 47

  • pyproject.toml
  • __init__.py
  • civitai_routes.py
  • db_routes.py
  • download_routes.py
  • gallery_routes.py
  • uv.lock
2026-02-15 17:55:57 +01:00
Adam Ladachowski e016c01370 💬 Commit message: Update 2026-02-15 06:14:53, 5 files, 260 lines
📁 Files changed: 5
📝 Lines changed: 260

  • output.png
  • pyproject.toml
  • cli.py
  • comfy.py
  • uv.lock
2026-02-15 06:14:53 +01:00
Adam Ladachowski c156f6826b 💬 Commit message: Update 2026-02-14 09:01:09, 7 files, 66 lines
📁 Files changed: 7
📝 Lines changed: 66

  • pyproject.toml
  • screenshot.png
  • client.ts
  • GalleryView.vue
  • SearchView.vue
  • index.ts
  • uv.lock
2026-02-14 09:01:09 +01:00
Adam Ladachowski e9480a18c2 Remove internal sd-server management, proxy to external sd-server
- Remove ProcessManager and process.py
- Add get_sd_server_url() config (env/config/default)
- Update routes to proxy to external sd-server URL
- Remove model switching (handled by external sd-server)
- Update CLI serve command
- Update tests for new architecture

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 06:39:35 +01:00
Adam Ladachowski 030af651bd 💬 Commit message: Update 2026-02-14 03:06:20, 1 files, 2 lines
📁 Files changed: 1
📝 Lines changed: 2

  • uv.lock
2026-02-14 03:06:20 +01:00
Adam Ladachowski e77bc670d7 💬 Commit message: Update 2026-02-14 02:54:42, 2 files, 2 lines
📁 Files changed: 2
📝 Lines changed: 2

  • .coverage
  • uv.lock
2026-02-14 02:54:42 +01:00
Adam Ladachowski 503274a938 [Update] 2026-02-12 20:23:09, 18 files 2026-02-12 20:23:09 +00:00
Adam Ladachowski 795cc84122 [Update] 2026-02-12 16:23:37, 3 files 2026-02-12 16:23:37 +00:00
Adam Ladachowski 9c0a0766ac chore: bump version to 0.1.5 2026-02-03 23:58:09 +01:00
Adam Ladachowski 9f8d8d6fcd Add comprehensive tests, coverage 21% → 74% 2026-02-03 23:10:30 +01:00
Adam Ladachowski 5c44ec987e [Update] [2026-02-03 22:10:04] 2 files 2026-02-03 22:10:04 +01:00
Adam Ladachowski 2b62987a0c 💬 Commit message: Update 2026-02-03 20:55:19, 5 files 2026-02-03 20:55:19 +01:00
Adam Ladachowski da5bdc5a06 💬 Commit message: Update 2026-02-03 20:53:31, 12 files 2026-02-03 20:53:31 +01:00
Adam Ladachowski 0ee55a9db5 💬 Commit message: Update 2026-01-26 09:45:57, 5 files, 18 lines
📁 Files changed: 5
📝 Lines changed: 18

  • build.py
  • check.py
  • pyproject.toml
  • tensors.py
  • uv.lock
2026-01-26 09:45:57 +01:00
Adam Ladachowski eeb55b2540 💬 Commit message: Update 2026-01-24 19:22:34, 7 files, 1285 lines
📁 Files changed: 7
📝 Lines changed: 1285

  • build.py
  • check.py
  • civit.md
  • main.py
  • pyproject.toml
  • sft_get.py
  • uv.lock
2026-01-24 19:22:34 +01:00
Adam Ladachowski 749bd59e99 💬 Commit message: Update 2026-01-24 19:06:06, 6 files, 32 lines
📁 Files changed: 6
📝 Lines changed: 32

  • .gitignore
  • .python-version
  • README.md
  • main.py
  • pyproject.toml
  • uv.lock
2026-01-24 19:06:06 +01:00