Commit Graph
60 Commits
Author SHA1 Message Date
by-ae 479e0bb069 fix: ask before replacing a saved preset
Saving a character, object, or scene reused an existing name and
overwrote that preset without asking. Updating the preset already
linked to the region still saves directly.
2026-11-01 07:31:19 +10:00
by-ae 17858e1963 fix: store unicode names that look the same as one preset
A letter plus a combining accent was rejected, and when it was already
in the file it did not match the composed name.
2026-11-01 07:31:19 +10:00
by-ae 64d2515b8c fix: offset each paste so copies do not stack
Ctrl+V always nudged the original clipboard by the same amount, so a
second paste landed on the first copy.
2026-11-01 07:31:19 +10:00
by-ae 3c580cb821 fix: show the canvas size the prompt will use
A typed size was snapped to a multiple of 8 for the width and height
outputs, but the size field kept the number the user typed.
2026-11-01 07:31:19 +10:00
AE 0532fe9cb1 Merge pull request #11 from by-ae/improve/editor-fixes-1031
Editor palette, region and size fixes
2026-10-31 19:49:06 +10:00
by-ae 0415f865bb fix: keep an unusable style value from failing the prompt
style["style"] raised when the value was not a dict, and a non-string
overview did the same on strip. A style object is unchanged. A bare
kind string still selects that style, with its description left blank.
Anything else omits the style block.
2026-10-31 07:52:49 +10:00
by-ae f42da019f4 fix: note canvas sizes the open Ideogram 4 model rejects
The editor accepts 64-16384 and snaps to a multiple of 8, so 1920x1080
is easy to enter. The open model needs multiples of 16, from 256 to 2048,
at an aspect ratio of at most 6:1. The size fields show that rule and do
not change the numbers. The spinner steps by 16.
2026-10-31 07:52:49 +10:00
by-ae 677b390a50 fix: clear the active region when deleting a selection
Deleting several regions left another region active. The next Delete
removed that one as well, even though it had not been selected.
2026-10-31 07:52:49 +10:00
by-ae 1a578bb44c fix: keep non-string region text from stopping the canvas
A number or other non-string description reached the canvas line wrap,
which expects a string, and the redraw stopped. Labels, copies, and
loaded presets keep finite numbers as text and drop anything else.
2026-10-31 07:52:49 +10:00
by-ae 66da76e7ac fix: keep pasted palette colors editable
input[type=color] only accepts #rrggbb. A pasted #fff or other shorthand
was given to it unchanged, and the picker then opened on black. Palettes
are stored as the uppercase #RRGGBB colors Ideogram 4 keeps, at most five
per element and sixteen for the style.
2026-10-31 07:52:49 +10:00
AE e2b15ca72d Merge pull request #10 from by-ae/improve/editor-fixes-1030
Editor fixes for backgrounds, imports and region picking
2026-10-30 07:35:07 +10:00
by-ae 112da0de06 feat: delete saved characters, objects, and scenes
The store API already removed entries, but the editor never called it, so
a bad preset stayed in the library. Load dialogs can delete one after
confirmation. A region that pointed at a deleted character or object
drops that link.
2026-10-30 07:29:24 +10:00
by-ae 5b7222606e fix: hit the top region on shift-click and double-click
Shift-click and double-click preferred the active region when boxes
overlapped, so the region drawn on top could not be toggled or edited.
Both now follow paint order. Dragging still prefers the active handles.
2026-10-30 07:29:24 +10:00
by-ae 26767e46ca fix: report import JSON that does not override the editor
A connected import that was not valid JSON was dropped with no console
line, so the prompt quietly stayed on the editor caption. Non-objects
are reported the same way. A JSON object is still the prompt, and the
console names a missing compositional_deconstruction, background, or
elements list, which Ideogram 4 requires. A leading byte-order mark is
ignored.
2026-10-30 07:29:24 +10:00
by-ae af897e23d7 fix: accept RGBA and grayscale images as the canvas background
Preview BG Update opened every frame as RGB. Pillow rejects that mode
for a four-channel image, a single-channel image, or a plain height-width
array, so the save stopped and the canvas never updated. Those frames are
converted to RGB first. Alpha is composited onto black, which is what the
editor draws the preview over.
2026-10-30 07:29:24 +10:00
AE b87635322b Merge pull request #9 from by-ae/improve/store-caption-paste
Store and caption paste fixes
2026-10-29 07:49:08 +10:00
by-ae 02058dc8a2 fix: fit pasted regions when the source canvas size differs
Choosing source dimensions or an aspect ratio did nothing while scale mode
was stretch, which is the default. That choice now fits the source layout.
Don't care still stretches, and anchor modes still pin the fit.
2026-10-29 07:48:02 +10:00
by-ae bc763779fb fix: report background images that cannot be converted
A tensor that Pillow could not turn into an image raised out of the node
and failed the workflow. The documented console warning never ran.
2026-10-29 07:48:02 +10:00
by-ae cd9df07f38 fix: keep unusable region fields from failing the prompt
A boolean palette or a non-string description raised while building the
caption or the preview. Those values are dropped or turned into text.
Short hex colors use the expanded color in the preview.

Style tooltips said a blank descriptor is omitted. It is sent as an empty
string, which is what the caption schema requires for those keys.
2026-10-29 07:46:20 +10:00
by-ae a5a88ed0e8 fix: read store files that start with a UTF-8 BOM
json.load rejects a leading byte-order mark, so a valid bucket was moved
aside and the next save replaced it. Reading as utf-8-sig keeps the data.
2026-10-29 07:46:20 +10:00
cursor[bot] ff3cc3658f Merge pull request #8 from by-ae/cursor/region-store-caption-fixes-0d7f
Fix region placement, caption crashes, and store recovery
2026-10-27 21:03:40 +00:00
18524ccfa7 fix: report store load failures instead of an empty library
A failed GET /byae/ideogram/stores was caught and replaced with empty
buckets, so Load told the user there were no saved scenes. The request
error now reaches the existing alert, and an empty library is reported
only when the server actually returns one.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: AE <by-ae@users.noreply.github.com>
2026-10-27 21:02:13 +00:00
03603614b1 fix: back up store files that are not JSON objects
A bucket file that parsed as a JSON array or other non-object was treated
as empty and then overwritten on the next save, so the previous contents
were gone. Those files are now moved aside like invalid JSON. A backup
created in the same second no longer replaces an existing one.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: AE <by-ae@users.noreply.github.com>
2026-10-27 21:01:27 +00:00
2929e02252 fix: skip unusable region coordinates instead of failing the caption
A region stored with numeric strings, NaN, a boolean, or a huge finite
value raised from round() while building the Ideogram bbox or the preview,
so one bad box failed the whole node. Those coordinates are now omitted
from the caption and the preview, and numeric strings still convert.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: AE <by-ae@users.noreply.github.com>
2026-10-27 21:00:52 +00:00
adfbb424cf fix: keep pasted and loaded regions inside the canvas
Ctrl+V only clamped the origin, so a region near the edge kept its size and
extended past the canvas. Loading many characters did the same along the
0.04 diagonal. Paste now uses the same inside-canvas nudge as scene add,
and loads after the 17th tile a grid that still fits.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: AE <by-ae@users.noreply.github.com>
2026-10-27 20:59:04 +00:00
AE 250ec99be5 Merge pull request #7 from by-ae/cursor/ideogram-bbox-errors-layout-ac2c
Fix bbox import, palettes, scene layout, and store writes
2026-10-27 07:12:43 +10:00
27db6ef197 fix: create each store bucket lock only once
The per-bucket lock was inserted without synchronization. Two first
writers could take different locks and overwrite each other's preset
file. Lock creation now happens under a guard lock.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:11:37 +00:00
84bd2a4cda test: stop store tests from writing fixtures into the repo
test_store replaced the folder_paths mock after store.py had imported it.
Route tests then configured the replacement, and store writes went to a
MagicMock path that had been committed. Both suites now share the mock
from conftest and land files in a temp directory.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:10:54 +00:00
f87d64c3b1 fix: keep saved scene layout when adding it to the canvas
Additive scene load nudged each region further than the one before it, so
a saved composition was sheared. Every region now moves by the same offset
and is clamped back inside the canvas.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:10:03 +00:00
a35ebb7d3f fix: keep color palettes inside the Ideogram 4 caption schema
The caption verifier accepts only uppercase #RRGGBB, at most 16 style
colors and 5 per element. Shorthand #RGB is expanded, other values are
dropped, and a null palette no longer crashes prompt assembly.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:08:32 +00:00
6a050339f7 fix: normalize inverted and non-numeric Ideogram bboxes
Pasted captions with swapped or non-numeric bbox values produced negative
or NaN regions, so the editor could not select them. Coordinates are now
swapped and clamped to the 0-1000 range from the Ideogram 4 caption schema,
and unreadable bboxes keep the non-overlapping grid slot for that element.
Saved regions with NaN coordinates are dropped on restore.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:07:29 +00:00
42bdd7eaf3 fix: report background image save failures in the console
Preview BG Update logged save and notify failures only when BG_DEBUG was
set, so the console stayed quiet while the README told users to look there.
Warnings now print for a missing image, an empty or invalid guid, a tensor
that cannot be converted, a disk write error, and a failed editor push.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:05:18 +00:00
cursor[bot] c35778b8f7 Merge pull request #6 from by-ae/cursor/fix-comfy-api-dependency-3cca
Fix: correct comfy_api.latest dependency documentation
2026-10-25 21:16:16 +00:00
by-aeandCursor Agent 07291310de fix: correct comfy_api.latest dependency documentation
comfy_api.latest.io is part of ComfyUI core, not from ComfyUI-KJNodes.
Restore accurate installation instructions and update ImportError message
to indicate a recent ComfyUI version is needed.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-25 21:15:01 +00:00
cursor[bot] 4378926ac7 Merge PR #5: Security, validation, and UX improvements 2026-10-25 21:10:12 +00:00
by-aeandCursor Agent 924e4908b4 fix: prevent region overlap when bbox is missing
When importing captions with missing/invalid bbox data, elements are now
arranged in a 4-column grid (row/column layout) instead of a diagonal
pattern that overlapped after 6 elements.

- Change fallback positioning from modulo-6 diagonal to row/column grid
- Update both Python backend and JavaScript editor
- Add comprehensive test for 12+ elements with no overlap
- Fixes visual collision when pasting captions with many unbounded regions

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-25 20:59:42 +00:00
by-aeandCursor Agent 0ff49ca24e docs: clarify ComfyUI-KJNodes dependency requirement
- Add clear import error message when comfy_api.latest is missing
- Update README installation instructions to require KJNodes first
- Update troubleshooting section with dependency check
- Remove misleading statement that KJNodes is not needed

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-25 20:58:11 +00:00
by-aeandCursor Agent c5ec465cd7 fix: add input validation and payload size limits to HTTP routes
- Add MAX_PAYLOAD_SIZE constant (10 MB) to prevent memory exhaustion
- Validate store names against path traversal and special characters in routes layer (defense in depth)
- Check Content-Length header and body size before processing
- Return HTTP 413 for oversized payloads
- Add comprehensive test coverage for validation edge cases

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-25 20:57:26 +00:00
cursor[bot] 1a4478889b Merge pull request #4 from by-ae/cursor/bug-fixes-unicode-concurrency-js-errors-0c57
Fix Unicode support, concurrent writes, and JS error handling
2026-10-24 20:56:22 +00:00
by-aeandCursor Agent 5063df5eb1 docs: document Unicode support, troubleshooting, and development setup
- Add Unicode character support info with examples (角色, Персонаж, Émilie)
- Document preset naming requirements clearly
- Add troubleshooting section for save failures with browser console guidance
- Add Development section with test running and linting instructions
- Improve error debugging guidance for users

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 20:55:05 +00:00
by-aeandCursor Agent 23c362f2da ci: add ESLint to JS validation and fix linting issues
- Add package.json with ESLint configuration for JS code quality checks
- Configure ESLint with browser environment and ES2021 features
- Add npm install and lint steps to CI workflow
- Fix unused parameter warnings in ideogram4_prompt_builder_enhanced.js and utility.js
- Update .gitignore to exclude node_modules, Python cache, and build artifacts

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 20:54:28 +00:00
by-aeandCursor Agent e99c2b8fe8 fix: improve JS error handling visibility in editor
- Log errors to console when parsing elements_data or style_palette_data fails
- Show alerts and log errors when store operations (save/load scenes, characters, objects) fail
- Log clipboard access failures during import instead of silently ignoring
- Replace empty catch blocks with proper error logging for better debugging

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 20:53:13 +00:00
by-aeandCursor Agent 3a1dcd649d fix: support Unicode names and prevent concurrent write corruption in store
- Allow Unicode letters/numbers in preset names (e.g. 角色, Персонаж, Émilie)
- Add thread-safe locking per bucket to prevent race conditions during concurrent writes
- Use mkstemp() for atomic temp file creation to avoid tmp file name collisions
- Add tests demonstrating the bugs and verifying the fixes

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 20:52:01 +00:00
AE 249e4d7e95 Merge pull request #3 from by-ae/cursor/store-robustness-and-delete-api-8f8c
Fix store robustness and add DELETE API endpoint
2026-10-24 19:58:12 +10:00
by-aeandCursor Agent b3e2e53e66 docs: document store location, corrupt file recovery, and API endpoints
- Add store location in troubleshooting section
- Explain corrupt file backup behavior with timestamps
- Add API section with GET, PUT, and DELETE endpoint documentation

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 09:57:03 +00:00
by-aeandCursor Agent 048e0110c8 test: add coverage for corrupt file handling and DELETE endpoint
- Test corrupt JSON creates backup and returns empty bucket
- Test corrupt file does not affect other buckets
- Test save works after corrupt file recovery
- Test DELETE success, 404 not found, invalid bucket/name 400
- All existing tests continue to pass

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 09:56:58 +00:00
by-aeandCursor Agent 3956165b25 feat: add DELETE endpoint for store entries
- Add DELETE /byae/ideogram/stores/{bucket}/{name} route handler
- Return 400 for invalid bucket/name, 404 for not found, 200 on success
- Mirror error handling pattern from PUT route
- Add deleteStoreEntry() helper in ideogram4_shared.js
- Use same fetch/timeout/error-handling pattern as saveStoreEntry

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 09:56:53 +00:00
by-aeandCursor Agent 41a54fa376 fix: handle corrupt JSON files in store with backup recovery
- Add error handling for JSONDecodeError and UnicodeDecodeError in _read_json
- Move corrupt files to timestamped backup (e.g. characters.json.corrupt-1234567890)
- Treat corrupt bucket as empty, allowing other buckets to continue working
- Clean up temp files if _write_json fails
- Log warnings for corrupt file recovery and errors for backup failures

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 09:56:46 +00:00
AE 23577e9300 Merge pull request #2 from by-ae/cursor/test-improvements-590d
Add comprehensive testing, bug fixes, and CI improvements
2026-10-24 07:23:41 +10:00
by-aeandCursor Agent 223ec7e15b Add comprehensive test coverage for routes and nodes
Tests cover:
- routes.py: Input validation, path traversal protection, JSON
  error handling, GUID sanitization (12 new tests)
- nodes/ideogram4_nodes.py: Prompt assembly, bbox normalization,
  palette handling, JSON serialization, input coercion (28 new tests)

All tests use mocks via conftest.py to avoid ComfyUI dependencies.
Tests import the repo as a proper package so routes.py relative
imports work unchanged.

CI: Install aiohttp for route tests.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-23 21:16:56 +00:00