61 Commits

Author SHA1 Message Date
comfyanonymous
772c265991 Add ruff rule for empty line with trailing whitespace. 2024-12-28 05:23:08 -05:00
Alexander Piskun
80c751b0c1 add_model_folder_path: ensure unique paths by removing duplicates (#5998)
* add_model_folder_path: ensure unique paths by removing duplicates

Signed-off-by: bigcat88 <bigcat88@icloud.com>

* refactored "add_model_folder_path" and added tests

---------

Signed-off-by: bigcat88 <bigcat88@icloud.com>
2024-12-13 18:19:22 -05:00
Chenlei Hu
9bffd67fc9 Lint unused import (#5973)
* Lint unused import

* nit

* Remove unused imports

* revert fix_torch import

* nit
2024-12-09 15:24:39 -05:00
comfyanonymous
3a6dc4a71a Update folder paths: "clip" -> "text_encoders"
You can still use models/clip but the folder might get removed eventually
on new installs of ComfyUI.
2024-11-02 15:35:38 -04:00
Brendan Hoar
fe9b1f6bf7 Update folder_paths.py - try/catch for special file_name values (#5187)
Somehow managed to drop a file called "nul" into a windows checkpoints subdirectory. This caused all sorts of havoc with many nodes that needed the list of checkpoints.
2024-10-08 15:04:32 -04:00
Alex "mcmonkey" Goodwin
fe379393f1 add 'is_default' to model paths config (#4979)
* add 'is_default' to model paths config

including impl and doc in example file

* update weirdly overspecific test expectations

* oh there's two

* sigh
2024-09-19 08:59:55 -04:00
Alex "mcmonkey" Goodwin
1836428f3d very simple strong-cache on model list (#4969)
* very simple strong-cache on model list

* store the cache after validation too

* only cache object_info for now

* use a 'with' context
2024-09-19 04:40:14 -04:00
Alex "mcmonkey" Goodwin
e4f4d46b62 add simple error check to model loading (#4950) 2024-09-17 03:57:17 -04:00
Robin Huang
2db65988c5 Add cli arg to override user directory (#4856)
* Override user directory.

* Use overridden user directory.

* Remove prints.

* Remove references to global user_files.

* Remove unused replace_folder function.

* Remove newline.

* Remove global during get_user_directory.

* Add validation.
2024-09-12 08:10:27 -04:00
bymyself
2b7ef8c9f0 Add content-type filter method to folder_paths (#4054)
* Add content-type filter method to folder_paths

* Add unit tests

* Hardcode webp content-type

* Annotate content_types as Literal["image", "video", "audio"]
2024-09-11 02:00:07 -04:00
Alex "mcmonkey" Goodwin
e158aa15f5 allow current timestamp in save image prefix (#4030) 2024-09-09 02:55:51 -04:00
comfyanonymous
a86fa7a05e unet -> diffusion_models. 2024-08-17 21:31:04 -04:00
PhilWun
6dc38ec333 Add type hints to folder_paths.py (#4191)
* add type hints to folder_paths.py

* replace deprecated standard collections type hints

* fix type error when using Python 3.8
2024-08-06 21:59:34 -04:00
comfyanonymous
fc6a27f36c Basic Flux Schnell and Flux Dev model implementation. 2024-08-01 09:49:29 -04:00
Chenlei Hu
819c60231b 3.8 Compatible type annotation (#3938) 2024-07-03 19:31:46 -04:00
Chenlei Hu
161107fd8d Add --no-custom-node cmd flag (#3903)
* Add --no-custom-node cmd flag

* nit
2024-07-01 17:54:03 -04:00
comfyanonymous
2058e06ff6 More proper fix for #3484. 2024-05-16 00:11:01 -04:00
comfyanonymous
d5efb0cf00 Sync some minor changes from the other repo. 2024-04-19 03:43:09 -04:00
comfyanonymous
c3970a24a9 Add a helpful warning for links that don't point anywhere. 2024-04-17 12:28:05 -04:00
comfyanonymous
444caaaf7d Switch prints to logging in folder_paths and add some extra debug. 2024-03-29 03:07:13 -04:00
comfyanonymous
646783d2b4 Add experimental photomaker nodes.
Put the model file in models/photomaker and use PhotoMakerLoader.

Then use PhotoMakerEncode with the keyword "photomaker" to apply the image
2024-01-24 09:51:42 -05:00
TFWol
239fd84407 Add error handling to initial fix to keep cache intact 2024-01-14 15:06:33 -08:00
TFWol
782127cae3 Resolved crashing nodes caused by FileNotFoundError during directory traversal
- Implemented a `try-except` block in the `recursive_search` function to handle `FileNotFoundError` gracefully.
- When encountering a file or directory path that cannot be accessed (causing `FileNotFoundError`), the code now logs a warning and skips processing for that specific path instead of crashing the node (CheckpointLoaderSimple was usually the first to break). This allows the rest of the directory traversal to proceed without interruption.
2024-01-11 06:34:33 -08: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
ebf33718de This cache timeout is pretty useless in practice. 2023-12-29 17:47:24 -05:00
comfyanonymous
44c796430a Merge branch 'fix_folders_handling' of https://github.com/fazo96/ComfyUI 2023-11-29 14:10:30 -05:00
David Jeske
3be2e9153d better error for invalid output paths 2023-11-26 13:10:31 -07:00
Enrico Fasoli
847e4d59ee fix: folder handling issues 2023-11-23 22:24:58 +01:00
Jairo Correa
00716412f2 Allow all extensions if extension list is empty 2023-10-14 11:59:35 -03:00
comfyanonymous
18e4504de7 Pull some small changes from the other repo. 2023-10-11 20:38:48 -04:00
Jairo Correa
26a1afbcfe Option to input directory 2023-10-04 19:45:15 -03:00
comfyanonymous
cef8d61323 Allow checkpoints with .pt and .bin extensions. 2023-09-10 02:36:04 -04:00
comfyanonymous
74be111cf2 Remove prints. 2023-09-05 23:46:37 -04:00
Michael Poutre
5e18db4f41 feat: Exclude .git when retrieving filename lists
In the future could support user provided excluded dirs via config file
2023-09-04 17:50:32 -07:00
Michael Poutre
05be5016b7 feat: Add support for excluded_dirs to folder_paths.recursive_search
Refactored variable names to better match what they represent
2023-09-04 17:50:32 -07:00
comfyanonymous
64510bb4c2 Add --temp-directory argument to set temp directory. 2023-08-11 05:13:03 -04:00
comfyanonymous
9aadeda4c4 Don't ignore extra paths that don't exist. 2023-08-11 02:41:04 -04:00
comfyanonymous
2ff6108df3 Support loading unet files in diffusers format. 2023-07-05 17:38:59 -04:00
comfyanonymous
d421e5d610 Refactor previews into one command line argument.
Clean up a few things.
2023-06-06 02:13:05 -04:00
space-nuko
02947e1974 Fix 2023-06-05 09:20:20 -05:00
comfyanonymous
c180012adf Ignore folder path directories that don't exist. 2023-06-02 16:48:56 -04:00
comfyanonymous
30619e179d Smarter filename list caching. 2023-06-02 16:34:47 -04:00
space-nuko
860143dfb6 Prevent callers from mutating folder lists 2023-05-31 21:07:27 -04:00
comfyanonymous
61cd736bb1 Keep list of filenames and only refresh it when something changes. 2023-05-30 18:48:50 -04:00
comfyanonymous
6bb45c981b Check if folder_name is valid instead of just throwing exception. 2023-05-30 16:44:09 -04:00
comfyanonymous
ebf6e2c421 Add route to get safetensors metadata:
/view_metadata/loras?filename=lora.safetensors
2023-05-29 02:48:50 -04:00
comfyanonymous
d24239d0ba Safetensors isn't optional anymore. 2023-05-26 21:46:11 -04:00
comfyanonymous
bd819d4b72 LoadLatent and SaveLatent should behave like the LoadImage and SaveImage. 2023-05-18 00:09:12 -04:00
comfyanonymous
7e151778a3 Masked editor changes.
Add a way to upload to subfolders.

Clean up code.

Fix some issues.
2023-05-08 14:37:51 -04:00
Dr.Lt.Data
4c259c71e5 Clipspace Menu and MaskEditor application. (#548)
* Add clipspace feature.
* feat: copy content to clipspace
* feat: paste content from clipspace

Extend validation to allow for validating annotated_path in addition to other parameters.

Add support for annotated_filepath in folder_paths function.

Generalize the '/upload/image' API to allow for uploading images to the 'input', 'temp', or 'output' directories.

* rename contentClipboard -> clipspace

* Do deep copy for imgs on copy to clipspace.

* mask painting on clipspace

* add original_imgs into clipspace
* Preserve the original image when 'imgs' are modified

* robust patch & refactoring folder_paths about annotated_filepath

* wip

* Only show the Paste menu if the ComfyApp.clipspace is not empty

* clipspace feature added
maskeditor feature added

* instant refresh on paste

force triggering 'changed' on paste action

* enhance mask painting

smooth drawing
add brush_size +/- button

* robust patch

use mouseup event

* robust patch

again...

* subfolder fix on paste logic

attach subfolder if subfolder isn't empty

* event listener patch

add ], [ key event for brush size
remove listener on close

* Fix button positioning issue related to window height.
Change brush size from button to slider.

* clean commit

* clean code

* various bug fixes

* paste action
- prevent opening upload popup
- ensure rendering after widget_value update

* view api update
- support annotated_filepath

* maskeditor layout
- prevent covering button by hidden div

* remove dbg message

* Add cursor functionality to display brush size

* refactor: Replace brush preview feature with missionfloyd implementation

* missionfloyd implementation
* hiding brush preview off the canvas
* change brush size on wheel event

* keyup -> keydown event

* Update web/extensions/core/maskeditor.js

Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>

* Add support for channel-specific image data retrieval in /view API to fix alpha mask loading issue

When loading an image with an alpha mask in JavaScript canvas, there is an issue where the alpha and RGB channels are premultiplied. To avoid reliance on JavaScript canvas, I added support for channel-specific image data retrieval in the "/view" API. This allows us to retrieve data for each channel separately and fix the alpha mask loading issue. The changes have been committed to the repository.

* Enable brush preview for key and slider events

* optimize

* preview fix

* robust patch

* fix copy (clipspace) action
imgs[0] copy -> whole imgs copy

* support batch images on clipspace, maskeditor

* copy/paste bug fixes for batch images
enhance selector preview on clipspace menu
add img_paste_mode option into clipspace menu

* crash fix

* print message if clipspace content cannot editable

* Update web/extensions/core/maskeditor.js

Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>

* make default img_paste_mode to 'selected'

refactor space -> tab

* save clipspace files to input/clipspace instead of temp

* show "clipspace/filename.png" instead of 'filename.png [clipspace]' in LoadImage/LoadImageMask

* refresh fix related to FILE_COMBO

* Update web/extensions/core/maskeditor.js

Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>

* Update web/extensions/core/maskeditor.js

Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>

* adjust margin based on missionfloyd impelements

* mouse event -> pointer event

* pen, touch, mouse drawing patched and tested

* Update web/extensions/core/maskeditor.js

Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>

* add comment about touch event.

---------

Co-authored-by: Lt.Dr.Data <lt.dr.data@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
2023-05-08 14:37:36 -04:00