ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Add support for file list refresh feature in node

Open ltdrdata opened this issue 2 years ago • 6 comments

Add 'Refresh' button to enable file list refresh in Model Loader and Image Loader nodes; eliminate the need to restart ComfyUI for file list reloading.

ltdrdata avatar Mar 21 '23 00:03 ltdrdata

Is there any reason why you need to add a "REFRESH" widget to the backend code of the nodes?

Can't you just add a route in the backend to query the INPUT_TYPES of any node type? I think that would be more clean overall along with a right click->refresh to refresh a node.

comfyanonymous avatar Mar 21 '23 19:03 comfyanonymous

I got it. It is the better way. I'd tried refreshing single node for now. But how about refresh whole node at once by main menu?

ltdrdata avatar Mar 21 '23 22:03 ltdrdata

I moved refresh feature from node to main menu.

ltdrdata avatar Mar 23 '23 05:03 ltdrdata

What I meant exactly is that you make it so the /object_info can also be used to query the "object_info" for a single node.

Then when a node is refreshed it queries /object_info?node=CheckpointLoaderSimple

And refreshes every combo box in the node with the new values from there.

The code should be generic enough that you shouldn't need to put node names in the javascript code.

comfyanonymous avatar Mar 25 '23 05:03 comfyanonymous

Oh. I understood.

ltdrdata avatar Mar 25 '23 09:03 ltdrdata

Done. I modified as your feedback.

ltdrdata avatar Mar 26 '23 12:03 ltdrdata

It doesn't seem to work and I get this in the javascript console when I click on Refresh:

app.js:817 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'refresh_list')
    at ComfyApp.refreshNodes (app.js:817:23)

comfyanonymous avatar Mar 26 '23 20:03 comfyanonymous

Robust patch applied. Now it will work. I missed the error because my Chrome browser ignored it

ltdrdata avatar Mar 26 '23 23:03 ltdrdata

Is there a reason why you can't refresh all values instead of having to specify them with REFRESH_LIST?

comfyanonymous avatar Mar 27 '23 06:03 comfyanonymous

Oh.. Do you meaning update all values instead of just updating file list. I'll fix it.

ltdrdata avatar Mar 27 '23 07:03 ltdrdata

Done. Now I removed REFRESH_LIST. And updating all combo list. I don't updating other content to avoid unexpected side-effect.

ltdrdata avatar Mar 27 '23 08:03 ltdrdata