Skip to content

Conversation

@Kosinkadink
Copy link
Collaborator

@Kosinkadink Kosinkadink commented Sep 27, 2025

With most of the networking and db code done by @bigcat88 , this PR:

  • Adds db support for 'assets'
  • Adds 'asset' API endpoints
  • Adds an initial fast asset scan upon boot + on every object_info API call

Models are the only thing that will be treated as 'assets' currently. Goal is for the hash + tags to be used in a new Asset widget that will allow workflows to embed the hash of models, so that it will be easy to share workflows and know exactly what model is needed.

As the first step, while this PR does introduce blake3 hashing, it does not actually make use of it since the frontend elements are not ready - so no hashing enabled just yet. When enabled in the future, it will hash just the first time a model is loaded.

ETA: will review with @comfyanonymous on Saturday 9/27 to determine if any changes need to be made to this initial version.

pythongosssss and others added 30 commits June 1, 2025 15:32
@Kosinkadink Kosinkadink added the Core Core team dependency label Sep 27, 2025
@bigcat88
Copy link
Contributor

just fyi: CI fails on macOS due to missing greenlet package, maybe it can be added to requirements.

christian-byrne added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Oct 23, 2025
)

## Summary

Moves the fetch and post-fetch logic associated with the asset browser
into the component and shows a loading state while fetching.

To test, use this branch:
comfyanonymous/ComfyUI#10045



https://github.com/user-attachments/assets/718974d5-efc7-46a0-bcd6-e82596d4c389

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6189-load-assets-browser-before-fetch-completes-and-show-loading-state-2946d73d365081879d1bd05d86e8c036)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <[email protected]>
github-actions bot pushed a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Oct 23, 2025
)

## Summary

Moves the fetch and post-fetch logic associated with the asset browser
into the component and shows a loading state while fetching.

To test, use this branch:
comfyanonymous/ComfyUI#10045



https://github.com/user-attachments/assets/718974d5-efc7-46a0-bcd6-e82596d4c389

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6189-load-assets-browser-before-fetch-completes-and-show-loading-state-2946d73d365081879d1bd05d86e8c036)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <[email protected]>
Copy link
Collaborator Author

@Kosinkadink Kosinkadink left a comment

Choose a reason for hiding this comment

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

I reviewed the PR with comfy today. The biggest issues are that there are parts of code that seem to have unnecessary mistakes, and there are still references in code for postgres (I know some were removed previously already). Because the size of this PR is so big and enables things that aren't being used yet, the above issues are making him question the quality of what we are trying to get in.

I think if we want to get this through, we need to lock in and only keep things that are relevant to what we are doing right now. Otherwise, there is going to be the feeling for comfy that this is a sort of 'trojan horse' of a PR that has a bunch of unnecessary things in it.

We don't need this PR to do everything, we don't even know the scope of the assets on local besides models tbh. I can provide more guidance on slack.

if field is None:
break

fname = getattr(field, "name", "") or ""
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was something comfy spotted, where the or "" is unnecessary since getattr already returns "", and there are some similar things like with the os.path.exists(tmp_path or "") check lower down in this function.

It is giving comfy a bad code smell; it makes him worried that if this part of the code has questionable things like this, then what if there are other parts of the code he has not looked at or has not as deep an understanding of that have the same issues.

Copy link
Contributor

@bigcat88 bigcat88 Oct 24, 2025

Choose a reason for hiding this comment

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

I can remove that, but then there should be check for None value.
This string guarantees that the fname will be string type.

second part os.path.exists(tmp_path or "") - is a typo



def _hash_file_obj_sync(file_obj: IO[bytes], chunk_size: int) -> str:
"""Hash an already-open binary file object by streaming in chunks.
Copy link
Collaborator Author

@Kosinkadink Kosinkadink Oct 24, 2025

Choose a reason for hiding this comment

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

Comfy is very confused why this file was written like this, given this PR does not actually add any hashing capabilities. For now we can just have a simple 'please hash this file' function. Hashing is not actually enabled in this PR, but we should clean it up. I know it's probably just remnants of the initial implementation you did with background hashing processes that enabled mid-hashing resume, but it's not we probably should not worry about future needs and focus on just the basics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Core team dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants