tui: ControlNet picker (unit configuration) #150
No reviewers
Labels
No labels
area:agents
area:ai
area:config
area:dashboard
area:design
area:design-review
area:devtools
area:entities
area:gallery
area:generate
area:image
area:infra
area:meta
area:model-browser
area:navigation
area:presets
area:security
area:sessions
area:settings
area:sharing
area:test
area:ux
area:webhook
area:workdir
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/loom!150
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tui/controlnet-picker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes charles/loom#141
Summary
aadds a unit (up to 4),ddremoves the focused unit. Enter opens an inline editor that cycles through image path / module / model / weight / guidance start / guidance end.StringPickerOverlayvariants backed bybridge.list_controlnet_modules()andbridge.list_controlnet_models().submission_params()stripscontrolnet_unitswhen the active mode is not ControlNet.Test plan
cargo fmt --allcargo build(full workspace)cargo test -p loom-tui(178 pass)cargo clippy -p loom-tui -- -D warningsa, type an image path, Enter on module → picker opens, Enter on model → picker opens, F5 submits.Good test coverage (cap, clamp, strip-on-submit, selection reclamp). Some review points:
Correctness
submission_paramsstrips units when mode ≠ ControlNet, but units stay inparams.controlnet_units. If the user configures units, switches to t2i, and switches back, units return — that's nice. Butrender_controlnet_panelis only rendered whenshow_cnso configured units become invisible yet persist in state. Consider rendering a disabled/dim hint when there are units but mode is not ControlNet, so the user doesn't think they vanished.adjust_focused_cn_guidance_startcomputesnext = clamp(0..1)thennext.min(u.guidance_end)— correct. Symmetric end path also correct.ddchord has no timeout. If the user pressesd, gets distracted, comes back minutes later and pressesdagain, the second unit is deleted. Either add a timeout (e.g. 800 ms) or require an explicit confirm. The currentcontrolnet_pending_dresets on any other key, which helps, but idle time doesn't clear it.handle_controlnet_list_keyalways returnstrueforj/k/Up/Down even when the list is empty — that's fine (eats the key) but on an empty list those keys should probably fall through to field navigation, otherwise the user is stuck on ControlNetList focus with no way to move using arrows. Test this.Style
default_controlnet_unit()duplicates the model's default. IfControlNetUnit: Defaultisn't already defined, add it there rather than a free function in the TUI crate.render_controlnet_editor'sfieldsarray is recomputed every frame — fine, but consider moving the label+value derivation into an iterator overControlNetEditField::ORDERfor consistency withnext/prev.GenerateFocus::ORDERlength bumped from 13 → 14 manually — preferORDER.len()wherever possible.Review addressed in
bbffd57:ddidle timeout — addedcontrolnet_pending_d_at: Option<Instant>and an 800msCONTROLNET_DD_CHORD_TIMEOUT. A stale firstdpast the window re-arms a fresh chord instead of silently deleting. Covered bycontrolnet_dd_chord_deletes_focused_unit_within_timeoutandcontrolnet_dd_chord_expires_after_timeout.j/k/Up/Downnow returnfalsewhencontrolnet_unitsis empty so the key moves to the next/prev field instead of getting swallowed. Covered bycontrolnet_empty_list_lets_navigation_keys_fall_throughandcontrolnet_non_empty_list_consumes_navigation_keys.(N ControlNet unit(s) hidden — switch to ControlNet mode to edit)renders where the panel would be, so configured units don't appear to vanish.ControlNetUnit: Default— added inloom-core/src/models/generation.rs(reusing the existingsuper::defaults::*helpers); the TUI-cratedefault_controlnet_unit()free function is gone.ORDER— no hard-coded13/14usages remain outside the array-size literal itself (which must stay ausizeconstant).cargo fmt --all,cargo build,cargo test -p loom-tui,cargo clippy -p loom-tui -- -D warningsall pass.