fix(workflow): ensure default values are properly retrieved in HTTP nodes

This commit is contained in:
mengyonghao
2026-01-05 11:02:17 +08:00
parent 1f6835a8e0
commit 5957eb9c1a
2 changed files with 12 additions and 21 deletions

View File

@@ -63,7 +63,7 @@ class HttpContentTypeConfig(BaseModel):
) )
data: list[HttpFormData] | dict | str = Field( data: list[HttpFormData] | dict | str = Field(
..., default="",
description="Data of the HTTP request body; type depends on content_type", description="Data of the HTTP request body; type depends on content_type",
) )
@@ -98,6 +98,10 @@ class HttpTimeOutConfig(BaseModel):
class HttpRetryConfig(BaseModel): class HttpRetryConfig(BaseModel):
enable: bool = Field(
...,
description="Enable/disable retry logic",
)
max_attempts: int = Field( max_attempts: int = Field(
default=1, default=1,
description="Maximum number of retry attempts for failed requests", description="Maximum number of retry attempts for failed requests",
@@ -124,6 +128,11 @@ class HttpErrorDefaultTamplete(BaseModel):
description="Default HTTP headers returned on error", description="Default HTTP headers returned on error",
) )
output: str = Field(
default="SUCCESS",
description="HTTP response body",
)
class HttpErrorHandleConfig(BaseModel): class HttpErrorHandleConfig(BaseModel):
method: HttpErrorHandle = Field( method: HttpErrorHandle = Field(
@@ -131,8 +140,8 @@ class HttpErrorHandleConfig(BaseModel):
description="Error handling strategy: 'none', 'default', or 'branch'", description="Error handling strategy: 'none', 'default', or 'branch'",
) )
default: HttpErrorDefaultTamplete = Field( default: HttpErrorDefaultTamplete | None = Field(
..., default=None,
description="Default response template for error handling", description="Default response template for error handling",
) )

View File

@@ -165,24 +165,6 @@ class HttpRequestNode(BaseNode):
case _: case _:
raise RuntimeError(f"HttpRequest method not supported: {self.typed_config.method}") raise RuntimeError(f"HttpRequest method not supported: {self.typed_config.method}")
def build_conditional_edge_expressions(self):
"""
Build conditional edge expressions for workflow branching.
When the HTTP error handling strategy is set to `BRANCH`,
this node exposes a single conditional output labeled "ERROR".
The workflow engine uses this output to create an explicit
error-handling branch for downstream nodes.
Returns:
list[str]:
- ["ERROR"] if error handling strategy is BRANCH
- An empty list if no conditional branching is required
"""
if self.typed_config.error_handle.method == HttpErrorHandle.BRANCH:
return ["ERROR"]
return []
async def execute(self, state: WorkflowState) -> dict | str: async def execute(self, state: WorkflowState) -> dict | str:
""" """
Execute the HTTP request node. Execute the HTTP request node.