|
|
@@ -75,7 +75,7 @@ interface LayoutEdge {
|
|
|
}
|
|
|
|
|
|
const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps> = (
|
|
|
- { goals, msgGroups = {}, invalidBranches, onNodeClick, onSubTraceClick },
|
|
|
+ { goals, msgGroups = {}, invalidBranches, onNodeClick },
|
|
|
ref,
|
|
|
) => {
|
|
|
// 过滤掉有父节点的 goals,只保留主链节点
|
|
|
@@ -820,25 +820,25 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
const handleNodeClick = useCallback(
|
|
|
(node: LayoutNode) => {
|
|
|
if (node.type === "goal") {
|
|
|
- const goalData = node.data as Goal;
|
|
|
-
|
|
|
- // 只有具有 sub_trace_ids 的子目标节点(agent 委托执行)才触发 trace 切换
|
|
|
- // 普通的 sub_goal 节点(蓝色节点)没有 sub_trace_ids,应该打开 DetailPanel
|
|
|
- const hasSubTraces = goalData.sub_trace_ids && goalData.sub_trace_ids.length > 0;
|
|
|
-
|
|
|
- if (node.parentId && onSubTraceClick && hasSubTraces) {
|
|
|
- const parentNode = layoutData.nodes.find((n) => n.id === node.parentId);
|
|
|
- if (parentNode && parentNode.type === "goal") {
|
|
|
- // 取第一个 sub_trace_id 作为跳转目标(使用 trace_id,而非 goal.id)
|
|
|
- const firstEntry = goalData.sub_trace_ids![0];
|
|
|
- const entry: SubTraceEntry =
|
|
|
- typeof firstEntry === "string"
|
|
|
- ? { id: firstEntry }
|
|
|
- : { id: firstEntry.trace_id, mission: firstEntry.mission };
|
|
|
- onSubTraceClick(parentNode.data as Goal, entry);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
+ // const goalData = node.data as Goal;
|
|
|
+
|
|
|
+ // // 只有具有 sub_trace_ids 的子目标节点(agent 委托执行)才触发 trace 切换
|
|
|
+ // // 普通的 sub_goal 节点(蓝色节点)没有 sub_trace_ids,应该打开 DetailPanel
|
|
|
+ // const hasSubTraces = goalData.sub_trace_ids && goalData.sub_trace_ids.length > 0;
|
|
|
+
|
|
|
+ // if (node.parentId && onSubTraceClick && hasSubTraces) {
|
|
|
+ // const parentNode = layoutData.nodes.find((n) => n.id === node.parentId);
|
|
|
+ // if (parentNode && parentNode.type === "goal") {
|
|
|
+ // // 取第一个 sub_trace_id 作为跳转目标(使用 trace_id,而非 goal.id)
|
|
|
+ // const firstEntry = goalData.sub_trace_ids![0];
|
|
|
+ // const entry: SubTraceEntry =
|
|
|
+ // typeof firstEntry === "string"
|
|
|
+ // ? { id: firstEntry }
|
|
|
+ // : { id: firstEntry.trace_id, mission: firstEntry.mission };
|
|
|
+ // onSubTraceClick(parentNode.data as Goal, entry);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
// 主链节点 或 没有 sub_trace_ids 的普通子目标节点 → 打开 DetailPanel
|
|
|
setSelectedNodeId(node.id);
|
|
|
@@ -848,7 +848,7 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
onNodeClick?.(node.data as Message);
|
|
|
}
|
|
|
},
|
|
|
- [onNodeClick, onSubTraceClick, layoutData],
|
|
|
+ [onNodeClick],
|
|
|
);
|
|
|
|
|
|
if (!layoutData) return <div>Loading...</div>;
|
|
|
@@ -969,8 +969,9 @@ const FlowChartComponent: ForwardRefRenderFunction<FlowChartRef, FlowChartProps>
|
|
|
{/* 折叠状态提示徽章 */}
|
|
|
{edge.collapsed && (
|
|
|
<g
|
|
|
- transform={`translate(${(edge.source.x + edge.target.x) / 2},${(edge.source.y + edge.target.y) / 2
|
|
|
- })`}
|
|
|
+ transform={`translate(${(edge.source.x + edge.target.x) / 2},${
|
|
|
+ (edge.source.y + edge.target.y) / 2
|
|
|
+ })`}
|
|
|
onClick={(e) => {
|
|
|
e.stopPropagation();
|
|
|
toggleCollapse(edge.id);
|