Enhanced Model Detection, UNet Workflow Support (z-image workflows) and VSCode mcp config - #17
Open
eduardojaime wants to merge 1 commit into
Open
Enhanced Model Detection, UNet Workflow Support (z-image workflows) and VSCode mcp config#17eduardojaime wants to merge 1 commit into
eduardojaime wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for modern UNet-based and GGUF-format diffusion models (Flux, SD3, z_image, etc.) by:
generate_image_unet.jsonfor GGUF models requiring specialized loaderslist_modelstool - Returns categorized model list with counts and clear organizationMotivation
ComfyUI supports multiple model architectures that use different loader nodes:
Previously, the server only detected checkpoint models, making it impossible to use newer architectures. This PR enables full support for all model types including GGUF-format models.
Changes
1. Enhanced Model Detection (
comfyui_client.py)Added
_get_available_models_categorized()method that:/object_info/CheckpointLoaderSimple,/object_info/UNETLoader,/object_info/DiffusionModelLoader)checkpoints,unet,diffusion_modelsavailable_modelsstill defaults to checkpoint listKey Code:
2. Updated
list_modelsTool (tools/configuration.py)Modified to return categorized structure:
Before:
{ "models": ["model1.ckpt", "model2.safetensors"], "count": 2, "default": "model1.ckpt" }After:
{ "models": { "checkpoints": ["model1.ckpt"], "unet": ["flux_dev.safetensors", "z_image_turbo_bf16.safetensors"], "diffusion_models": [] }, "counts": { "checkpoints": 1, "unet": 2, "diffusion_models": 0, "total": 3 }, "default_checkpoint": "model1.ckpt" }3. New Workflow:
generate_image_unet.jsonAdds support for GGUF-format models with specialized component loading:
Key Nodes:
Parameters:
PARAM_MODEL: GGUF model name (e.g.,z_image_turbo-Q8_0.gguf)PARAM_VAE: VAE model (e.g.,ae_zimage.safetensors)PARAM_PROMPT,PARAM_NEGATIVE_PROMPT,PARAM_INT_WIDTH, etc.cfg=1.0,steps=8(optimized for z_image turbo models)Usage Example:
4. Comprehensive Tests (
tests/test_model_categorization.py)Adds test coverage for:
list_modelstool returns correct structure with countsTest Classes:
TestModelCategorization: Tests ComfyUI client behaviorTestListModelsTool: Tests MCP tool response format5. Documentation Updates
docs/REFERENCE.md:list_modelsdocumentation with new return structureREADME.md:Backward Compatibility
✅ Fully backward compatible
comfyui_client.available_modelsstill contains checkpoint models (maintains existing behavior)list_modelswill receive categorized structure with additional informationTesting
Manual Testing
Integration Testing
python server.pylist_modelstool - should show all three categoriesgenerate_image_unetwith a UNet modelModel Compatibility
Supported in
generate_image.json(CheckpointLoaderSimple)Supported in
generate_image_unet.json(LoaderGGUF)Note: Models in safetensors format (Flux, SD3, Wanxiang) using UNETLoader require a different workflow structure not included in this PR.
Files Changed
Future Enhancements
Potential follow-ups (not in this PR):
Checklist
Questions for Reviewers