From 6b877c35da12029106062bfa8dfefb6a565f13ff Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Wed, 26 Jul 2023 11:52:42 +0300 Subject: [PATCH] Merge pull request #12032 from AUTOMATIC1111/fix-api-get-options-sd_model_checkpoint api /sdapi/v1/options use "Any" type when default type is None --- modules/api/models.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/api/models.py b/modules/api/models.py index bf97b1a37..800c9b93f 100644 --- a/modules/api/models.py +++ b/modules/api/models.py @@ -208,11 +208,9 @@ class PreprocessResponse(BaseModel): fields = {} for key, metadata in opts.data_labels.items(): value = opts.data.get(key) - optType = opts.typemap.get(type(metadata.default), type(metadata.default)) + optType = opts.typemap.get(type(metadata.default), type(metadata.default)) if metadata.default else Any - if metadata.default is None: - pass - elif metadata is not None: + if metadata is not None: fields.update({key: (Optional[optType], Field(default=metadata.default, description=metadata.label))}) else: fields.update({key: (Optional[optType], Field())})