12 Commits
Author SHA1 Message Date
魏巍andClaude Opus 4.6 a4f7c24516 fix: add fallback for loading settings in ComfyUI Desktop
In newer versions of ComfyUI Desktop, `app.extensionManager.setting.get()`
may return empty values even when settings are properly configured via
the API. This causes the dynamic field widgets (including image upload
buttons) to fail to load when entering an aiToolsId.

This adds a fallback that fetches settings from the server API
(`/api/settings`) when the frontend settings return empty, ensuring
the dynamic fields load correctly across all ComfyUI versions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:59:14 +08:00
wangzhuoran 7b99ea976c refactor: simplify TA_AIToolsNode by dynamically generating field widgets
Problem: The previous implementation defined 99 optional inputs in Python
and tried to hide/show them in frontend, which didn't work reliably on
ComfyUI Windows version - fields like fieldValue_99 remained visible.

Solution: Complete refactor to dynamically generate widgets:

Backend (TA_AITools.py):
- Remove INPUT_LIM and 99 pre-defined optional inputs
- Add single 'fieldData' STRING field to store serialized field values
- process() parses JSON from fieldData to build fieldInputs

Frontend (ta_aitools.js):
- Remove complex widget hiding logic
- When aiToolsId changes, fetch workflow fields from API
- Dynamically create widgets using node.addWidget()
- Serialize field values to fieldData on each change
- Clean up old widgets when switching workflows

Benefits:
- No more hidden widgets taking up space
- Works reliably on both native and Windows versions
- Cleaner code (304 lines removed, 192 added)
- Node size automatically adjusts to actual field count
2026-03-25 16:42:41 +08:00
wangzhuoran c39011d101 fix: directly modify widget properties to hide dynamic fields
Instead of calling toggleWidget which may have complex logic, directly set:
- widget.type = HIDDEN_TAG (to hide the widget)
- widget.computeSize = () => [0, -4] (to collapse its height)

This is a more direct approach to ensure all dynamic fields including
fieldValue_99 are properly hidden on Windows version of ComfyUI.
2026-03-25 16:39:07 +08:00
wangzhuoran e69809edff fix: use direct widget iteration to hide all dynamic fields
Instead of using handleWidgetVisibility which looks up widgets by name,
directly iterate through node.widgets array to find and hide all dynamic
fields matching the pattern (fieldValue_*, fieldName_*, nodeId_*).

This ensures that all 99 fields are properly hidden, including fieldValue_99
which was not being hidden due to potential lookup issues in Windows version.
2026-03-25 16:37:03 +08:00
wangzhuoran b2d6b4245c fix: add debug logs and increase timeout for Windows compatibility
- Increase setTimeout from 100ms to 500ms for Windows version
- Add debug console.log to track resetAIToolsNode execution
- Add setDirtyCanvas call to force refresh after hiding widgets

This helps diagnose why fieldValue_99 is not being hidden on Windows.
2026-03-25 16:33:49 +08:00
wangzhuoran 49a80e3b62 fix: properly hide all dynamic fields and inputs on node creation
1. Add handleInputsVisibility calls in resetAIToolsNode to hide input slots
   (left side connectors), not just widgets (right side inputs). This fixes
   the issue where node height remained at 99 fields tall.

2. Add null check for aiToolsName widget to prevent potential errors.

3. Move createLogic(node) call into setTimeout to ensure widgets are fully
   initialized before hiding, especially important for ComfyUI Windows version
   where timing may differ.
2026-03-25 16:24:51 +08:00
wangzhuoran 7288a4457b fix: allow hiding TA_AIToolsNode dynamic fields that have corresponding inputs
TA_AIToolsNode fields (fieldValue_*, fieldName_*, nodeId_*) are defined as
optional inputs in Python, so doesInputWithNameExist() returns true and
prevents them from being hidden. Add special handling to skip this check
for these dynamic fields so they can be properly hidden/shown based on
the aiToolsId response.

This fixes the issue where all 99 fields were displayed and filled the UI,
especially in ComfyUI Windows version.
2026-03-25 16:22:03 +08:00
wangzhuoran 6addb438a7 fix: comment out deprecated ComfyButtonGroup import to resolve deprecation warning
The ComfyButtonGroup import from buttonGroup.js is deprecated in ComfyUI.
Since the actual usage was already commented out, simply comment out the
import statement to eliminate the deprecation warning.
2026-03-25 16:19:04 +08:00
wangzhuoran 0258fbdb37 remove settingnode 2025-04-02 16:21:08 +08:00
wangzhuoran 9e4842dc49 Experience optimization 2025-03-24 17:12:26 +08:00
wangzhuoran fcb71262b9 add feature 2025-03-21 17:07:53 +08:00
wangzhuoran 7a1f3d960e init 2025-03-20 19:03:31 +08:00