CurtisDS / sd-model-preview-xd

Displays preview files for models.
MIT License
74 stars 8 forks source link

Possible to filter based on multiple tags? #12

Closed candre23 closed 1 year ago

candre23 commented 1 year ago

Thank you so much for adding .tags support. I can't seem to get it to filter for multiple tags, though. I see that it will recognize a comma as a logical OR, but I haven't found how to make it do a logical AND. IE "tag1, tag2" will display any model with either tag, but I can't figure out how to get it to only display models with both tags.

If this functionality is already present, please let me know how to trigger it. If not, please consider adding it.

Thanks.

CurtisDS commented 1 year ago

The filter operation should not be able to do an OR operation. It should only be able to do an AND operation if you separate the tags with a comma.

If you have two models model1.pt and model2.pt and these were your .tags files:

mode1.tags:

#tag1 #tag2

mode2.tags:

#tag1 #tag3

If you entered "#tag2, #tag3" in the filter box no models should appear in the drop down because no models contain both tags.

If you want paste the name and contents of two of the .tags files that you are having trouble with. And the name of the models and Ill see if I can get it to work myself.

candre23 commented 1 year ago

My apologies. I had created a batch file to generate a .tags file in each model directory with all 5 tags that I'm using, and had been going through and removing the inappropriate ones manually (this was easier than typing 2-5 tags for ~300 models). It seems tags are not loaded on demand, so the extension had "remembered" that all models had all 5 tags when the UI was initially loaded. After reloading the UI, it is now working as you describe.

Perhaps the tags could also be displayed on the preview page?

CurtisDS commented 1 year ago

Ok, I've added them at the bottom of the preview. I've also changed it so that when you hit the refresh models button 🔄 either at the top next to the checkpoint list or in the extra networks panel it will now update the tags so you don't need to restart the ui to update them.