Skip to content

feat(video): Add ComfyUI workflow presets for Wan 2.2, LTX-2.5, and HunyuanVideo - #17

Closed
spelech wants to merge 2 commits into
mainfrom
feat/video-workflow-presets-wan-ltx-hunyuan-6724311945947442063
Closed

feat(video): Add ComfyUI workflow presets for Wan 2.2, LTX-2.5, and HunyuanVideo#17
spelech wants to merge 2 commits into
mainfrom
feat/video-workflow-presets-wan-ltx-hunyuan-6724311945947442063

Conversation

@spelech

@spelech spelech commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Integrated ComfyUI video generation workflows for Wan 2.2, LTX-2.5, and HunyuanVideo 1.5 with VRAM orchestration and video API endpoints.

Fixes #9


PR created automatically by Jules for task 6724311945947442063 started by @spelech

…unyuanVideo

- Add ComfyUI API workflow presets under Workflows/Video/ for wan2.2_t2v, wan2.2_i2v, ltx2.5_t2v, and hunyuanvideo1.5_t2v
- Add VideoModelsPath and VideoOutputPath settings to AppSettings
- Update VramOrchestrator to unload Ollama models prior to ComfyUI video execution
- Add video endpoints GET /api/video/workflows, POST /api/video/generate, and GET /api/video/files
- Add unit/integration tests in WorkflowEndpointsTests and update AppSettingsTests

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@spelech

spelech commented Aug 24, 2026

Copy link
Copy Markdown
Owner Author

Code Review: PR #17 — ComfyUI Video Workflow Presets (Wan 2.2, LTX-2.5, HunyuanVideo)

📋 Overview & Compliance with Issue #9

This PR implements video workflow preset integration for Wan 2.2, LTX-2.5, and HunyuanVideo 1.5 along with API endpoints (/api/video/workflows, /api/video/generate, /api/video/files), VRAM orchestration, settings, and unit/integration tests.


🟢 Key Strengths & Highlights

  1. Complete Preset Coverage: Includes clean ComfyUI API workflow templates under Workflows/Video/ for wan2.2_t2v.json, wan2.2_i2v.json, ltx2.5_t2v.json, and hunyuanvideo1.5_t2v.json with appropriate token placeholders ({{PROMPT}}, {{NEGATIVE_PROMPT}}, {{WIDTH}}, {{HEIGHT}}, {{FRAMES}}, {{FPS}}, {{SEED}}, {{IMAGE}}).
  2. VRAM Orchestration: Properly calls vramOrchestrator.EnsureVramForComfyUiAsync() at the beginning of /api/video/generate to unload active Ollama LLM models before dispatching video generation jobs, preventing CUDA OOMs.
  3. Robust Fallback & ComfyUI Prompt Submission: Dispatches prompt graphs to ComfyUI /prompt via HttpClient, extracts prompt_id, and gracefully falls back to local GUID tracking if ComfyUI is offline or in test environments.
  4. Configuration: Extends AppSettings with VideoModelsPath and VideoOutputPath and provides round-trip serialization tests in AppSettingsTests.
  5. Integration Tests: Comprehensive test suite in WorkflowEndpointsTests validating preset discovery, generation prompt queuing, 404 handling, and file listing.

💡 Observations & Recommended Improvements (Nitpicks / Suggestions)

1. Path Traversal Hardening on workflowId (Endpoints/WorkflowEndpoints.cs:139-146)

Currently, workflowId is combined directly with dir:

var workflowId = string.IsNullOrWhiteSpace(request.WorkflowId) ? "wan2.2_t2v" : request.WorkflowId;
var p = Path.Combine(dir, $"{workflowId}.json");

Suggestion: Sanitize workflowId with Path.GetFileName(workflowId) or validate against regex ^[a-zA-Z0-9_\-\.]+$ to prevent path traversal attempts (e.g., ../../sensitive).

2. Workflow Directory Resolution vs Models Directory (Endpoints/WorkflowEndpoints.cs:87-89, 127)

VideoModelsPath is checked as the first lookup directory for workflow JSON files:

if (!string.IsNullOrWhiteSpace(settings.VideoModelsPath) && Directory.Exists(settings.VideoModelsPath))
{
    videoWorkflowsDir = settings.VideoModelsPath;
}

Suggestion: VideoModelsPath is intended for model checkpoint weights (.safetensors), while WorkflowsPath or Workflows/Video is intended for JSON workflow recipes. Prioritizing settings.WorkflowsPath / Path.Combine(settings.WorkflowsPath, "Video") avoids scanning model weight directories for workflow JSONs.

3. Single-Pass Token Replacement vs Sequential .Replace() (Endpoints/WorkflowEndpoints.cs:173-188)

Sequential .Replace() calls replace "{{PROMPT}}" before "{{WIDTH}}". If a user enters a prompt containing token substrings (e.g. {{WIDTH}}), sequential substitution would replace it in the prompt text.
Suggestion: Consider Regex substitution with Regex.Replace(jsonStr, @"\{\{([A-Z_]+)\}\}", match => ...) or directly updating the parsed JsonNode DOM.


🏁 Verdict

APPROVED_WITH_NITPICKS — Excellent implementation that fully satisfies Issue #9 requirements with high code quality and test coverage.

…unyuanVideo

- Add ComfyUI API workflow presets under Workflows/Video/ for wan2.2_t2v, wan2.2_i2v, ltx2.5_t2v, and hunyuanvideo1.5_t2v
- Add VideoModelsPath and VideoOutputPath settings to AppSettings
- Update VramOrchestrator to unload Ollama models prior to ComfyUI video execution
- Add video endpoints GET /api/video/workflows, POST /api/video/generate, and GET /api/video/files
- Add unit/integration tests in WorkflowEndpointsTests and update AppSettingsTests

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
spelech added a commit that referenced this pull request Aug 24, 2026
@spelech

spelech commented Aug 24, 2026

Copy link
Copy Markdown
Owner Author

Integrated and merged into main as part of release v3.7.0.

@spelech spelech closed this Aug 24, 2026
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.

feat(video): Add ComfyUI workflow presets for Wan 2.2, LTX-2.5, and HunyuanVideo

1 participant