Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/frontend_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ def templates_path(cls) -> str:
""".strip()
)

@classmethod
def embedded_docs_path(cls) -> str:
"""Get the path to embedded documentation"""
try:
import comfyui_embedded_docs

return str(
importlib.resources.files(comfyui_embedded_docs) / "docs"
)
except ImportError:
logging.info("comfyui-embedded-docs package not found")
return None
Comment on lines +217 to +219
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have a catch-all that logs and returns? An unhandled exception type here would terminate app start.

Copy link
Member

@Kosinkadink Kosinkadink Jun 1, 2025

Choose a reason for hiding this comment

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

This should be fine - it matches the other import checks in frontend_management; our code checks the return value of this func so it shouldn't be an issue. Assuming the frontend PR handles docs static path not existing, of course:
image

Copy link
Member

Choose a reason for hiding this comment

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

And yep, we can definitely merge it head of time.


@classmethod
def parse_version_string(cls, value: str) -> tuple[str, str, str]:
"""
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
comfyui-frontend-package==1.20.7
comfyui-workflow-templates==0.1.23
comfyui-embedded-docs==0.2.0
torch
torchsde
torchvision
Expand Down
7 changes: 7 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,13 @@ def add_routes(self):
web.static('/templates', workflow_templates_path)
])

# Serve embedded documentation from the package
embedded_docs_path = FrontendManager.embedded_docs_path()
if embedded_docs_path:
self.app.add_routes([
web.static('/docs', embedded_docs_path)
])

self.app.add_routes([
web.static('/', self.web_root),
])
Expand Down