Skip to content

Commit 45725aa

Browse files
swfnotswiftqq_62395577
andauthored
引入skipped机制并且完善多节点的断流问题 (#604)
* 实现选择分支skipped的传递逻辑 * 修改节点到达逻辑,避免提前关流 * 修改AippFlowRuntimeInfo解决其在debug页面中end节点导致提前结束的问题 * 解决前端skipped标识问题 * 放开前置节点限制 * 新增end表,解决非debug背景下的关流问题 * 新增锁,防止多次调用sendlastdata * 修复合并bug * 修改skipped的传递机制保证非流程图的节点保持原有逻辑 * 修改因为skipped机制导致的问题 * 解决skippedend节点无法触发回调的问题 * 修改原版的异步落库机制,实现正确的断流机制 * 新增分布式锁,防值两个node同时落库 * 修改conditionNode对于skipped机制的启用又通过context类型判断转为主动在aipp流程中调用 * 常规修改 * 解决最后一个end节点两次重入库的问题 * 放开前端节点限制 * 修改测试样例,适应放重入库的逻辑变化 --------- Co-authored-by: qq_62395577 <qq_62395577@noreply.gitcode.com>
1 parent 6d54aa9 commit 45725aa

44 files changed

Lines changed: 1297 additions & 163 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agent-flow/src/common/Consts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const NODE_STATUS = {
1010
RUNNING: 'RUNNING',
1111
ERROR: 'ERROR',
1212
SUCCESS: 'ARCHIVED',
13+
SKIPPED: 'SKIPPED',
1314
DEFAULT: 'DEFAULT',
1415
UN_RUNNING: 'UN_RUNNING',
1516
TERMINATED: 'TERMINATED',
@@ -287,4 +288,4 @@ export const DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_EXTENSIONS = {
287288
referenceNode: VIRTUAL_CONTEXT_NODE.id,
288289
value: [VIRTUAL_CONTEXT_NODE_VARIABLES.APP_CREATE_BY],
289290
}],
290-
};
291+
};

agent-flow/src/components/flowRunComponent/RunningStatusPanel.jsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,16 @@ SvgComponent.propTypes = {
143143
};
144144

145145
const TimeComponent = ({shape, runStatus}) => {
146+
const statusClassMap = {
147+
[NODE_STATUS.SUCCESS]: 'success',
148+
[NODE_STATUS.ERROR]: 'failed',
149+
[NODE_STATUS.RUNNING]: 'running',
150+
[NODE_STATUS.SKIPPED]: 'skipped',
151+
};
152+
const statusClass = statusClassMap[runStatus];
146153
return (<>
147-
<div className={`time-text-container time-text-container-${runStatus}`}>
148-
<div className={`time-text time-text-${runStatus}`}>
154+
<div className={`time-text-container${statusClass ? ` time-text-container-${statusClass}` : ''}`}>
155+
<div className={`time-text${statusClass ? ` time-text-${statusClass}` : ''}`}>
149156
{shape.cost ? (shape.cost / 1000) + "s" : "0.000s"}
150157
</div>
151158
</div>
@@ -182,6 +189,17 @@ const getStatus = (nodeStatus) => {
182189
return <Icon component={(props) => <SvgComponent {...props} SvgCom={IconRunningFailed}/>}/>;
183190
},
184191
};
192+
case NODE_STATUS.SKIPPED:
193+
return {
194+
title: t('skipped'),
195+
enableReport: true,
196+
getTime: (shape) => {
197+
return <TimeComponent shape={shape} runStatus={nodeStatus}/>;
198+
},
199+
getIcon: () => {
200+
return <Icon component={(props) => <SvgComponent {...props} SvgCom={IconRunningUnRunning}/>}/>;
201+
},
202+
};
185203
case NODE_STATUS.RUNNING:
186204
return {
187205
title: t('running'),
@@ -222,4 +240,4 @@ const getStatus = (nodeStatus) => {
222240
}
223241
};
224242

225-
export default RunningStatusPanel;
243+
export default RunningStatusPanel;

agent-flow/src/components/flowRunComponent/style.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
background-color: rgb(198, 57, 57, 0.2);
3232
}
3333

34+
.time-text-container-skipped {
35+
background-color: rgba(107, 109, 117, 0.16);
36+
}
37+
3438
.time-text {
3539
font-family: SF Pro Display, -apple-system, BlinkMacSystemFont, Segoe Ul, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif;
3640
font-size: 12px;
@@ -52,6 +56,10 @@
5256
color: rgb(198, 57, 57);
5357
}
5458

59+
.time-text-skipped {
60+
color: rgb(107, 109, 117);
61+
}
62+
5563
.button-text {
5664
color: rgb(77, 77, 77);
5765
font-family: SF Pro Display, -apple-system, BlinkMacSystemFont, Segoe Ul, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif;
@@ -213,4 +221,4 @@
213221
position: absolute;
214222
border-radius: 16px;
215223
background: rgba(197, 197, 197, 0.13);
216-
}
224+
}

agent-flow/src/flow/runners.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const standardRunner = (node) => {
7575
return false;
7676
}
7777
const data = dataList.find(d => d.nodeId === preNode.id);
78-
return data && data.status === NODE_STATUS.SUCCESS;
78+
return data && (data.status === NODE_STATUS.SUCCESS || data.status === NODE_STATUS.SKIPPED);
7979
};
8080

8181
return self;
@@ -174,4 +174,4 @@ export const inactiveNodeRunner = (node) => {
174174
};
175175

176176
return self;
177-
};
177+
};

agent-flow/src/i18n/en_US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
"running": "Running",
124124
"notRunning": "Not running",
125125
"runFailed": "Failed",
126+
"skipped": "Skipped",
126127
"runResult": "Running Result",
127128
"promptName": "Prompt Word",
128129
"promptTextarea": "Use {{Variable name}} to add a variable",

agent-flow/src/i18n/zh_CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@
423423
"running": "运行中",
424424
"notRunning": "未运行",
425425
"runFailed": "运行失败",
426+
"skipped": "已跳过",
426427
"runResult": "运行结果",
427428
"closeRunResult": "收起运行结果",
428429
"invalidCategory": "存在不合法的类目,请先修改",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
3+
* This file is a part of the ModelEngine Project.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*--------------------------------------------------------------------------------------------*/
6+
7+
package modelengine.fit.jober.aipp.domain;
8+
9+
import lombok.Data;
10+
import lombok.EqualsAndHashCode;
11+
import lombok.experimental.SuperBuilder;
12+
13+
/**
14+
* END节点状态领域对象.
15+
*
16+
* @author 张越
17+
* @since 2026-04-01
18+
*/
19+
@EqualsAndHashCode(callSuper = true)
20+
@Data
21+
@SuperBuilder
22+
public class EndNodeStatus extends BaseDomain {
23+
private Long id;
24+
private String traceId;
25+
private String endNodeId;
26+
private String status;
27+
private long startTime;
28+
private long endTime;
29+
private String instanceId;
30+
private String flowDefinitionId;
31+
32+
/**
33+
* 获取节点执行时间.
34+
*
35+
* @return 执行时间(毫秒).
36+
*/
37+
public long getExecutionCost() {
38+
return this.endTime - this.startTime;
39+
}
40+
}

0 commit comments

Comments
 (0)