Skip to content

Commit

Permalink
fix(core): Fix HTTP Trigger parse parameter bug (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyinc authored Mar 1, 2024
1 parent 58b095d commit 0e61c55
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions dbgpt/core/awel/trigger/http_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,15 +541,19 @@ async def route_function_get(**kwargs):
req_body_cls, BaseModel
):
fields = req_body_cls.__fields__ # type: ignore
parameters = [
Parameter(
name=field_name,
kind=Parameter.KEYWORD_ONLY,
default=Parameter.empty,
annotation=field.outer_type_,
parameters = []
for field_name, field in fields.items():
default_value = (
Parameter.empty if field.required else field.default
)
parameters.append(
Parameter(
name=field_name,
kind=Parameter.KEYWORD_ONLY,
default=default_value,
annotation=field.outer_type_,
)
)
for field_name, field in fields.items()
]
elif req_body_cls == Dict[str, Any] or req_body_cls == dict:
raise AWELHttpError(
f"Query methods {self._methods} not support dict type"
Expand Down

0 comments on commit 0e61c55

Please sign in to comment.