Files
talesofai-comfyui-browser/README.md
T
Logan Barnett e406d40ad6 read paths from configuration file
This updates the automatic path detection to use a configuration file
_optionally_ as a means of overriding the paths used by
`comfyui-browser`.  This change is motivated by recent work I have done
with ComfyUI and Nix, wherein I provided [an easy means to install
`comfyui-browser` via
Nix](https://github.com/loganbarnett/dotfiles/blob/ccbfe12e755ab3d6d24b3f0f5a3386208b23357f/nix/hacks/comfyui/custom-nodes.nix#L50-L74).
The big reason this was necessary for my Nix work is because Nix's
installations are locked down into a purely read-only store.  I needed a
place to put things such as the `collections` path into a location that
`comfyui-browser` could write to.

I don't expect `comfyui-browser` to directly support Nix. My hope is
that allowing the directories to be configurable, with the defaults
being exactly what was used to before, to be something desirable for the
project in a general sense, and not just for Nix.

I've tested this under a Nix configuration with `config.json` values
being used.  Unfortunately I don't have a means to test
`comfyui-browser` outside of Nix, as the `comfyui` and CUDA setup was
hard enough with Nix itself.  So to be clear - this isn't tested under
the standard configuration that most `comfyui-browser` users are using.
I suggest giving these changes a quick spin to make sure I didn't miss
anything.  I did my best to make the code changes branchless - in that
no new code paths are added - just a default means of determining what
the configuration values should be.  Memoization is used to ensure that
the order in which these functions are called is irrelevant.

Unfortunately I am not familiar at all with Chinese/Mandarin(?) to write
the documentation for it - perhaps someone else can pick that up?

Earmarked as part of this:  I've changed the `mkdir` calls to
`makedirs`, which adds all directories in the chain that are missing,
and the `exist_ok` argument means the call will not fail if the
directory already exists, which allows us to clean up a little code.

Thanks for your work on maintaining this useful custom nodes project!
2024-04-22 16:09:34 -07:00

5.2 KiB

ComfyUI Browser

中文说明

This is an image/video/workflow browser and manager for ComfyUI. You can sync your workflows to a remote Git repository and use them everywhere.

Welcome to submit your workflow source by submitting an issue. Let's build the workflows together.

https://github.com/talesofai/comfyui-browser/assets/828837/803ce57a-1cf2-4e1c-be17-0efab401ef54

Features

  • Browse and manage your images/videos/workflows in the output folder.
  • Add your workflows to the 'Saves' so that you can switch and manage them more easily.
  • Sync your 'Saves' anywhere by Git.
  • Subscribe workflow sources by Git and load them more easily.
  • Search your workflow by keywords.
  • Some useful custom nodes like xyz_plot, inputs_select.

Custom Nodes

Select Inputs

  • Select any inputs of the current graph.
image

XYZ Plot

  • Simple XYZ Plot by selecting inputs and filling in the values.
image image

Preview

Outputs

Outputs

Saves

Saves

Sources

Sources Recommended Sources

Models

Models

Side Bar View

SideBar

Installation

ComfyUI Manager

Install ComfyUI Manager, search comfyui-browser in Install Custom Node and install it.

Configuring

In your comfyui-browser directory, you can add a config.json to override the directories that comfyui-browser uses. Ex:

{
  "collections": "/var/lib/comfyui/comfyui-browser-collections",
  "download_logs": "/var/lib/comfyui/comfyui-browser-download-logs",
  "outputs": "/var/lib/comfyui/outputs",
  "sources": "/var/lib/comfyui/comfyui-browser-sources"
}

The default configuration values are:

{
  "collections": "[comfyui-browser]/collections",
  "download_logs": "[comfyui-browser]/download-logs",
  "outputs": "[comfyui]/outputs",
  "sources": "[comfyui-browser]/sources"
}

Where [comfyui-browser] is the automatically determined path of your comfyui-browser installation, and [comfyui] is the automatically determined path of your comfyui server. Notably, the outputs directory defaults to the --output-directory argument to comfyui itself, or the default path that comfyui wishes to use for the --output-directory argument.

Manually

Clone this repo into the custom_nodes folder and restart the ComfyUI.

cd custom_nodes && git clone https://github.com/tzwm/comfyui-browser.git

Notes

  • Your 'Saves' are stored in the collections configuration value. See Configuring for its default, and how to set the path to something different.
  • Press 'B' to toggle the Browser dialog in the ComfyUI.

Development

  • Prerequisite

  • Framework

  • Project Structure

├── __init__.py  (Backend Server)
├── web          (Frontend code loaded by ComfyUI)
    ├── build    (Built in Svelte)
    └── index.js (Frontend that interact with ComfyUI)
├── svelte       (Frontend in the Modal as a iframe, written in Svelte)
  • Build and Run

    • Copy or link comfyui-browser to ComfyUI/custom_nodes/
    • Start backend by cd ComfyUI && python main.py --enable-cors-header
    • Start frontend by cd ComfyUI/custom_nodes/comfyui-browser/svelte && npm i && npm run dev
    • Open and debug by http://localhost:5173/?comfyUrl=http://localhost:8188
      • It will use localhost:8188 as ComfyUI server
      • localhost:5173 is a Vite dev server
  • Notes

    • Please try to test on Windows, because I only have Linux/macOS

TODO

  • Sync collections to remote git repository
  • Add external git repository to local collections
  • Search workflow by node name and model name

ChangeLog

To see ChangeLog.

Credits