Refactor (gradio part2) generation wiring decomposition#653
Refactor (gradio part2) generation wiring decomposition#653ChuxiJ merged 1 commit intoace-step:mainfrom
Conversation
fb759e8 to
3884224
Compare
📝 WalkthroughWalkthroughThis PR refactors the Gradio UI event wiring system by introducing a registration-based architecture. It replaces direct function calls to build helpers with new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
acestep/ui/gradio/events/__init__.py (1)
281-303: Consider iterable unpacking instead of list concatenation.The static analysis tool (Ruff RUF005) suggests using iterable unpacking for cleaner syntax.
♻️ Suggested change
outputs=[ generation_section["src_audio"], generation_section["generation_mode"], generation_section["lyrics"], generation_section["captions"], - ] + mode_ui_outputs, + *mode_ui_outputs, + ], ) results_section[f"send_to_repaint_btn_{btn_idx}"].click( fn=lambda audio, lm, ly, cap, cur_mode: res_h.send_audio_to_repaint( audio, lm, ly, cap, cur_mode, llm_handler), inputs=[ results_section[f"generated_audio_{btn_idx}"], results_section["lm_metadata_state"], generation_section["lyrics"], generation_section["captions"], generation_section["generation_mode"], ], outputs=[ generation_section["src_audio"], generation_section["generation_mode"], generation_section["lyrics"], generation_section["captions"], - ] + mode_ui_outputs, + *mode_ui_outputs, + ], )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@acestep/ui/gradio/events/__init__.py` around lines 281 - 303, Replace the list concatenation used in the Gradio .click call outputs with iterable unpacking to satisfy Ruff RUF005: change occurrences where outputs are built as [generation_section["src_audio"], generation_section["generation_mode"], generation_section["lyrics"], generation_section["captions"],] + mode_ui_outputs to use the splat form [generation_section["src_audio"], generation_section["generation_mode"], generation_section["lyrics"], generation_section["captions"], *mode_ui_outputs]; apply this to both .click calls (the one creating the widget with outputs and the results_section[f"send_to_repaint_btn_{btn_idx}"].click call) so generation_section and mode_ui_outputs are combined via unpacking instead of concatenation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@acestep/ui/gradio/events/__init__.py`:
- Around line 281-303: Replace the list concatenation used in the Gradio .click
call outputs with iterable unpacking to satisfy Ruff RUF005: change occurrences
where outputs are built as [generation_section["src_audio"],
generation_section["generation_mode"], generation_section["lyrics"],
generation_section["captions"],] + mode_ui_outputs to use the splat form
[generation_section["src_audio"], generation_section["generation_mode"],
generation_section["lyrics"], generation_section["captions"], *mode_ui_outputs];
apply this to both .click calls (the one creating the widget with outputs and
the results_section[f"send_to_repaint_btn_{btn_idx}"].click call) so
generation_section and mode_ui_outputs are combined via unpacking instead of
concatenation.
Summary
Scope
Added Acestep/ui/gradio/events/wiring/generation_service_wiring.py for:
Added Acestep/ui/gradio/events/wiring/generation_metadata_wiring.py for:
Added Acestep/ui/gradio/events/wiring/generation_text_format_wiring.py for:
Added Acestep/ui/gradio/events/wiring/decomposition_contract_test.py for AST-level delegation contract checks.
Updated Acestep/ui/gradio/events/init.py to delegate these sections through wiring helpers.
Updated Acestep/ui/gradio/events/wiring/init.py exports.
No handler behaviour changes.
No interface signature changes for:
No cross-path runtime/hardware changes.
Validation
Code review by GLM5 with no issues.
Unit tests introduced
Unit tests run
Manual UI tests passed
Risk
Summary by CodeRabbit
Refactor
Tests