adieyal / comfyui-dynamicprompts

ComfyUI custom nodes for Dynamic Prompts
MIT License
187 stars 20 forks source link

Feature Request: Reload wildcard files on queue start #37

Open michaelLochlann opened 7 months ago

michaelLochlann commented 7 months ago

Current State: Wildcard files appear to be loaded once at ComfyUI start and never refreshed again.
This means any wildcard file changes/edits require a ComfyUI restart to use.

Proposed State: Whenever you hit "Queue Prompt" or "Refresh" on ComfyUI it should reload the wildcard files.
This is how A1111 does it currently.

I wouldn't imagine this would be a resource problem as it's just text files and those normally handle pretty fast.
So it seems to me a programming/ComfyUI problem to solve.

Hopefully we can get this as troubleshooting/adding to wildcard files will be a big pain if you have to restart every time.

rafstahelin commented 5 months ago

Has this been fixed?

darkpixel commented 5 months ago

It doesn't appear so. I'm running the latest release, and I still have to restart ComfyUI after updating wildcard text files.

rafstahelin commented 5 months ago

It doesn't appear so. I'm running the latest release, and I still have to restart ComfyUI after updating wildcard text files.

really not worth it. I Think a better solution might be to go for Comfyroll Custom Nodes "List Nodes" as you can save lists and update lists on the fly on the workflow itself

michaelLochlann commented 5 months ago

What I've been doing is closing the python EXE and restarting it then going back to the browser window I had open. But it makes testing additions/changes an extreme PITA. List nodes might be good if it's static but the dynamic prompts also allow you to weight different things to show up more often or less often, which I'm using extensively. I would think if the program had a "load wildcards" function it would be trivial to call it on run instead of on load, but I dunno how any of this works.

rafstahelin commented 5 months ago

We could ask the developer of list nodes to add a load from yaml node that lets you use weights. She's on Ai Revolution discord. I'll ask her there, and that would just solve the refresh annoyance

darkpixel commented 5 months ago

I worked around this by writing a simple ComfyUI add-on that accepts a filename, reads the file, strips out blank lines and any text after a comment (# character) and then feed that into a "Text Random Line" node.

The reason dynamicprompts isn't re-reading on every access is probably because the wildcard files are read during __init__ here (https://github.com/adieyal/comfyui-dynamicprompts/blob/3f2fff32358cf39e21b8b440ca87eac9a8e2bade/nodes/magicprompt.py#L15) instead of during the call to get_prompt.

rafstahelin commented 5 months ago

Could I install this addon? Mind sharing?

darkpixel commented 5 months ago

I'm still working on cleaning it up and getting things packaged. We're in the middle of a huge ice storm at the moment, so I've got my hands full, but I'll try to get it shared within the next few days.

rafstahelin commented 5 months ago

Oh I wish I could be in a thunder storm. Ok!

darkpixel commented 5 months ago

Hey @rafstahelin, I finally polished the code off and tossed it into my production workflow. Not sure if it's what you're looking for, but it's already working well for me.

https://github.com/darkpixel/darkprompts

It's not in the ComfyUI Manager list yet because I still have some packaging work to do, but the README explains the simple install. Feel free to leave a bug report if you run into any trouble.

rafstahelin commented 5 months ago

Ok awesome will try now What time zone are you on in case I have a question Best, Raf On 20 Jan 2024, at 05:49, Aaron C. de Bruyn @.***> wrote: Hey @rafstahelin, I finally polished the code off and tossed it into my production workflow. Not sure if it's what you're looking for, but it's already working well for me. https://github.com/darkpixel/darkprompts It's not in the ComfyUI Manager list yet because I still have some packaging work to do, but the README explains the simple install. Feel free to leave a bug report if you run into any trouble.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

darkpixel commented 5 months ago

GMT-8