ImDarkTom / ComfyUIMini

A mobile-friendly WebUI to run ComfyUI workflows.
GNU Affero General Public License v3.0
162 stars 5 forks source link

Opening gallery leads to an error #10

Open Raikiri opened 1 week ago

Raikiri commented 1 week ago

As the title says:

ReferenceError: /run/media/alexander/BigLinuxData/AI/MiniComfyUi/ComfyUIMini/src/views/pages/gallery.ejs:12
    10|         <div id="subfolders-list">
    11|             <a href="/gallery" class="subfolder-link">(Default)</a>
 >> 12|             <% for (const subfolder of scanned.subfolders) { %>
    13|                 <a href="/gallery/<%= subfolder %>" class="subfolder-link"><%= subfolder %></a>
    14|             <% } %>
    15|         </div>

scanned is not defined

Running on linux/NixOS

ImDarkTom commented 1 week ago

Have you set an output directory in config/default.json?

Raikiri commented 1 week ago

No, I didn't realize it was a thing that I needed to do. Does it make sense to set up some sensible default location for that? At least selecting cwd as the location for the output folder is unlikely to spam it anywhere unexpected.

Raikiri commented 1 week ago

Hm.. for some reason after defining the output directory, it can now open it in the "Gallery" menu option, but it does not seem to save any generated images there. Am I doing something wrong?

ImDarkTom commented 1 week ago

You need to set it to the ComfyUI output folder, for example if your ComfyUI instance is at /home/user/AI/ComfyUI/ your output folder should be /home/user/AI/ComfyUI/output/, note that this isn't where generated images are outputted but rather where it scans for images.

Raikiri commented 1 week ago

Right, I just realized that. Hmm.. should ComfyUIMini then copy generated files into its own gallery? My ComfyUI has a bunch of stuff from other workflows that probably should not appear in ComfyUIMini's gallery.

Maybe at least show a warning if it's not set at all instead of doing a runtime error?

Thanks for the program btw. I think it's hugely useful and it's a shame ComfyUI is not shipped with something like this.

ImDarkTom commented 1 week ago

Maybe at least show a warning if it's not set at all instead of doing a runtime error?

I'll work on adding that

ImDarkTom commented 1 week ago

Thanks for the program btw. I think it's hugely useful and it's a shame ComfyUI is not shipped with something like this.

Thank you for the support! I chose not to include ComfyUI built-in as I wanted it to be used on top of an existing ComfyUI install that way any extensions/extra model dirs don't need to be configured twice. I might add an install script that installs ComfyUI if the user does not have it already installed.

Raikiri commented 1 week ago

Technically speaking, the interface of interaction with ComfyUI is supposed to be the TCP socket. So it feels a little awkward that ComfyUIMini runs perfectly well using just that socket for everything except browsing the gallery. It does have access to the images that ComfyUI generates via the socket, so why not have them saved in ComfyUIMini's location to fully break the filesystem connection between the two? Heck, maybe my ComfyUI runs in a virtual machine and I want to run ComfyUIMini outside of it? Maybe it's a stretch, but what if I'm running ComfyUI on my desktop and I want to run ComfyUIMini on a laptop? -- maybe it's not very practical, but I see no technical reason why it has to be impossible.

Raikiri commented 1 week ago

Do you think you can integrate ComfyUIMini into ComfyUI instead? Unfortunately, they run on python and you run on nodejs, so it's not trivial.

ImDarkTom commented 1 week ago

It does have access to the images that ComfyUI generates via the socket, so why not have them saved in ComfyUIMini's location to fully break the filesystem connection between the two?

I get that it would be possible to save each generated image into a folder within ComfyUIMini but practically it wouldn't be useful to have the same generated image be saved in two locations, especially if it's running on the same device.

I do want to be able to fetch all previously generated images from ComfyUI via the api and not using the filesystem as it would mean that you wouldn't need to set any redundant configs when running the app and also be able to access ComfyUI instances not locally running on the same device as ComfyUIMini, but currently from looking at the ComfyUI source code it does not seem that there is a straightforward way to do this.