SwarmUI
SwarmUI copied to clipboard
Save Models in baseModel subfolder
Add the functionality of reading baseModel from civitai metadata, and save models in their base model subfolders. This will look like: Models/Stable-diffusion/ SDXL 1.0/ SD1.5/ Pony/ Flux.1 D/ Flux.1 F/ etc...
This is exactly the same changes as shared in Discord. I welcome any feedback and I'm happy to make any changes necessary. This is just my own little patch that I apply after any updates because I like my models to stay organized in basemodel subfolders since it helps identify them at a glance in the UI.
With your current implementation, you are effectively forcing everyone to use your own preferred organization method, requiring those who want to sort files in a different way to manually move the files on the server after the download completes (which may or may not be easy if they're not running SwarmUI as a listen server).
If you instead just change the JS / html, so that the model-download form's filename input box uses the base model as a prefix by default (ie, ${BaseModel}/${FileName} instead of just ${FileName}), you will get your desired behaviour, but anyone who wants to organize their files in a different way will be able to easily just by editing the text box.
If you don't end up making this a client-side only change, I don't see anything validating / sanitizing the new baseModel input. Be sure to run it through Utilities.StrictFilenameClean() to ensure that there is no possibility for bad actors to inject malicious paths in the baseModel attribute.
@maedtb actually really good points. I pushed another commit that makes this a user setting default to off. That way it doesn't break existing behavior, and allows users to opt-in to using this option. Would that, plus using Utilities.StrictFilenameClean() be a sufficient approach? I am hesitant to add some behavior to the UI that users might want to disable by default, therefore just annoying them.
please use regular commits btw, don't force push
Ah, sorry. I'm used to how my workplace does things. We only ever have a max of 3 commits per PR, so everything ends up with a git commit --amend and a git push --force-with-lease to keep the commits that show in the main repo clean. I will refrain from doing so in the future
Oughtta tell them that github has a button to squash the PR after
So you can make PRs readable and diffs decipherable, and also keep the main repo commit history clean
We've talked about doing that. We have to be SOC2 and ISO
Closing this PR as unmaintained, but also the model downloader should probably have general syntax for path building rather than a dedicated baseModel input, other requests for options to autocontrol paths have been requested