* feat: Improve prompt handling and UI layout and other fixes
* feat: Implement image zoom/pan and improve modal display
* feat: Enhance UI persistence and randomized input display
- Display randomized numbers in input fields instead of disabling them.
- Persist generated preview images across page navigations.
- Ensure randomized form data is saved and loaded from local storage.
- Update .gitignore to include Gemini documentation.
- Add package-lock.json for dependency consistency.
* fix: Improve gallery folder navigation and "Folder up" functionality
- Add "Folder up" button to gallery for easier navigation.
- Implement path normalization to correctly handle mixed path separators (forward and backward slashes).
- Fix issue where "Folder up" button would incorrectly navigate to root from nested folders.
* feat: Enhance batch image display and modal styling\n\n- Backend: Modify CozyGenOutput to send individual WebSocket messages for each image in a batch, enabling proper display of all generated images.\n- Frontend: Implement a responsive grid layout for batch image previews on the generate page ("mini gallery").\n- Frontend: Reduce padding of the image preview modal for a more compact look.\n- Frontend: Adjust gap-y styling in DynamicForm.jsx.\n- Workflow: Update TestingTemplate.json with new dynamic input configurations.
* feat: Add CozyGen_example.json workflow
* fixing dev
* feat: Remove bypass functionality and improve dynamic input handling
* docs: Update TechDoc.md with recent error resolutions
* feat: Implement frontend bypass control for CozyGenDynamicInput
This commit introduces the functionality to bypass nodes in the ComfyUI workflow
via the frontend UI. When the "bypass" toggle is enabled for a CozyGenDynamicInput,
the connected node (e.g., LoraLoader) is removed from the workflow, and its
upstream and downstream connections are rewired.
- Added logic in `js/src/pages/MainPage.jsx` to process bypassed dynamic inputs.
- Implemented specific rewiring for `LoraLoader` nodes (model and clip outputs).
- Included generic rewiring for other nodes (limited to single input/output scenarios).
- Updated frontend build artifacts.
* feat: Revert image preview to single image display
* Update README
* feat: Implement CozyGen Image Input node and related frontend/backend changes
* catchup
* feat: Implement image upload and refactor CozyGenImageInput
* feat: Implement image upload and refactor CozyGenImageInput
- Refactored CozyGenImageInput node to accept Base64 image data.
- Implemented frontend logic in MainPage.jsx for image upload and injecting Base64 into workflow.
- Updated ImageInput.jsx to handle Base64 images for CozyGenImageInput nodes.
- Resolved merge conflicts in .gitignore.
* feat: Improve frontend control grouping and image upload visibility
This commit addresses several issues on the CozyGen generate page:
- Resolves `NameError: name 'io' is not defined` in `nodes.py` by explicitly importing `BytesIO` within the `load_image` function. This ensures proper module access within ComfyUI's execution context.
- Refactors `js/src/pages/MainPage.jsx` to correctly group dynamic input controls. Instead of rendering a separate "controls" box for each input, all `CozyGenDynamicInput` nodes are now passed to a single `DynamicForm` component, resulting in a unified and organized control panel.
- Implements conditional rendering for the "Upload Image for Workflow" section in `js/src/pages/MainPage.jsx`. This section now only appears when the loaded workflow contains a `CozyGenImageInput` node, improving UI clarity and relevance.
* feat: Implement multi-image input and optimize image handling
This commit introduces robust support for multiple image inputs and optimizes image handling to prevent browser storage issues:
- Refactors `js/src/components/ImageInput.jsx` to directly handle image uploads to the backend. When an image is selected, it is now immediately uploaded, and only its filename (instead of the large Base64 string) is stored in the frontend's `formData`. This resolves the "Quota Exceeded" DOMException previously encountered.
- Updates `js/src/pages/MainPage.jsx` by removing the single `uploadedImageBase64` state and its associated logic. The `handleGenerate` function is modified to correctly retrieve and inject image filenames from `formData` into the workflow JSON for all `CozyGenImageInput` nodes.
- Adds a `param_name` widget to the `CozyGenImageInput` node in `nodes.py`, allowing for customizable titles for image input fields in the frontend. The `load_image` function in `nodes.py` has been updated to accept this new parameter.
- Includes a new workflow file.
- Updates frontend build artifacts.
* feat: Implement smart image resize and improve gallery UI
This commit introduces a smart image resize feature and enhances the gallery modal UI:
- Implements an automatic smart resize feature in `js/src/components/ImageInput.jsx`. When an image is uploaded, it is now automatically resized to fit within a 2048-pixel sum for its dimensions (width + height), while preserving its aspect ratio. This is controlled by a 'Smart Resize' toggle.
- Simplifies the gallery image modal in `js/src/pages/Gallery.jsx` by replacing the full workflow JSON display with a 'Copy Workflow to Clipboard' button. This provides a cleaner user experience while still allowing users to access the workflow data.
- Updates `js/src/pages/MainPage.jsx` and `nodes.py` to support the new image handling and resize logic, ensuring that `param_name` and `image_filename` are correctly passed to the backend.
- Updates frontend build artifacts.
* Fix: Image preview and redundant input box on generate page\n\n- Corrected image preview URL construction in ImageInput.jsx.\n- Removed redundant 'Image Input' title block from MainPage.jsx.\n- Updated TechDoc.md to reflect these changes.
* Feat: Compact Image Input control box\n\n- Redesigned the ImageInput component for a more compact layout.\n- Browse and resize options are now on the left, with a smaller inline thumbnail on the right.\n- Updated TechDoc.md to reflect this UI/UX improvement.
* Full commit for gallery and img2img changes
* Standardized image modal view
* Fixed modal width issue
* Actually fixed modal, for real this time.hopefully.
* Added pagination to gallery. Added image modal navigation.
* Cleanup for main
44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
import os
|
|
import sys
|
|
import server
|
|
from aiohttp import web # Import web for static files
|
|
from .api import routes as api_routes
|
|
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
|
|
|
|
# Mount API routes
|
|
for route in api_routes:
|
|
server.PromptServer.instance.app.router.add_route(
|
|
route.method,
|
|
route.path,
|
|
route.handler,
|
|
name=f"cozygen_{route.handler.__name__}"
|
|
)
|
|
|
|
# Handler to serve the React app's index.html
|
|
async def serve_cozygen_app(request: web.Request) -> web.Response:
|
|
index_path = os.path.join(os.path.dirname(__file__), "js", "dist", "index.html")
|
|
if not os.path.exists(index_path):
|
|
return web.Response(text="CozyGen: Build not found. Please run `npm run build` in the `js` directory.", status=500)
|
|
return web.FileResponse(index_path)
|
|
|
|
# Route to serve the main application
|
|
server.PromptServer.instance.app.router.add_get('/cozygen', serve_cozygen_app)
|
|
server.PromptServer.instance.app.router.add_get('/cozygen/', serve_cozygen_app)
|
|
|
|
|
|
# Serve the new 'dist' directory which contains the built React app
|
|
static_dist_path = os.path.join(os.path.dirname(__file__), "js", "dist")
|
|
server.PromptServer.instance.app.router.add_static(
|
|
"/cozygen/assets", path=os.path.join(static_dist_path, "assets"), name="cozygen_assets"
|
|
)
|
|
|
|
|
|
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
|
|
|
print("✅ CozyGen API routes mounted.")
|
|
print("✅ CozyGen web UI served at /cozygen/")
|
|
|
|
WEB_DIRECTORY = "./js/web"
|