idrirap / ComfyUI-Lora-Auto-Trigger-Words

102 stars 7 forks source link

don't delete loras_tags.json on JSONDecodeError #11

Closed deipfei closed 4 months ago

deipfei commented 4 months ago

I found that some models don't have accurate tags (especially older ones when it seemed like there were fewer rules on CivitAI). I edited the loras_tags.json file manually, but accidentally left a trailing comma. Returning None on the JSONDecodeError led to the entire file being overwritten (and the old, incorrect tags being saved, to boot!). Thankfully, I had the JSON file open and was able to recover from disk :)

It feels more user friendly to me to just raise the error, let the workflow fail, and give the user a chance to fix it (or delete it themselves, I suppose).

idrirap commented 4 months ago

Thanks for the fix. I think I should implement an easier way of saving custom tags too.