fix: json serialization issue

This commit is contained in:
Bingsu
2023-07-05 22:36:26 +09:00
parent 96b3142704
commit 44da346513
4 changed files with 7 additions and 5 deletions

View File

@@ -1 +1 @@
__version__ = "23.7.2"
__version__ = "23.7.3.dev0"

View File

@@ -76,8 +76,9 @@ class ADetailerArgs(BaseModel, extra=Extra.forbid):
return values
@validator("is_api", pre=True)
def is_api_validator(cls, v): # noqa: N805
return type(v) is not object
def is_api_validator(cls, v: Any): # noqa: N805
"tuple is json serializable but cannot be made with json deserialize."
return type(v) is not tuple
@staticmethod
def ppop(

View File

@@ -74,13 +74,14 @@ def ad_args(*args: Any) -> dict[str, Any]:
return {}
arg0 = ad_args[0]
is_api = arg0.get("is_api", True)
return {
"version": __version__,
"ad_model": arg0["ad_model"],
"ad_prompt": arg0.get("ad_prompt", ""),
"ad_negative_prompt": arg0.get("ad_negative_prompt", ""),
"ad_controlnet_model": arg0.get("ad_controlnet_model", "None"),
"is_api": "is_api" not in arg0 or type(arg0["is_api"]) is not object,
"is_api": type(is_api) is not tuple,
}

View File

@@ -43,7 +43,7 @@ def on_widget_change(state: dict, value: Any, *, attr: str):
def on_generate_click(state: dict, *values: Any):
for attr, value in zip(ALL_ARGS.attrs, values):
state[attr] = value
state["is_api"] = object()
state["is_api"] = ()
return state