fix: 修复工作流公共 API 调用问题
- 限制远程文档仅访问公网地址并校验重定向目标 - 统一访问令牌 401/403 与过期执行状态 404 语义 - 校正节点查询参数和工作流状态文档
This commit is contained in:
@@ -649,42 +649,64 @@ const apiDocMarkdown = computed(() => {
|
||||
lines.push(``);
|
||||
lines.push(apiUrlLine('POST', `${baseUrl}/getChainStatus`));
|
||||
lines.push(``);
|
||||
lines.push(`查询工作流执行的整体状态与各节点执行详情。工作流为异步执行,建议**轮询**该接口直到状态为终态。`);
|
||||
lines.push(
|
||||
`查询工作流执行的整体状态与各节点执行详情。工作流为异步执行,建议**轮询**该接口直到状态为终态。`,
|
||||
);
|
||||
lines.push(``);
|
||||
lines.push(`### 请求体`);
|
||||
lines.push(``);
|
||||
lines.push('```json');
|
||||
lines.push(JSON.stringify({ executeId: '<runAsync 返回的执行 ID>' }, null, 2));
|
||||
lines.push(
|
||||
JSON.stringify(
|
||||
{
|
||||
executeId: '<runAsync 返回的执行 ID>',
|
||||
nodes: [{ nodeId: '<需要查询的节点 ID>' }],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
lines.push('```');
|
||||
lines.push(``);
|
||||
lines.push(`> \`nodes\` 参数可选。不传则只返回工作流整体状态;传入节点 ID 数组可额外获取对应节点的执行详情。`);
|
||||
lines.push(
|
||||
`> \`nodes\` 参数可选。不传则只返回工作流整体状态;需要节点详情时传入对象数组,每项至少包含 \`nodeId\`。`,
|
||||
);
|
||||
lines.push(``);
|
||||
lines.push(`### 响应示例`);
|
||||
lines.push(``);
|
||||
lines.push('```json');
|
||||
lines.push(JSON.stringify({
|
||||
errorCode: 0,
|
||||
message: '成功',
|
||||
data: {
|
||||
executeId: 'abc5358c-a310-4caa-97ec-455062b2235e',
|
||||
status: 'FINISHED',
|
||||
message: null,
|
||||
result: { output: '工作流执行结果' },
|
||||
nodes: {},
|
||||
},
|
||||
}, null, 2));
|
||||
lines.push(
|
||||
JSON.stringify(
|
||||
{
|
||||
errorCode: 0,
|
||||
message: '成功',
|
||||
data: {
|
||||
executeId: 'abc5358c-a310-4caa-97ec-455062b2235e',
|
||||
status: 20,
|
||||
message: null,
|
||||
result: { output: '工作流执行结果' },
|
||||
nodes: {},
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
lines.push('```');
|
||||
lines.push(``);
|
||||
lines.push(`### 状态值说明`);
|
||||
lines.push(``);
|
||||
lines.push(`| 状态 | 说明 |`);
|
||||
lines.push(`| --- | --- |`);
|
||||
lines.push(`| READY | 就绪,尚未开始 |`);
|
||||
lines.push(`| RUNNING | 执行中 |`);
|
||||
lines.push(`| SUSPEND | 挂起,等待确认节点恢复 |`);
|
||||
lines.push(`| FINISHED | 执行完成 |`);
|
||||
lines.push(`| FAILED | 执行失败 |`);
|
||||
lines.push(`| ERROR | 执行异常 |`);
|
||||
lines.push(`| 数值 | 状态 | 说明 |`);
|
||||
lines.push(`| --- | --- | --- |`);
|
||||
lines.push(`| 0 | READY | 就绪,尚未开始 |`);
|
||||
lines.push(`| 1 | RUNNING | 执行中 |`);
|
||||
lines.push(`| 5 | SUSPEND | 挂起,等待确认节点恢复 |`);
|
||||
lines.push(`| 10 | ERROR | 执行异常,可能仍在重试 |`);
|
||||
lines.push(`| 20 | SUCCEEDED | 执行成功,终态 |`);
|
||||
lines.push(`| 21 | FAILED | 执行失败,终态 |`);
|
||||
lines.push(`| 22 | CANCELLED | 已取消,终态 |`);
|
||||
lines.push(``);
|
||||
lines.push(`轮询可在状态值为 \`20\`、\`21\` 或 \`22\` 时结束。`);
|
||||
lines.push(``);
|
||||
|
||||
// ---- 3. 恢复执行 ----
|
||||
@@ -694,7 +716,9 @@ const apiDocMarkdown = computed(() => {
|
||||
lines.push(``);
|
||||
lines.push(apiUrlLine('POST', `${baseUrl}/resume`));
|
||||
lines.push(``);
|
||||
lines.push(`当工作流包含**确认节点**时,执行到该节点后状态变为 \`SUSPEND\`,需要调用此接口传入确认参数后恢复执行。若工作流不包含确认节点则无需调用。`);
|
||||
lines.push(
|
||||
`当工作流包含**确认节点**时,执行到该节点后状态变为 \`5(SUSPEND)\`,需要调用此接口传入确认参数后恢复执行。若工作流不包含确认节点则无需调用。`,
|
||||
);
|
||||
lines.push(``);
|
||||
lines.push(`### 请求体`);
|
||||
lines.push(``);
|
||||
|
||||
Reference in New Issue
Block a user