202 Commits

Author SHA1 Message Date
Chenlei Hu
8e56ed7a99 Use new TS frontend uncompressed (#4379)
* Swap frontend uncompressed

* Add uncompressed files
2024-08-15 16:50:25 -04:00
guill
f12ab2e978 Execution Model Inversion (#2666)
* Execution Model Inversion

This PR inverts the execution model -- from recursively calling nodes to
using a topological sort of the nodes. This change allows for
modification of the node graph during execution. This allows for two
major advantages:

    1. The implementation of lazy evaluation in nodes. For example, if a
    "Mix Images" node has a mix factor of exactly 0.0, the second image
    input doesn't even need to be evaluated (and visa-versa if the mix
    factor is 1.0).

    2. Dynamic expansion of nodes. This allows for the creation of dynamic
    "node groups". Specifically, custom nodes can return subgraphs that
    replace the original node in the graph. This is an incredibly
    powerful concept. Using this functionality, it was easy to
    implement:
        a. Components (a.k.a. node groups)
        b. Flow control (i.e. while loops) via tail recursion
        c. All-in-one nodes that replicate the WebUI functionality
        d. and more
    All of those were able to be implemented entirely via custom nodes,
    so those features are *not* a part of this PR. (There are some
    front-end changes that should occur before that functionality is
    made widely available, particularly around variant sockets.)

The custom nodes associated with this PR can be found at:
https://github.com/BadCafeCode/execution-inversion-demo-comfyui

Note that some of them require that variant socket types ("*") be
enabled.

* Allow `input_info` to be of type `None`

* Handle errors (like OOM) more gracefully

* Add a command-line argument to enable variants

This allows the use of nodes that have sockets of type '*' without
applying a patch to the code.

* Fix an overly aggressive assertion.

This could happen when attempting to evaluate `IS_CHANGED` for a node
during the creation of the cache (in order to create the cache key).

* Fix Pyright warnings

* Add execution model unit tests

* Fix issue with unused literals

Behavior should now match the master branch with regard to undeclared
inputs. Undeclared inputs that are socket connections will be used while
undeclared inputs that are literals will be ignored.

* Make custom VALIDATE_INPUTS skip normal validation

Additionally, if `VALIDATE_INPUTS` takes an argument named `input_types`,
that variable will be a dictionary of the socket type of all incoming
connections. If that argument exists, normal socket type validation will
not occur. This removes the last hurdle for enabling variant types
entirely from custom nodes, so I've removed that command-line option.

I've added appropriate unit tests for these changes.

* Fix example in unit test

This wouldn't have caused any issues in the unit test, but it would have
bugged the UI if someone copy+pasted it into their own node pack.

* Use fstrings instead of '%' formatting syntax

* Use custom exception types.

* Display an error for dependency cycles

Previously, dependency cycles that were created during node expansion
would cause the application to quit (due to an uncaught exception). Now,
we'll throw a proper error to the UI. We also make an attempt to 'blame'
the most relevant node in the UI.

* Add docs on when ExecutionBlocker should be used

* Remove unused functionality

* Rename ExecutionResult.SLEEPING to PENDING

* Remove superfluous function parameter

* Pass None for uneval inputs instead of default

This applies to `VALIDATE_INPUTS`, `check_lazy_status`, and lazy values
in evaluation functions.

* Add a test for mixed node expansion

This test ensures that a node that returns a combination of expanded
subgraphs and literal values functions correctly.

* Raise exception for bad get_node calls.

* Minor refactor of IsChangedCache.get

* Refactor `map_node_over_list` function

* Fix ui output for duplicated nodes

* Add documentation on `check_lazy_status`

* Add file for execution model unit tests

* Clean up Javascript code as per review

* Improve documentation

Converted some comments to docstrings as per review

* Add a new unit test for mixed lazy results

This test validates that when an output list is fed to a lazy node, the
node will properly evaluate previous nodes that are needed by any inputs
to the lazy node.

No code in the execution model has been changed. The test already
passes.

* Allow kwargs in VALIDATE_INPUTS functions

When kwargs are used, validation is skipped for all inputs as if they
had been mentioned explicitly.

* List cached nodes in `execution_cached` message

This was previously just bugged in this PR.
2024-08-15 11:21:11 -04:00
pythongosssss
138be79254 Add support for simple tooltips (#3842)
* Add support for simple tooltips

* Fix overflow

* Add tooltips for nodes in the default workflow

* new line

* Prevent potential crash

* PR feedback

* Hide tooltip when clicking (e.g. combo widget)

* Refactor tooltips, add node level support

* Fix

* move

* Fix test (and undo last change)

* Fixed indent

* Fix dom widgets, dont show tooltip if not over canvas
2024-08-14 01:22:10 -04:00
bymyself
3d3f398d6d Fix loadGraphData call during restore (#3976) 2024-07-09 11:23:26 -04:00
ruucm
8335f9f33f enable cmd shortcuts for mac (mute & bypass) (#3792) 2024-07-01 13:45:34 -04:00
Chenlei Hu
0d3e55ac9a Fix loadGraphData func call (#3918) 2024-07-01 12:10:44 -04:00
comfyanonymous
42d174042e Fix workflow not importing from flac files on some systems. 2024-06-30 15:51:54 -04:00
comfyanonymous
a7050b3f3b Switch to the real cfg++ method in the samplers.
The old _pp ones will be updated automatically to the regular ones with 2x
the cfg.

My fault for not checking what the "_pp" samplers actually did.
2024-06-29 11:59:48 -04:00
comfyanonymous
69450606f8 Save and load workflow from the flac files output by SaveAudio. 2024-06-27 02:07:29 -04:00
Chenlei Hu
931752783b Add audio widget (#3863)
* Add audio widget

* Fix audio bugs

* Add CSS

* Populate audio widget when load history
2024-06-27 00:22:55 -04:00
pythongosssss
cc04e712ff Fix merge issue breaking api json loading (#3876) 2024-06-26 09:08:48 -04:00
pythongosssss
5e1bcc95b5 New Menu & Workflow Management (#3112)
* menu

* wip

* wip

* wip

* wip

* wip

* workflow saving/loading

* Support inserting workflows
Move buttosn to top of lists

* fix session storage
implement renaming

* temp

* refactor, better workflow instance management

* wip

* progress on progress

* added send to workflow
various fixes

* Support multiple image loaders

* Support dynamic size breakpoints based on content

* various fixes
add close unsaved warning

* Add filtering tree

* prevent renaming unsaved

* fix zindex on hover

* fix top offset

* use filename as workflow name

* resize on setting change

* hide element until it is drawn

* remove glow

* Fix export name

* Fix test, revert accidental changes to groupNode

* Fix colors on all themes

* show hover items on smaller screen (mobile)

* remove debugging code

* dialog fix

* Dont reorder open workflows
Allow elements around canvas

* Toggle body display on setting change

* Fix menu disappearing on chrome

* Increase delay when typing, remove margin on Safari, fix dialog location

* Fix overflow issue on iOS

* Add reset view button
Prevent view changes causing history entries

* Bottom menu wip

* Various fixes

* Fix merge

* Fix breaking old menu position

* Fix merge adding restore view to loadGraphData
2024-06-25 06:49:25 -04:00
Juanjuan
86a79ec55a fix app.js no graph defined (#3754)
* local test

* fix "graph" not found

* fix

---------

Co-authored-by: Xiujuan Li <xiujuali@amazon.com>
2024-06-17 07:56:53 -04:00
comfyanonymous
549a678459 Don't load the view coordinates when loading a workflow from the history.
I think this makes things slightly less annoying for some users.
2024-06-03 19:48:27 -04:00
DLohn
29fa0829b5 Load titles from API format JSON (#3563) 2024-05-24 23:53:15 -04:00
freakabcd
4ca5be37fd Show message on error when loading wf from file (works on drag and drop) (#3466) 2024-05-13 15:22:22 -04:00
comfyanonymous
348bbba11d Add a button to reset the view. 2024-05-10 17:30:52 -04:00
pythongosssss
116a7a7567 Setting for saving and restoring canvas position and zoom level (#3437) 2024-05-10 17:07:46 -04:00
Dr.Lt.Data
19279eb681 feat: shortcuts for zoom in/out (#3410)
* feat: shortcuts for zoom in/out

* feat: pen support for canvas zoom

ctrl + LMB + vertical drag

* Ctrl+LMB+Drag -> ctrl+Shift+LMB+Drag

---------

Co-authored-by: Lt.Dr.Data <lt.dr.data@gmail.com>
2024-05-07 04:40:56 -04:00
pythongosssss
be3b1c12b0 Support linking converted inputs from api json 2024-02-06 16:55:55 +00:00
Chaoses-Ib
9b9754a63b Fix frontend webp prompt handling 2024-02-02 13:27:03 +08:00
pythongosssss
7f5536d5f9 Make auto saved workflow stored per tab 2024-01-29 18:43:59 +00:00
pythongosssss
44ab999596 Support refresh on group node combos (#2625)
* Support refresh on group node combos

* fix check
2024-01-23 14:15:52 -05:00
pythongosssss
d6501dbbf8 Auto queue on change (#2542)
* Add toggle to enable auto queue when graph is changed

* type fix

* better

* better alignment

* Change undoredo to not ignore inputs when autoqueue in change mode
2024-01-16 08:27:40 -05:00
pythongosssss
028d789bf2 Adds copy image option if browser feature available (#2544)
* Adds copy image option if browser feature available

* refactor
2024-01-14 14:53:52 -05:00
pythongosssss
35202190d5 add setting to change control after generate to run before 2024-01-13 18:57:47 +00:00
pythongosssss
9f2a191a0e Store user settings/data on the server and multi user support (#2160)
* wip per user data

* Rename, hide menu

* better error
rework default user

* store pretty

* Add userdata endpoints
Change nodetemplates to userdata

* add multi user message

* make normal arg

* Fix tests

* Ignore user dir

* user tests

* Changed to default to browser storage and add server-storage arg

* fix crash on empty templates

* fix settings added before load

* ignore parse errors
2024-01-08 17:06:44 -05:00
comfyanonymous
a687cfeda8 Reregister nodes when pressing refresh button. 2023-12-31 05:05:14 -05:00
comfyanonymous
af2e6bea61 Only add _meta title to api prompt when dev mode is enabled in UI. 2023-12-27 01:07:02 -05:00
AYF
1feaeb1255 Add title to the API workflow json. (#2380)
* Add `title` to the API workflow json.

* API: Move `title` to `_meta` dictionary, imply unused.
2023-12-27 00:55:11 -05:00
pythongosssss
ba6f781a5e Group node fixes (#2259)
* Prevent cleaning graph state on undo/redo

* Remove pause rendering due to LG bug

* Fix crash on disconnected internal reroutes

* Fix widget inputs being incorrect order and value

* Fix initial primitive values on connect

* basic support for basic rerouted converted inputs

* Populate primitive to reroute input

* dont crash on bad primitive links

* Fix convert to group changing control value

* reduce restrictions

* fix random crash in tests
2023-12-13 00:56:39 -05:00
pythongosssss
8f0819da05 Prevent cleaning graph state on undo/redo (#2255)
* Prevent cleaning graph state on undo/redo

* Remove pause rendering due to LG bug
2023-12-11 12:33:35 -05:00
pythongosssss
6b45fc50cb allow muting group node 2023-12-03 17:04:16 +00:00
pythongosssss
a901a34487 Allow removing erroring embedded groups
Unregister group nodes on workflow change
2023-12-03 16:49:48 +00:00
comfyanonymous
743e7af567 Load api workflow if regular workflow isn't in loaded image. 2023-12-02 13:56:11 -05:00
comfyanonymous
0c2397b2ee Merge branch 'image-cache' of https://github.com/jn-jairo/ComfyUI 2023-12-02 13:02:33 -05:00
pythongosssss
d3f2725c7e Fix node growing with DOM widgets when adding image even if enough space 2023-12-02 12:02:03 +00:00
Jairo Correa
6cc2b30769 Merge branch 'master' into image-cache 2023-12-02 05:16:21 -03:00
pythongosssss
6c9d8e70e3 Add Extension tests (#2125)
* Add test for extension hooks
Add afterConfigureGraph callback

* fix comment
2023-12-01 17:24:20 -05:00
comfyanonymous
a1c37a56a4 Fix extension widgets not working. 2023-12-01 04:13:04 -05:00
pythongosssss
fe656b596d Group nodes (#1776)
* setup ui unit tests

* Refactoring, adding connections

* Few tweaks

* Fix type

* Add general test

* Refactored and extended test

* move to describe

* for groups

* wip group nodes

* Relink nodes
Fixed widget values
Convert to nodes

* Reconnect on convert back

* add via node menu + canvas
refactor

* Add ws event handling

* fix using wrong node on widget serialize

* allow reroute pipe
fix control_after_generate configure

* allow multiple images

* Add test for converted widgets on missing nodes + fix crash

* tidy

* mores tests + refactor

* throw earlier to get less confusing error

* support outputs

* more test

* add ci action

* use lts node

* Fix?

* Prevent connecting non matching combos

* update

* accidently removed npm i

* Disable logging extension

* fix naming
allow control_after_generate custom name
allow convert from reroutes

* group node tests

* Add executing info, custom node icon
Tidy

* internal reroute just works

* Fix crash on virtual nodes e.g. note

* Save group nodes to templates

* Fix template nodes not being stored

* Fix aborting convert

* tidy

* Fix reconnecting output links on convert to group

* Fix links on convert to nodes

* Handle missing internal nodes

* Trigger callback on text change

* Apply value on connect

* Fix converted widgets not reconnecting

* Group node updates
- persist internal ids in current session
- copy widget values when converting to nodes
- fix issue serializing converted inputs

* Resolve issue with sanitized node name

* Fix internal id

* allow outputs to be used internally and externally

* order widgets on group node
various fixes

* fix imageupload widget requiring a specific name

* groupnode imageupload test
give widget unique name

* Fix issue with external node links

* Add VAE model

* Fix internal node id check

* fix potential crash

* wip widget input support

* more wip group widget inputs

* Group node refactor
Support for primitives/converted widgets

* Fix convert to nodes with internal reroutes

* fix applying primitive

* Fix control widget values

* fix test
2023-11-30 14:13:27 -05:00
comfyanonymous
9623e03e9f Fix typo. 2023-11-23 23:20:07 -05:00
pythongosssss
70d30795c8 Call widget onRemove to remove element 2023-11-23 19:43:55 +00:00
pythongosssss
fb7ec62677 Animated image output support (#2008)
* Refactor multiline widget into generic DOM widget

* wip webp preview

* webp support

* fix check

* fix sizing

* show image when zoomed out

* Swap webp checkto generic animated image flag

* remove duplicate

* Fix falsy check
2023-11-21 01:33:58 -05:00
comfyanonymous
02b2b0e844 Always clone graph data when loading to fix some load issues. 2023-11-15 15:55:02 -05:00
pythongosssss
1fad73a662 Support number/text ids when importing API JSON (#1952)
* support numeric/text ids
2023-11-12 14:49:23 -05:00
Jairo Correa
f9261b3b00 Prevent image cache 2023-11-11 15:56:14 -03:00
pythongosssss
9347c9bdda Load API JSON (#1932)
* added loading api json

* revert async change

* reorder
2023-11-09 13:33:43 -05:00
comfyanonymous
3436a5f993 Fix sanitize node name removing the "/" character. 2023-11-09 13:10:19 -05:00
comfyanonymous
041ca2cdcd Sanitize unknown node types on load to prevent XSS. 2023-11-05 12:29:28 -05:00