Kilvoctu / aiyabot

A neat Discord bot for AUTOMATIC1111's Web UI
GNU General Public License v2.0
309 stars 76 forks source link

fix: Sanitize and deduplicate extra_net usage #262

Closed FoxxMD closed 5 months ago

FoxxMD commented 5 months ago

net_multi regex fix

The previous regex for finding net_multi value from given extra_net -- re.search(f'{pen[18]}:(.*)>', pen[2]):

extra_net settings

extra_net_check and extra_net_defaults were both missing if statements to check that the net did not already exist in the prompt before adding.

extra_net deduplication

If a user added nets manually to the "new prompt" on the edit flow IE a cute cat <lora:myLora> then the callback would add this alongside the calculated extra_nets from the original prompt. A dedup function now removes duplicate occurrences (n > 1) for unique net names in the new prompt IE

a very cute cat, zavy-ctsmtrc <lora:zavy-ctsmtrc-sdxl:0.7> <lora:zavy-ctsmtrc-sdxl:1> <lora:sdxl_lightning_8step_lora:1>

becomes

a very cute cat, zavy-ctsmtrc <lora:zavy-ctsmtrc-sdxl:0.7> <lora:sdxl_lightning_8step_lora:1>