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
289 stars 44 forks source link

[Bug]: NSFW Filtering broken #249

Closed BlafKing closed 4 months ago

BlafKing commented 4 months ago

Currently the CivitAI API has some issues with receiving and returning NSFW information about models, these issues cannot be fixed by me, since the API causes these problems.

The issues are:

Unfortunately nothing I can do about these issues, so this bug report can act like a little bug tracker and notification so that people know the cause!

Worldgate commented 4 months ago

Same issue with me except if i turn off the 'nsfw' check box it has an error and just gives.

CivitAI Browser+: Error: 500 Server Error: Internal Server Error for url: https://civitai.com/api/v1/models?limit=10&sort=Newest&period=AllTime&nsfw=false Traceback (most recent call last): File "e:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "e:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "e:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "e:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "e:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "e:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "e:\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, **kwargs) File "E:\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_file_manage.py", line 516, in save_model_info image_path = get_image_path(install_path, api_response, sub_folder) File "E:\stable-diffusion-webui\extensions\sd-civitai-browser-plus\scripts\civitai_file_manage.py", line 211, in get_image_path json_info = api_response['items'][0] TypeError: string indices must be integers

Worldgate commented 4 months ago

I did get a message about them changing some of the 'ratings' to be more like the MPAA. I got no idea why they would bother this late in the game, flagging something 'nsfw' seems to work pretty easily.

DarthRainbows commented 4 months ago

I think Civitai may have also changed the default behavior of the nsfw query param from true to false. The plugin only sets the query param to false, so this is likely why nsfw results are not returned when the setting is on. I'd make a PR to fix that, but it sounds like there is more to this for the new ratings.

BlafKing commented 4 months ago

Thanks for letting me know @DarthRainbows, it looks the API has had an update regarding the nsfw parameters.

Before it used to always return NSFW models regardless of including this parameter, but now it indeed doesn't return NSFW models unless the nsfw parameter has been set to true.

I'll make a new update that uses this new behavior to properly handle NSFW filtering again!

BlafKing commented 4 months ago

NSFW should now be working again in the latest commit. Thanks for letting me know about the new API behaviour!

I'll mark this as resolved 👍🏻