diff --git a/dbgpt/core/awel/trigger/http_trigger.py b/dbgpt/core/awel/trigger/http_trigger.py index 3e5161d7a..b6c2f39b0 100644 --- a/dbgpt/core/awel/trigger/http_trigger.py +++ b/dbgpt/core/awel/trigger/http_trigger.py @@ -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"