|
|
|
|
@ -90,7 +90,7 @@ Workflow applications offers non-session support and is ideal for translation, a
|
|
|
|
|
Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below:
|
|
|
|
|
<CodeGroup>
|
|
|
|
|
```streaming {{ title: 'Response' }}
|
|
|
|
|
data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
|
|
|
|
|
data: {"event": "text_chunk", "workflow_run_id": "b85e5fc5-751b-454d-b14e-dc5f240b0a31", "task_id": "bd029338-b068-4d34-a331-fc85478922c2", "data": {"text": "\u4e3a\u4e86", "from_variable_selector": ["1745912968134", "text"]}}\n\n
|
|
|
|
|
```
|
|
|
|
|
</CodeGroup>
|
|
|
|
|
The structure of the streaming chunks varies depending on the `event`:
|
|
|
|
|
@ -116,6 +116,13 @@ Workflow applications offers non-session support and is ideal for translation, a
|
|
|
|
|
- `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
|
|
|
|
|
- `inputs` (object) Contents of all preceding node variables used in the node
|
|
|
|
|
- `created_at` (timestamp) timestamp of start, e.g., 1705395332
|
|
|
|
|
- `event: text_chunk` Text fragment
|
|
|
|
|
- `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
|
|
|
|
|
- `workflow_run_id` (string) Unique ID of workflow execution
|
|
|
|
|
- `event` (string) fixed to `text_chunk`
|
|
|
|
|
- `data` (object) detail
|
|
|
|
|
- `text` (string) Text content
|
|
|
|
|
- `from_variable_selector` (array) Text source path, helping developers understand which node and variable generated the text
|
|
|
|
|
- `event: node_finished` node execution ends, success or failure in different states in the same event
|
|
|
|
|
- `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
|
|
|
|
|
- `workflow_run_id` (string) Unique ID of workflow execution
|
|
|
|
|
|