首页工作流执行:表单默认收起可展开、节点执行过程可视化(仿豆包)、失败支持重新执行/重新编辑、错误信息去重
- 提交后表单卡片默认收起(仅显示工作流标题),头部加明确展开/收起按钮 - node_start/node_complete 事件驱动节点步骤流,执行过程区仿豆包竖向展示 - 失败卡片拆分「重新执行」(复用已填值直接重跑)与「重新编辑」两按钮 - 失败消息只显示「❌ 执行失败」,错误详情由卡片 footer 展示,避免双处重复 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,45 @@ export function getNodeProgress(msg: WsStreamMessage): { current: number; total:
|
||||
};
|
||||
}
|
||||
|
||||
/** 工作流执行节点步骤(node_start/node_complete/error 事件驱动,渲染表单卡片执行过程区) */
|
||||
export interface WorkflowNodeStep {
|
||||
nodeId: string;
|
||||
nodeName: string;
|
||||
nodeIndex: number;
|
||||
status: 'pending' | 'running' | 'done' | 'failed';
|
||||
}
|
||||
|
||||
/** 工作流执行节点进度(挂在表单卡片消息 formProgress 上) */
|
||||
export interface WorkflowNodeProgress {
|
||||
nodes: WorkflowNodeStep[];
|
||||
}
|
||||
|
||||
/** 工作流节点事件解析结果:node_start / node_complete → { nodeId, nodeName, nodeIndex, phase } */
|
||||
export interface WorkflowNodeEvent {
|
||||
nodeId: string;
|
||||
nodeName: string;
|
||||
nodeIndex: number;
|
||||
phase: 'start' | 'complete';
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析工作流节点事件(node_start / node_complete)。
|
||||
* 返回完整节点信息(nodeId/nodeName/nodeIndex/phase),供执行过程区步骤列表驱动;非节点事件返回 null。
|
||||
*/
|
||||
export function getNodeEvent(msg: WsStreamMessage): WorkflowNodeEvent | null {
|
||||
const t = msg?.type;
|
||||
if (t !== WsEventType.NodeStart && t !== WsEventType.NodeComplete) return null;
|
||||
const d = msg?.data;
|
||||
const nodeIndex = d?.nodeIndex;
|
||||
if (typeof nodeIndex !== 'number') return null;
|
||||
return {
|
||||
nodeId: typeof d?.nodeId === 'string' ? d.nodeId : '',
|
||||
nodeName: typeof d?.nodeName === 'string' ? d.nodeName : '',
|
||||
nodeIndex,
|
||||
phase: t === WsEventType.NodeStart ? 'start' : 'complete',
|
||||
};
|
||||
}
|
||||
|
||||
/** tool_call → 工具名称(tool / toolName / name 依次尝试,缺失返回空串) */
|
||||
export function getToolCallName(msg: WsStreamMessage): string {
|
||||
const d = msg?.data;
|
||||
|
||||
Reference in New Issue
Block a user