Ver Fonte

feat(docs): runtime api docs (#495)

Louis Young há 6 meses atrás
pai
commit
1c0cf6c261

+ 2 - 1
apps/docs/src/en/guide/runtime/_meta.json

@@ -1,5 +1,6 @@
 [
   "introduction",
   "quick-start",
-  "source-code-guide"
+  "source-code-guide",
+  "api"
 ]

+ 376 - 0
apps/docs/src/en/guide/runtime/api.mdx

@@ -0,0 +1,376 @@
+---
+title: API
+description: FlowGram Runtime API
+sidebar_position: 2
+---
+
+# FlowGram Runtime API Reference
+
+FlowGram Runtime provides four core APIs for running, monitoring, retrieving results, and canceling workflows. This document details the usage, parameters, and return values of these APIs.
+
+## TaskRun API
+
+### Function Description
+
+The TaskRun API is used to start a workflow task. It takes a workflow schema and initial inputs, and returns a task ID.
+
+### Parameters
+
+TaskRun API accepts a `TaskRunInput` object as its parameter:
+
+| Parameter | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| schema | string | Yes | JSON string of the workflow schema, defining nodes and edges |
+| inputs | object | No | Initial input parameters for the workflow, can be empty |
+
+The `schema` parameter is a JSON string that defines the structure of the workflow, including information about nodes and edges. The basic structure of the schema is as follows:
+
+```typescript
+interface WorkflowSchema {
+  nodes: WorkflowNodeSchema[];
+  edges: WorkflowEdgeSchema[];
+}
+
+interface WorkflowNodeSchema {
+  id: string;
+  type: FlowGramNode;
+  name?: string;
+  meta: {
+    position: {
+      x: number;
+      y: number;
+    };
+  };
+  data: any;
+  blocks?: WorkflowNodeSchema[];
+  edges?: WorkflowEdgeSchema[];
+}
+
+interface WorkflowEdgeSchema {
+  sourceNodeID: string;
+  sourcePort: string;
+  targetNodeID: string;
+  targetPort: string;
+}
+```
+
+### Return Value
+
+TaskRun API returns a `TaskRunOutput` object:
+
+| Field | Type | Description |
+| ----- | ---- | ----------- |
+| taskID | string | Unique identifier for the task, used for subsequent queries |
+
+### Error Handling
+
+TaskRun API may throw the following errors:
+
+- **Schema parsing error**: When the provided schema is not a valid JSON string
+- **Schema structure error**: When the schema structure does not match the expected format
+- **Node type error**: When the schema includes unsupported node types
+- **Initialization error**: When the workflow fails to initialize
+
+### Usage Example
+
+```javascript
+import { TaskRunAPI } from '@flowgram.ai/runtime-js';
+
+const schema = JSON.stringify({
+  nodes: [
+    {
+      id: 'start',
+      type: 'start',
+      meta: { position: { x: 0, y: 0 } },
+      data: {}
+    },
+    {
+      id: 'llm',
+      type: 'llm',
+      meta: { position: { x: 200, y: 0 } },
+      data: {
+        modelName: 'gpt-3.5-turbo',
+        temperature: 0.7,
+        systemPrompt: 'You are an assistant',
+        prompt: 'Introduce yourself'
+      }
+    },
+    {
+      id: 'end',
+      type: 'end',
+      meta: { position: { x: 400, y: 0 } },
+      data: {}
+    }
+  ],
+  edges: [
+    {
+      sourceNodeID: 'start',
+      sourcePort: 'out',
+      targetNodeID: 'llm',
+      targetPort: 'in'
+    },
+    {
+      sourceNodeID: 'llm',
+      sourcePort: 'out',
+      targetNodeID: 'end',
+      targetPort: 'in'
+    }
+  ]
+});
+
+const inputs = {
+  userInput: 'Please introduce yourself'
+};
+
+async function runWorkflow() {
+  try {
+    const result = await TaskRunAPI({
+      schema,
+      inputs
+    });
+    console.log('Task ID:', result.taskID);
+    return result.taskID;
+  } catch (error) {
+    console.error('Failed to start workflow:', error);
+  }
+}
+```
+
+### Notes
+
+- The schema must be a valid JSON string and conform to the WorkflowSchema structure
+- The workflow must include a start node (type: 'start') and an end node (type: 'end')
+- Connections between nodes must be correctly defined through edges
+- After a task is started, it will execute asynchronously. You can use the TaskReport API and TaskResult API to get the execution status and results
+
+## TaskReport API
+
+### Function Description
+
+The TaskReport API is used to get the execution report of a workflow task, including the task status and the execution status of each node.
+
+### Parameters
+
+TaskReport API accepts a `TaskReportInput` object as its parameter:
+
+| Parameter | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| taskID | string | Yes | Unique identifier for the task, returned by TaskRun API |
+
+### Return Value
+
+TaskReport API returns a `TaskReportOutput` object containing the execution report of the task:
+
+| Field | Type | Description |
+| ----- | ---- | ----------- |
+| workflow | WorkflowStatus | Overall status of the workflow |
+| nodes | `Record<string, NodeStatus>` | Execution status of each node |
+
+The `WorkflowStatus` structure is as follows:
+
+```typescript
+interface WorkflowStatus {
+  status: 'idle' | 'processing' | 'success' | 'fail' | 'canceled';
+  terminated: boolean;
+}
+```
+
+The `NodeStatus` structure is as follows:
+
+```typescript
+interface NodeStatus {
+  status: 'idle' | 'processing' | 'success' | 'fail' | 'canceled';
+  startTime?: number;
+  endTime?: number;
+}
+```
+
+### Error Handling
+
+TaskReport API may encounter the following error situations:
+
+- **Task does not exist**: When the provided taskID does not exist, returns undefined
+- **Report generation error**: When an error occurs during report generation
+
+### Usage Example
+
+```javascript
+import { TaskReportAPI } from '@flowgram.ai/runtime-js';
+
+async function getTaskReport(taskID) {
+  try {
+    const report = await TaskReportAPI({ taskID });
+
+    if (!report) {
+      console.log('Task does not exist or report not generated');
+      return;
+    }
+
+    console.log('Workflow status:', report.workflow.status);
+    console.log('Workflow terminated:', report.workflow.terminated);
+
+    // Print status of each node
+    for (const [nodeId, nodeStatus] of Object.entries(report.nodes)) {
+      console.log(`Node ${nodeId} status:`, nodeStatus.status);
+      if (nodeStatus.startTime) {
+        console.log(`Node ${nodeId} start time:`, new Date(nodeStatus.startTime).toLocaleString());
+      }
+      if (nodeStatus.endTime) {
+        console.log(`Node ${nodeId} end time:`, new Date(nodeStatus.endTime).toLocaleString());
+      }
+    }
+
+    return report;
+  } catch (error) {
+    console.error('Failed to get task report:', error);
+  }
+}
+```
+
+### Notes
+
+- The task report is real-time, you can call TaskReport API multiple times to get the latest execution status
+- If the workflow has not terminated (`workflow.terminated` is false), the workflow is still executing
+- Node status can be 'idle' (not started), 'processing' (executing), 'success' (successful), 'fail' (failed), or 'canceled' (canceled)
+- It is recommended to poll the task report periodically to monitor the progress of the workflow
+
+## TaskCancel API
+
+### Function Description
+
+The TaskCancel API is used to cancel a running workflow task.
+
+### Parameters
+
+TaskCancel API accepts a `TaskCancelInput` object as its parameter:
+
+| Parameter | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| taskID | string | Yes | Unique identifier for the task, returned by TaskRun API |
+
+### Return Value
+
+TaskCancel API returns a `TaskCancelOutput` object:
+
+| Field | Type | Description |
+| ----- | ---- | ----------- |
+| success | boolean | Indicates whether the task was successfully canceled |
+
+### Error Handling
+
+TaskCancel API may encounter the following error situations:
+
+- **Task does not exist**: When the provided taskID does not exist, returns `{ success: false }`
+- **Task already completed**: When the task has already completed or been canceled, it cannot be canceled again
+
+### Usage Example
+
+```javascript
+import { TaskCancelAPI } from '@flowgram.ai/runtime-js';
+
+async function cancelTask(taskID) {
+  try {
+    const result = await TaskCancelAPI({ taskID });
+
+    if (result.success) {
+      console.log('Task successfully canceled');
+    } else {
+      console.log('Failed to cancel task, task may not exist or is already completed');
+    }
+
+    return result.success;
+  } catch (error) {
+    console.error('Failed to cancel task:', error);
+    return false;
+  }
+}
+```
+
+### Notes
+
+- Task cancellation is asynchronous, after a successful cancellation request, the task may take some time to completely stop
+- Tasks that have already completed cannot be canceled
+- After canceling a task, you can check the final status of the task through TaskReport API, the status of a canceled task will change to 'canceled'
+- Canceling a task does not clear the intermediate results of the task, you can still get the results of the executed part through TaskResult API
+
+## TaskResult API
+
+### Function Description
+
+The TaskResult API is used to get the final result of a workflow task.
+
+### Parameters
+
+TaskResult API accepts a `TaskResultInput` object as its parameter:
+
+| Parameter | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| taskID | string | Yes | Unique identifier for the task, returned by TaskRun API |
+
+### Return Value
+
+TaskResult API returns a `WorkflowOutputs` object containing the output results of the workflow:
+
+```typescript
+type WorkflowOutputs = Record<string, any>;
+```
+
+The structure of the returned object depends on the specific implementation and output definition of the workflow.
+
+### Error Handling
+
+TaskResult API may encounter the following error situations:
+
+- **Task does not exist**: When the provided taskID does not exist, returns undefined
+- **Task not completed**: When the task has not terminated, returns undefined
+- **Result retrieval error**: When an error occurs during result retrieval
+
+### Usage Example
+
+```javascript
+import { TaskResultAPI } from '@flowgram.ai/runtime-js';
+
+async function getTaskResult(taskID) {
+  try {
+    const result = await TaskResultAPI({ taskID });
+
+    if (!result) {
+      console.log('Task does not exist or is not yet completed');
+      return;
+    }
+
+    console.log('Task result:', result);
+    return result;
+  } catch (error) {
+    console.error('Failed to get task result:', error);
+  }
+}
+
+// Usage example: wait for task to complete and get result
+async function waitForResult(taskID, pollingInterval = 1000, timeout = 60000) {
+  const startTime = Date.now();
+
+  while (Date.now() - startTime < timeout) {
+    // Get task report
+    const report = await TaskReportAPI({ taskID });
+
+    // If task has terminated, get result
+    if (report && report.workflow.terminated) {
+      return await TaskResultAPI({ taskID });
+    }
+
+    // Wait for a while before checking again
+    await new Promise(resolve => setTimeout(resolve, pollingInterval));
+  }
+
+  throw new Error('Timeout waiting for task result');
+}
+```
+
+### Notes
+
+- Results can only be obtained when the task has terminated (completed, failed, or canceled)
+- If the task has not yet completed, TaskResult API will return undefined
+- It is recommended to check if the task has terminated through TaskReport API before calling TaskResult API to get the result
+- For canceled tasks, only partial results or no results may be available
+- The specific structure of the result depends on the definition of the workflow, and needs to be parsed according to the actual output of the workflow

+ 6 - 5
apps/docs/src/en/guide/runtime/introduction.mdx

@@ -32,16 +32,17 @@ As a reference implementation, FlowGram Runtime will not be published as a packa
 A workflow is a directed graph composed of nodes and edges, describing the execution order and logical relationships of a series of tasks. In FlowGram Runtime, workflows are defined in JSON format, containing nodes and edges.
 
 Example workflow definition:
+
 ```json
 {
   "nodes": [
-    { "id": "start", "type": "Start", "metadata": {}, "data": {} },
-    { "id": "llm", "type": "LLM", "metadata": {}, "data": { "systemPrompt": "You are an assistant", "userPrompt": "{{input}}" } },
-    { "id": "end", "type": "End", "metadata": {}, "data": {} }
+    { "id": "start", "type": "Start", "meta": {}, "data": {} },
+    { "id": "llm", "type": "LLM", "meta": {}, "data": { "systemPrompt": "You are an assistant", "userPrompt": "{{start.input}}" } },
+    { "id": "end", "type": "End", "meta": {}, "data": {} }
   ],
   "edges": [
-    { "source": "start", "target": "llm" },
-    { "source": "llm", "target": "end" }
+    { "sourceNodeID": "start", "targetNodeID": "llm" },
+    { "sourceNodeID": "llm", "targetNodeID": "end" }
   ]
 }
 ```

+ 2 - 1
apps/docs/src/zh/guide/runtime/_meta.json

@@ -1,5 +1,6 @@
 [
   "introduction",
   "quick-start",
-  "source-code-guide"
+  "source-code-guide",
+  "api"
 ]

+ 376 - 0
apps/docs/src/zh/guide/runtime/api.mdx

@@ -0,0 +1,376 @@
+---
+title: API
+description: FlowGram Runtime API
+sidebar_position: 2
+---
+
+# FlowGram Runtime API 参考
+
+FlowGram Runtime 提供了四个核心 API,用于工作流的运行、监控、结果获取和取消。本文档详细介绍了这些 API 的使用方法、参数和返回值。
+
+## TaskRun API
+
+### 功能描述
+
+TaskRun API 用于启动一个工作流任务,接收工作流 schema 和初始输入,返回任务 ID。
+
+### 参数说明
+
+TaskRun API 接收一个 `TaskRunInput` 对象作为参数:
+
+| 参数名 | 类型 | 必填 | 描述 |
+| ------ | ---- | ---- | ---- |
+| schema | string | 是 | 工作流 schema 的 JSON 字符串,定义了工作流的节点和边 |
+| inputs | object | 否 | 工作流的初始输入参数,可以为空 |
+
+`schema` 参数是一个 JSON 字符串,它定义了工作流的结构,包括节点和边的信息。schema 的基本结构如下:
+
+```typescript
+interface WorkflowSchema {
+  nodes: WorkflowNodeSchema[];
+  edges: WorkflowEdgeSchema[];
+}
+
+interface WorkflowNodeSchema {
+  id: string;
+  type: FlowGramNode;
+  name?: string;
+  meta: {
+    position: {
+      x: number;
+      y: number;
+    };
+  };
+  data: any;
+  blocks?: WorkflowNodeSchema[];
+  edges?: WorkflowEdgeSchema[];
+}
+
+interface WorkflowEdgeSchema {
+  sourceNodeID: string;
+  sourcePort: string;
+  targetNodeID: string;
+  targetPort: string;
+}
+```
+
+### 返回值说明
+
+TaskRun API 返回一个 `TaskRunOutput` 对象:
+
+| 字段名 | 类型 | 描述 |
+| ------ | ---- | ---- |
+| taskID | string | 任务的唯一标识符,用于后续查询任务状态和结果 |
+
+### 错误处理
+
+TaskRun API 可能会抛出以下错误:
+
+- **Schema 解析错误**:当提供的 schema 不是有效的 JSON 字符串时
+- **Schema 结构错误**:当 schema 结构不符合预期格式时
+- **节点类型错误**:当 schema 中包含不支持的节点类型时
+- **初始化错误**:当工作流初始化失败时
+
+### 使用示例
+
+```javascript
+import { TaskRunAPI } from '@flowgram.ai/runtime-js';
+
+const schema = JSON.stringify({
+  nodes: [
+    {
+      id: 'start',
+      type: 'start',
+      meta: { position: { x: 0, y: 0 } },
+      data: {}
+    },
+    {
+      id: 'llm',
+      type: 'llm',
+      meta: { position: { x: 200, y: 0 } },
+      data: {
+        modelName: 'gpt-3.5-turbo',
+        temperature: 0.7,
+        systemPrompt: '你是一个助手',
+        prompt: '介绍一下自己'
+      }
+    },
+    {
+      id: 'end',
+      type: 'end',
+      meta: { position: { x: 400, y: 0 } },
+      data: {}
+    }
+  ],
+  edges: [
+    {
+      sourceNodeID: 'start',
+      sourcePort: 'out',
+      targetNodeID: 'llm',
+      targetPort: 'in'
+    },
+    {
+      sourceNodeID: 'llm',
+      sourcePort: 'out',
+      targetNodeID: 'end',
+      targetPort: 'in'
+    }
+  ]
+});
+
+const inputs = {
+  userInput: '请介绍一下自己'
+};
+
+async function runWorkflow() {
+  try {
+    const result = await TaskRunAPI({
+      schema,
+      inputs
+    });
+    console.log('Task ID:', result.taskID);
+    return result.taskID;
+  } catch (error) {
+    console.error('启动工作流失败:', error);
+  }
+}
+```
+
+### 注意事项
+
+- schema 必须是有效的 JSON 字符串,且符合 WorkflowSchema 的结构
+- 工作流必须包含一个起始节点(type: 'start')和一个结束节点(type: 'end')
+- 节点之间的连接必须通过边(edges)正确定义
+- 任务启动后会异步执行,可以通过 TaskReport API 和 TaskResult API 获取执行状态和结果
+
+## TaskReport API
+
+### 功能描述
+
+TaskReport API 用于获取工作流任务的执行报告,包括任务状态和各节点的执行状态。
+
+### 参数说明
+
+TaskReport API 接收一个 `TaskReportInput` 对象作为参数:
+
+| 参数名 | 类型 | 必填 | 描述 |
+| ------ | ---- | ---- | ---- |
+| taskID | string | 是 | 任务的唯一标识符,由 TaskRun API 返回 |
+
+### 返回值说明
+
+TaskReport API 返回一个 `TaskReportOutput` 对象,包含任务的执行报告:
+
+| 字段名 | 类型 | 描述 |
+| ------ | ---- | ---- |
+| workflow | WorkflowStatus | 工作流整体状态 |
+| nodes | `Record<string, NodeStatus>` | 各节点的执行状态 |
+
+`WorkflowStatus` 结构如下:
+
+```typescript
+interface WorkflowStatus {
+  status: 'idle' | 'processing' | 'success' | 'fail' | 'canceled';
+  terminated: boolean;
+}
+```
+
+`NodeStatus` 结构如下:
+
+```typescript
+interface NodeStatus {
+  status: 'idle' | 'processing' | 'success' | 'fail' | 'canceled';
+  startTime?: number;
+  endTime?: number;
+}
+```
+
+### 错误处理
+
+TaskReport API 可能会遇到以下错误情况:
+
+- **任务不存在**:当提供的 taskID 不存在时,返回 undefined
+- **报告生成错误**:当报告生成过程中出现错误时
+
+### 使用示例
+
+```javascript
+import { TaskReportAPI } from '@flowgram.ai/runtime-js';
+
+async function getTaskReport(taskID) {
+  try {
+    const report = await TaskReportAPI({ taskID });
+
+    if (!report) {
+      console.log('任务不存在或报告未生成');
+      return;
+    }
+
+    console.log('工作流状态:', report.workflow.status);
+    console.log('工作流是否终止:', report.workflow.terminated);
+
+    // 打印各节点状态
+    for (const [nodeId, nodeStatus] of Object.entries(report.nodes)) {
+      console.log(`节点 ${nodeId} 状态:`, nodeStatus.status);
+      if (nodeStatus.startTime) {
+        console.log(`节点 ${nodeId} 开始时间:`, new Date(nodeStatus.startTime).toLocaleString());
+      }
+      if (nodeStatus.endTime) {
+        console.log(`节点 ${nodeId} 结束时间:`, new Date(nodeStatus.endTime).toLocaleString());
+      }
+    }
+
+    return report;
+  } catch (error) {
+    console.error('获取任务报告失败:', error);
+  }
+}
+```
+
+### 注意事项
+
+- 任务报告是实时的,可以多次调用 TaskReport API 来获取最新的执行状态
+- 如果工作流尚未终止(`workflow.terminated` 为 false),则工作流仍在执行中
+- 节点状态可能为 'idle'(未开始)、'processing'(执行中)、'success'(成功)、'fail'(失败)或 'canceled'(已取消)
+- 建议定期轮询任务报告,以监控工作流的执行进度
+
+## TaskCancel API
+
+### 功能描述
+
+TaskCancel API 用于取消正在执行的工作流任务。
+
+### 参数说明
+
+TaskCancel API 接收一个 `TaskCancelInput` 对象作为参数:
+
+| 参数名 | 类型 | 必填 | 描述 |
+| ------ | ---- | ---- | ---- |
+| taskID | string | 是 | 任务的唯一标识符,由 TaskRun API 返回 |
+
+### 返回值说明
+
+TaskCancel API 返回一个 `TaskCancelOutput` 对象:
+
+| 字段名 | 类型 | 描述 |
+| ------ | ---- | ---- |
+| success | boolean | 表示任务是否成功取消 |
+
+### 错误处理
+
+TaskCancel API 可能会遇到以下错误情况:
+
+- **任务不存在**:当提供的 taskID 不存在时,返回 `{ success: false }`
+- **任务已完成**:当任务已经完成或已经取消时,无法再次取消
+
+### 使用示例
+
+```javascript
+import { TaskCancelAPI } from '@flowgram.ai/runtime-js';
+
+async function cancelTask(taskID) {
+  try {
+    const result = await TaskCancelAPI({ taskID });
+
+    if (result.success) {
+      console.log('任务已成功取消');
+    } else {
+      console.log('任务取消失败,可能任务不存在或已完成');
+    }
+
+    return result.success;
+  } catch (error) {
+    console.error('取消任务失败:', error);
+    return false;
+  }
+}
+```
+
+### 注意事项
+
+- 任务取消是异步的,取消请求成功后,任务可能需要一些时间才能完全停止
+- 已经完成的任务无法取消
+- 取消任务后,可以通过 TaskReport API 查看任务的最终状态,已取消的任务状态将变为 'canceled'
+- 取消任务不会清除任务的中间结果,仍然可以通过 TaskResult API 获取已执行部分的结果
+
+## TaskResult API
+
+### 功能描述
+
+TaskResult API 用于获取工作流任务的最终结果。
+
+### 参数说明
+
+TaskResult API 接收一个 `TaskResultInput` 对象作为参数:
+
+| 参数名 | 类型 | 必填 | 描述 |
+| ------ | ---- | ---- | ---- |
+| taskID | string | 是 | 任务的唯一标识符,由 TaskRun API 返回 |
+
+### 返回值说明
+
+TaskResult API 返回一个 `WorkflowOutputs` 对象,包含工作流的输出结果:
+
+```typescript
+type WorkflowOutputs = Record<string, any>;
+```
+
+返回的对象结构取决于工作流的具体实现和输出定义。
+
+### 错误处理
+
+TaskResult API 可能会遇到以下错误情况:
+
+- **任务不存在**:当提供的 taskID 不存在时,返回 undefined
+- **任务未完成**:当任务尚未终止时,返回 undefined
+- **结果获取错误**:当获取结果过程中出现错误时
+
+### 使用示例
+
+```javascript
+import { TaskResultAPI } from '@flowgram.ai/runtime-js';
+
+async function getTaskResult(taskID) {
+  try {
+    const result = await TaskResultAPI({ taskID });
+
+    if (!result) {
+      console.log('任务不存在或尚未完成');
+      return;
+    }
+
+    console.log('任务结果:', result);
+    return result;
+  } catch (error) {
+    console.error('获取任务结果失败:', error);
+  }
+}
+
+// 使用示例:等待任务完成并获取结果
+async function waitForResult(taskID, pollingInterval = 1000, timeout = 60000) {
+  const startTime = Date.now();
+
+  while (Date.now() - startTime < timeout) {
+    // 获取任务报告
+    const report = await TaskReportAPI({ taskID });
+
+    // 如果任务已终止,获取结果
+    if (report && report.workflow.terminated) {
+      return await TaskResultAPI({ taskID });
+    }
+
+    // 等待一段时间后再次检查
+    await new Promise(resolve => setTimeout(resolve, pollingInterval));
+  }
+
+  throw new Error('等待任务结果超时');
+}
+```
+
+### 注意事项
+
+- 只有当任务已经终止(完成、失败或取消)时,才能获取到结果
+- 如果任务尚未完成,TaskResult API 将返回 undefined
+- 建议先通过 TaskReport API 检查任务是否已终止,再调用 TaskResult API 获取结果
+- 对于已取消的任务,可能只能获取到部分结果或没有结果
+- 结果的具体结构取决于工作流的定义,需要根据实际工作流的输出进行解析

+ 5 - 5
apps/docs/src/zh/guide/runtime/introduction.mdx

@@ -35,13 +35,13 @@ FlowGram Runtime **定位为 demo 而非 SDK**,它的主要目标是:
 ```json
 {
   "nodes": [
-    { "id": "start", "type": "Start", "metadata": {}, "data": {} },
-    { "id": "llm", "type": "LLM", "metadata": {}, "data": { "systemPrompt": "你是助手", "userPrompt": "{{input}}" } },
-    { "id": "end", "type": "End", "metadata": {}, "data": {} }
+    { "id": "start", "type": "Start", "meta": {}, "data": {} },
+    { "id": "llm", "type": "LLM", "meta": {}, "data": { "systemPrompt": "你是助手", "userPrompt": "{{start.input}}" } },
+    { "id": "end", "type": "End", "meta": {}, "data": {} }
   ],
   "edges": [
-    { "source": "start", "target": "llm" },
-    { "source": "llm", "target": "end" }
+    { "sourceNodeID": "start", "targetNodeID": "llm" },
+    { "sourceNodeID": "llm", "targetNodeID": "end" }
   ]
 }
 ```

+ 2 - 2
apps/docs/src/zh/guide/runtime/quick-start.mdx

@@ -1,10 +1,10 @@
 ---
-title: 快速入门
+title: 快速开始
 description: 快速上手使用 FlowGram Runtime
 sidebar_position: 3
 ---
 
-# 快速入门
+# 快速开始
 
 本文档将帮助您快速上手使用 FlowGram Runtime,包括环境准备、安装配置、创建和运行工作流等内容。通过本指南,您将能够在短时间内搭建起自己的工作流运行环境并运行第一个工作流示例。