Skip to content

Add FlyPatch extension to extension list - #1606

Open
Berni-k wants to merge 1 commit into
mcmonkeyprojects:masterfrom
Berni-k:patch-1
Open

Berni-k wants to merge 1 commit into
mcmonkeyprojects:masterfrom
Berni-k:patch-1

Conversation

@Berni-k

@Berni-k Berni-k commented Nov 29, 2026

Copy link
Copy Markdown

My new, rather large extension has reached a mature enough state that I'm confident submitting it to the official extension list.
https://github.com/Berni-k/SwarmUI-FlyPatch

It lets users patch any part of the Generate tab workflow, adding extra nodes or modifying existing ones. I made it for my own needs: tweaking and trying things without writing a whole extension for each one and restarting Swarm every time. But I think others can benefit from it too, eg to quickly try a hot new custom node without waiting for someone else to make yet another extension for it.

The custom scripting language is intentionally limited to workflow operations rather than using a real scripting language. It can offer ways to download missing nodes or models, but never does so without the user's permission/assistance.

A lot of it was written with Claude Opus but with manual code review done on top. The javascript side is less reviewed as i am not much of a web developer.

It has been tested by a number of users so far in the extensions discord thread.

The extension does a few hacky things with Swarm that I couldn't find a cleaner way around so far:

  • Parameter controls are cloned into the Generate tab group as they get dynamically defined in the patch script.
  • 'To ComfyUI' (loading the workflow into the Comfy tab, with or without the patch): FlyPatch briefly swaps its own group's toggle while it calls comfyImportWorkflow, then puts them back.
  • The image metadata display breaks the layout for very long parameter values (my script parameter carries the whole script for reproducibility), so a small CSS tweak limits that value's area and gives it a scroll bar. It finds the value by the start of the parameter's description, since entries have nothing else to select them by.
  • The script being edited isn't stored in browser cookies like Swarm's parameters, since that risks the 4KB cookie limit. It's kept in the browser's local storage instead.
  • Building the workflow for the editor's preview can make Swarm start downloading missing model components (VAE, text encoders, etc.) the user doesn't have yet. (if called quickly enough it could likely also trigger a bug that breaks the download part way)

I realize some of these should really be fixed with core PRs, but they touch fairly vital machinery in Swarm, so it is likely best to leave it to someone more experienced with the codebase

flypatch screenshot

@mcmonkey4eva

Copy link
Copy Markdown
Member

Why does this having its own scripting language?

As opposed to any of:
(a) dynamically loading extensions
(b) using the JSON-based tooling for arbitrary nodes currently used partially for controlnet stuff iirc
(c) comfy workflow definitions with SwarmInput nodes
?

@Berni-k

Berni-k commented Nov 29, 2026 •

Copy link
Copy Markdown
Author

Some of the motivations for the weird made up language is in the readme https://github.com/Berni-k/SwarmUI-FlyPatch#why-a-script-language

a) Was not aware swarm can dynamically load extensions. I thought new extensions can only load at Swarm startup (and this made fine tweaking extensions annoying to me, having to constantly restart). But would it even be acceptable to accept C# code text trough a UI and build it at runtime? (it sounds risky to me). Or is there some way to rebuild extensions from disk while running that i missed?

b) The WorkflowGenerator.CreateNodesFromSpecialSyntax seamed mostly like a shortcut to calling a bunch of other features in WorkflowGenerator. I suppose it could be used as the "language" but i still needed to tack on features for modifying existing nodes, or dynamicaly giving nice slider parameter to the UI, so at that point it feels like hackery too.

c) Custom workflows with SwarmInput nodes is exactly what i been using for the past 2 years (and still use for the Simple Tab, works great!). But it takes time to wire up SwarmInput nodes. More importantly it "hard forks" the workflow from being able to use the proper full Generate tab. Not having to hand craft ComfyUI workflows is the reason i use SwarmUI. So with FlyPatch it me lets me access a reusable workflow modification using 1 dropdown menu click on any Generation tab workflow. Especially for Comfy nodes/models not yet supported by Swarm.

But in general the motivation is to let the average Joe make their own workflow tweaks with 0 coding experience by just hand modifying the Comfy tab workflow and saving the difference as a patch script (takes <1 minute to adapt an example workflow to Swarm with it). In that case the scripting language is merely a save format in a more human readable form.

I am open to suggestions for switching to a better language/UI that fits into Swarm better.

@mcmonkey4eva

Copy link
Copy Markdown
Member

I meant just. Making the node tweaks via the SwarmInput node setup and then saving it as a workflow, as opposed to a whole new system for how to define and track them

@Berni-k

Berni-k commented Nov 29, 2026 •

Copy link
Copy Markdown
Author

Which one of these things do you mean by that?
a) Selecting my chosen combination of patches. Then a click of a button builds the workflow containing SwarmInput nodes and then switches SwarmUIs Generate tab into custom workflow mode where you can then adjust the parameters?
b) SwarmInput nodes can be used to add new parameters into new groups on the regular Generate tab mode (I could not find how to do that so far)

Or do you mean just not having an extension at all for this and using the existing Custom workflow functionality?
Since that's what i been using, but my problem is that locks away the amazing Generate tab functionality and degrades it to being a glorified ComfyUI node setting editor. This extension makes it possible to apply a patch (ie upsampler) to any model using 1 click, versus having to rebuild a custom workflow by hand every time you switch models.

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.

2 participants