BlafKing / sd-civitai-browser-plus

Extension to access CivitAI via WebUI: download, delete, scan for updates, list installed models, assign tags, and boost downloads with multi-threading.
GNU Affero General Public License v3.0
309 stars 53 forks source link

[Bug]: Sometimes, the civitai button on txt2img and img2img browser does work #174

Closed sam42contact closed 8 months ago

sam42contact commented 8 months ago

Describe the bug.

The model_from_sent() function fails to get the model_file, then the modelID for some models. Check the patch (it should be self explanatory). civitai_file_manage.py.patch.zip

Steps to reproduce the problem.

.

Expected behavior

.

System info

.

Console logs

.

Additional information

No response

BlafKing commented 8 months ago

Thanks for reporting!

I've implemented a similar method where I check if the file ends with any of the valid extensions.

extensions = ['.pt', '.ckpt', '.pth', '.safetensors', '.th', '.zip', '.vae']

for content_type_item in content_type:
    folder = _api.contenttype_folder(content_type_item)
    for folder_path, _, files in os.walk(folder):
        for file in files:
            if file.startswith(model_name) and file.endswith(tuple(extensions)):
                model_file = os.path.join(folder_path, file)

In the future feel free to make a pull request with any suggested code changes instead of posting a .zip in a bug report :)

I'll go ahead and close this issue since it should be fixed.