Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
16.88k stars 1.94k forks source link

[Bug]: API Examples and Documentation are broken due to pull #2847 #2920

Closed DrCyanide closed 4 months ago

DrCyanide commented 4 months ago

Is there an existing issue for this?

What happened?

Pull request #2847 broke backwards compatibility with "control_mode": 0,, which is used in the examples.

It also broke the documentation at https://github.com/Mikubill/sd-webui-controlnet/wiki/API#controlnetunitrequest-json-object for what values are expected.

Steps to reproduce the problem

Try to run the example api code that's provided in this repo.

What should have happened?

The code should work, not return an error.

Commit where the problem happens

webui: 1c0a0c4 controlnet: 59c4349

What browsers do you use to access the UI ?

No response

Command Line Arguments

--api --listen --enable-insecure-extension-access

List of enabled extensions

image

Console logs

Running api_txt2img.py as is returns this:

Traceback (most recent call last):
  File "D:\Documents\AI\ImgGen\a1111_1.9.3\stable-diffusion-webui\extensions\sd-webui-controlnet\example\txt2img_example\api_txt2img.py", line 74, in <module>
    result = output['images'][0]
KeyError: 'images'

Modifying it to print(output) instead returns this:

{'error': 'ValidationError', 'detail': '', 'body': '', 'errors': "2 validation errors for ControlNetUnit\nresize_mode\n   (type=assertion_error)\ncontrol_mode\n  value is not a valid enumeration member; permitted: 'Balanced', 'My prompt is more important', 'ControlNet is more important' (type=type_error.enum; enum_values=[<ControlMode.BALANCED: 'Balanced'>, <ControlMode.PROMPT: 'My prompt is more important'>, <ControlMode.CONTROL: 'ControlNet is more important'>])"}


### Additional information

_No response_