Skip to content

Moving models download settings to user settings. #3216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lerignoux
Copy link
Contributor

@lerignoux lerignoux commented Mar 24, 2025

I would like to be able to customize the download urls for comfy to whitelist new models servers.

I saw there was a todo in the front end part suggesting to do this change in particular so I decided to do it.

It should be completely transparent for user, just allow to customize the comfy.settings.json to have a custom option in case it needs to be changed.
See linked API changes

I didn't find any relevant unit test to add, but please tell me if you think there should be one (both the modal and settings are already tested.)

┆Issue is synchronized with this Notion page by Unito

@lerignoux lerignoux requested a review from a team as a code owner March 24, 2025 05:05
@lerignoux lerignoux marked this pull request as draft March 24, 2025 05:06
@lerignoux lerignoux force-pushed the models_download_configuration branch 2 times, most recently from ff613ca to bf0df5c Compare March 24, 2025 05:15
@lerignoux lerignoux force-pushed the models_download_configuration branch from bf0df5c to a0888d9 Compare March 24, 2025 10:31
@lerignoux
Copy link
Contributor Author

I am not sure what kind of tests could be added. Do you see any or is it ok without additional tests ?

@lerignoux lerignoux force-pushed the models_download_configuration branch 2 times, most recently from d3d4e36 to edfbcf5 Compare March 24, 2025 13:52
@lerignoux lerignoux marked this pull request as ready for review March 24, 2025 14:03
Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for some context:

Originally I changed these hardcoded values to user settings, but they are reverted in https://github.com/Comfy-Org/ComfyUI_frontend/pull/890/files#r1772680306 with this TODO. The original idea for this TODO is to serve the allowed values from the backend server via server configuration rather than a value that the user can control.

@mcmonkey4eva for explaining what needs to be done here to resolve the TODO.

Ref: #890 (comment)

@lerignoux
Copy link
Contributor Author

Just for some context:

Originally I changed these hardcoded values to user settings, but they are reverted in https://github.com/Comfy-Org/ComfyUI_frontend/pull/890/files#r1772680306 with this TODO. The original idea for this TODO is to serve the allowed values from the backend server via server configuration rather than a value that the user can control.

@mcmonkey4eva for explaining what needs to be done here to resolve the TODO.

Ref: #890 (comment)

Thank you for the feedback.

I tried to follow what I understood from the discussion intention.
I could not find a relevant API and config in Comfy so I tried adding a simple one.
Do you think it is acceptable ?
cf ComfyUI Merge Request

@lerignoux lerignoux force-pushed the models_download_configuration branch 4 times, most recently from ec2731a to df1055c Compare March 25, 2025 07:08
@lerignoux lerignoux requested a review from huchenlei March 25, 2025 07:19
@mcmonkey4eva
Copy link
Contributor

The download restrictions (last I looked at things some months ago) are defined in ComfyUI (the python code repo), the frontend is merely just prerendering what the python is going to say about it -- so the values should be sourced from the python repo (eg a consistent internal API). Frontend settings make no sense for that data. Frontend hardcoding is a lazy but functional placeholder.

@huchenlei
Copy link
Member

huchenlei commented Mar 25, 2025

The download restrictions (last I looked at things some months ago) are defined in ComfyUI (the python code repo), the frontend is merely just prerendering what the python is going to say about it -- so the values should be sourced from the python repo (eg a consistent internal API). Frontend settings make no sense for that data. Frontend hardcoding is a lazy but functional placeholder.

BTW, the model downloading logic has been removed from the comfyui backend, the download for standalone is just using browser's download to download the model file. Download to directory directly feature is only available on desktop version. I think it is fine now to have the validation in the frontend only.

Ref: comfyanonymous/ComfyUI#5432

@lerignoux
Copy link
Contributor Author

lerignoux commented Mar 26, 2025

The download restrictions (last I looked at things some months ago) are defined in ComfyUI (the python code repo), the frontend is merely just prerendering what the python is going to say about it -- so the values should be sourced from the python repo (eg a consistent internal API). Frontend settings make no sense for that data. Frontend hardcoding is a lazy but functional placeholder.

Thank you for the info.

I could not find a reference to this whitelist in the Comfy repo so I added a configuration and internal for it as you suggested.
Do you think it is ok ?
Cf MR

@lerignoux
Copy link
Contributor Author

validation in the frontend only.

I see.
So that would mean keeping the current code and just removing the comment (In that case I will just suggest to move the list to a constant file).
@mcmonkey4eva It seems the comment to move this to API download was coming from you is it ok to keep that in the front end code ?

@mcmonkey4eva
Copy link
Contributor

My comments in the code there are outdated to the modern system per huchenlei's explanation

@lerignoux lerignoux marked this pull request as draft March 29, 2025 14:37
Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on proceeding with orginal implementation of moving allow list to user settings.

@lerignoux lerignoux force-pushed the models_download_configuration branch from 523cb6e to 99b7822 Compare April 25, 2025 09:11
@lerignoux lerignoux force-pushed the models_download_configuration branch 6 times, most recently from d110f09 to c9092de Compare April 25, 2025 09:54
@lerignoux
Copy link
Contributor Author

lerignoux commented Apr 25, 2025

LGTM on proceeding with orginal implementation of moving allow list to user settings.

Hello

Sorry @huchenlei I was a bit lost, it seems adding this on front end and fetching the settings from Comfy API was ok.
Just in case I did a draft of fully front control of this.
Cf https://github.com/Comfy-Org/ComfyUI_frontend/pull/3638/files
Though security wise I think the current implementation is better.
I'll try to check how to trigger the PR on backend side. If you know someone who could help with the review please tell me.

Cheers

@lerignoux lerignoux force-pushed the models_download_configuration branch from c9092de to df1055c Compare April 26, 2025 06:35
@lerignoux lerignoux force-pushed the models_download_configuration branch from df1055c to 19ce1a8 Compare April 27, 2025 13:37
@lerignoux lerignoux force-pushed the models_download_configuration branch 2 times, most recently from ef8e0ee to c1a66d0 Compare April 28, 2025 15:34
@lerignoux lerignoux force-pushed the models_download_configuration branch from c1a66d0 to bfd7455 Compare April 28, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants