zixaphir / Stable-Diffusion-Webui-Civitai-Helper

Stable Diffusion Webui Extension for Civitai, to manage your model much more easily.
175 stars 24 forks source link

Add ability to auto organize loras #107

Closed mrnamwen closed 1 week ago

mrnamwen commented 1 month ago

This PR adds the experimental ability to automatically move loras into their respective category subfolders, intended to help users with large lora folders organize their collection.

image

Selecting the "move models" checkbox will cause Civitai Helper to make an additional API call to retrieve the Model's base metadata, including its tags (as these are not included when looking up by hash). If it finds a tag that matches the base "categories" on the model browser (character, style, clothing, poses, etc.), it will move the model into the relevant subfolder. Models already in a matching subfolder or models that have no matching tags will be ignored. In addition, this occurs before model info processing, so thumbnails, example images, and info files will write into the new folder. This has successfully been tested on Lora folders up to 1500 entries, with only 3 not moved due to insufficient metadata.

Please note that right now, this cannot retroactively move models that have existing metadata as it is built into the model scanner, which only runs on models that are missing metadata files. This is primarily a functional proof of concept that I initially built for myself, and I welcome reviews or suggestions on improving this functionality.

zixaphir commented 1 month ago

I haven't looked at the code yet, but from your screenshot, please either move the "Replace Old Metadata Formats" down or move the explainer for it up so that they're vertically adjacent. I'll try to look at this more later today.

mrnamwen commented 1 month ago

Thanks, I'll get a hotfix pushed for that in the morning.

mrnamwen commented 1 month ago

Thanks, I've resolved the changes you raised in the newest commit. Another review would be appreciated once you get a moment.

zixaphir commented 3 weeks ago

Just checking in. If something has come up, I can go ahead and make the last change and merge.

mrnamwen commented 3 weeks ago

Would be great if you don't mind. Work had picked up so haven't been using my SD setup and hadn't been able to return to this.