chore: Improve workflow generator accessibility and API contracts (#38838)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Crazywoola
2026-07-13 09:15:54 +00:00
committed by GitHub
co-authored by autofix-ci[bot]
parent 8e0d10bf5e
commit 7865ffd429
27 changed files with 1869 additions and 460 deletions
+138 -7
View File
@@ -9684,7 +9684,7 @@ Generate a Dify workflow graph from natural language
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Workflow graph generated successfully | **application/json**: [GeneratorResponse](#generatorresponse)<br> |
| 200 | Workflow graph generated successfully | **application/json**: [WorkflowGenerateResponse](#workflowgenerateresponse)<br> |
| 400 | Invalid request parameters | |
| 402 | Provider quota exceeded | |
@@ -9699,10 +9699,10 @@ Stream a Dify workflow graph (plan then result) via SSE
#### Responses
| Code | Description |
| ---- | ----------- |
| 200 | Server-Sent Events stream of plan/result events |
| 400 | Invalid request parameters |
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Server-Sent Events stream; each data frame matches this plan/result event schema | **application/json**: [WorkflowGenerateStreamEventResponse](#workflowgeneratestreameventresponse)<br> |
| 400 | Invalid request parameters | |
### [POST] /workflow-generate/suggestions
Suggest example workflow-generator instructions for the tenant
@@ -9717,7 +9717,7 @@ Suggest example workflow-generator instructions for the tenant
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Suggestions generated successfully | **application/json**: [GeneratorResponse](#generatorresponse)<br> |
| 200 | Suggestions generated successfully | **application/json**: [WorkflowInstructionSuggestionsResponse](#workflowinstructionsuggestionsresponse)<br> |
| 400 | Invalid request parameters | |
### [GET] /workflow/{workflow_run_id}/events
@@ -23172,6 +23172,20 @@ How a workflow node is bound to an Agent.
| number_limits | integer | | No |
| transfer_methods | [ string ] | | No |
#### WorkflowGenerateErrorCode
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| WorkflowGenerateErrorCode | string | | |
#### WorkflowGenerateErrorResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| code | [WorkflowGenerateErrorCode](#workflowgenerateerrorcode) | | Yes |
| detail | string | | Yes |
| node_id | string | | No |
#### WorkflowGeneratePayload
Payload for the cmd+k `/create` and `/refine` workflow generator endpoint.
@@ -23182,12 +23196,107 @@ can reuse its existing handler.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| current_graph | object | Existing draft graph to refine (cmd+k `/refine`); omit for create-from-scratch | No |
| current_graph | [WorkflowGraph](#workflowgraph) | Existing draft graph to refine (cmd+k `/refine`); omit for create-from-scratch | No |
| ideal_output | string | Optional sample output for grounding | No |
| instruction | string | Natural-language workflow description | Yes |
| mode | string, <br>**Available values:** "advanced-chat", "auto", "workflow" | Target app mode for the generated graph; 'auto' lets the backend classify the instruction<br>*Enum:* `"advanced-chat"`, `"auto"`, `"workflow"` | Yes |
| model_config | [ModelConfig](#modelconfig) | Model configuration | Yes |
#### WorkflowGeneratePlanEventResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| app_name | string | | No |
| description | string | | No |
| event | string | | No |
| icon | string | | No |
| mode | string | *Enum:* `"advanced-chat"`, `"workflow"` | Yes |
| nodes | [ [WorkflowPlanNodeResponse](#workflowplannoderesponse) ] | | Yes |
| start_inputs | [ [WorkflowPlanStartInputResponse](#workflowplanstartinputresponse) ] | | No |
| title | string | | No |
#### WorkflowGenerateResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| app_name | string | | No |
| error | string | | No |
| errors | [ [WorkflowGenerateErrorResponse](#workflowgenerateerrorresponse) ] | | No |
| graph | [WorkflowGraph](#workflowgraph) | | Yes |
| icon | string | | No |
| message | string | | No |
| mode | string | | No |
#### WorkflowGenerateResultEventResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| app_name | string | | No |
| error | string | | No |
| errors | [ [WorkflowGenerateErrorResponse](#workflowgenerateerrorresponse) ] | | No |
| event | string | | No |
| graph | [WorkflowGraph](#workflowgraph) | | Yes |
| icon | string | | No |
| message | string | | No |
| mode | string | | No |
#### WorkflowGenerateStreamEventResponse
Schema for each JSON object carried by an SSE ``data:`` frame.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| WorkflowGenerateStreamEventResponse | [WorkflowGeneratePlanEventResponse](#workflowgenerateplaneventresponse)<br>[WorkflowGenerateResultEventResponse](#workflowgenerateresulteventresponse) | Schema for each JSON object carried by an SSE ``data:`` frame. | |
#### WorkflowGraph
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| edges | [ [WorkflowGraphEdge](#workflowgraphedge) ] | | Yes |
| nodes | [ [WorkflowGraphNode](#workflowgraphnode) ] | | Yes |
| viewport | [WorkflowGraphViewport](#workflowgraphviewport) | | Yes |
#### WorkflowGraphEdge
React Flow edge shape with extensible renderer metadata.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string | | Yes |
| source | string | | Yes |
| target | string | | Yes |
| type | string | | Yes |
#### WorkflowGraphNode
React Flow node shape accepted and returned by the generator.
Node-specific configuration lives under ``data`` and wrapper metadata
differs for container children, so unknown wrapper fields must survive
request validation and response serialization.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | object | | Yes |
| id | string | | Yes |
| position | [WorkflowGraphPosition](#workflowgraphposition) | | Yes |
| type | string | | Yes |
#### WorkflowGraphPosition
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| x | number | | Yes |
| y | number | | Yes |
#### WorkflowGraphViewport
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| x | number | | Yes |
| y | number | | Yes |
| zoom | number | | Yes |
#### WorkflowInstructionSuggestionsPayload
Payload for the workflow-generator instruction-suggestions endpoint.
@@ -23202,6 +23311,12 @@ tenant's default model. The underlying generator never raises — an empty
| language | string | Optional language to write the suggestions in | No |
| mode | string, <br>**Available values:** "advanced-chat", "workflow" | Target app mode for the suggestions<br>*Enum:* `"advanced-chat"`, `"workflow"` | Yes |
#### WorkflowInstructionSuggestionsResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| suggestions | [ string ] | | Yes |
#### WorkflowListQuery
| Name | Type | Description | Required |
@@ -23289,6 +23404,22 @@ tenant's default model. The underlying generator never raises — an empty
| paused_at | string | | No |
| paused_nodes | [ [PausedNodeResponse](#pausednoderesponse) ] | | Yes |
#### WorkflowPlanNodeResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| label | string | | Yes |
| node_type | string | | Yes |
| purpose | string | | No |
#### WorkflowPlanStartInputResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| label | string | | No |
| type | string | | No |
| variable | string | | Yes |
#### WorkflowPreviousNodeOutputRef
| Name | Type | Description | Required |