@agentscope-ai/flow 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/condition-item/index.js +2 -2
- package/dist/components/custom-inputs-control/index.d.ts +1 -1
- package/dist/components/custom-inputs-control/index.js +2 -2
- package/dist/components/flow-base-edge/index.js +11 -11
- package/dist/components/node-result-panel/index.js +1 -1
- package/dist/hooks/use-edges-interaction.js +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types/work-flow.d.ts +20 -20
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { filterVarItemsByType } from "../../hooks";
|
|
|
8
8
|
import { Divider, Flex, Select } from 'antd';
|
|
9
9
|
import React, { useMemo } from 'react';
|
|
10
10
|
import { OPERATOR_OPTS_MAP } from "../../constant";
|
|
11
|
-
import {
|
|
11
|
+
import { VALUE_FROM_OPTIONS, variableFromLabelRender, VariableSelector } from "../custom-inputs-control";
|
|
12
12
|
import { VariableBaseInput } from "../variable-input";
|
|
13
13
|
import "./index.less";
|
|
14
14
|
var getRightType = function getRightType(type) {
|
|
@@ -80,7 +80,7 @@ export default function ConditionItem(props) {
|
|
|
80
80
|
style: {
|
|
81
81
|
width: 60
|
|
82
82
|
},
|
|
83
|
-
options:
|
|
83
|
+
options: VALUE_FROM_OPTIONS,
|
|
84
84
|
value: props.value.right.valueFrom,
|
|
85
85
|
onChange: function onChange(val) {
|
|
86
86
|
return props.onChange({
|
|
@@ -48,7 +48,7 @@ export declare const VariableSelector: React.MemoExoticComponent<(props: {
|
|
|
48
48
|
}) => React.JSX.Element>;
|
|
49
49
|
export declare const VariableFormComp: React.MemoExoticComponent<(props: IVariableFormCompProps) => React.JSX.Element | undefined>;
|
|
50
50
|
export declare const variableFromLabelRender: (value: string) => React.JSX.Element | null;
|
|
51
|
-
export declare const
|
|
51
|
+
export declare const VALUE_FROM_OPTIONS: {
|
|
52
52
|
label: React.JSX.Element;
|
|
53
53
|
value: string;
|
|
54
54
|
}[];
|
|
@@ -215,7 +215,7 @@ export var variableFromLabelRender = function variableFromLabelRender(value) {
|
|
|
215
215
|
});
|
|
216
216
|
return null;
|
|
217
217
|
};
|
|
218
|
-
export var
|
|
218
|
+
export var VALUE_FROM_OPTIONS = [{
|
|
219
219
|
label: /*#__PURE__*/React.createElement("div", {
|
|
220
220
|
className: "flex items-center gap-[8px]"
|
|
221
221
|
}, /*#__PURE__*/React.createElement(SparkQuotationLine, {
|
|
@@ -325,7 +325,7 @@ export default /*#__PURE__*/memo(function CustomInputsControl(props) {
|
|
|
325
325
|
});
|
|
326
326
|
},
|
|
327
327
|
disabled: props.disabled,
|
|
328
|
-
options:
|
|
328
|
+
options: VALUE_FROM_OPTIONS,
|
|
329
329
|
labelRender: function labelRender(props) {
|
|
330
330
|
return variableFromLabelRender(props.value);
|
|
331
331
|
},
|
|
@@ -63,8 +63,8 @@ export default /*#__PURE__*/memo(function FlowBaseEdge(_ref) {
|
|
|
63
63
|
var _getCommonConfig = getCommonConfig(),
|
|
64
64
|
antPrefix = _getCommonConfig.antPrefix;
|
|
65
65
|
var colorList = useMemo(function () {
|
|
66
|
-
if (edgeData.
|
|
67
|
-
if (edgeData.
|
|
66
|
+
if (edgeData._sourceNodeStatus && edgeData._targetNodeStatus) {
|
|
67
|
+
if (edgeData._sourceNodeStatus === 'success' && edgeData._targetNodeStatus === 'success') {
|
|
68
68
|
return [{
|
|
69
69
|
color: '#30A46C',
|
|
70
70
|
opacity: 0.5,
|
|
@@ -75,7 +75,7 @@ export default /*#__PURE__*/memo(function FlowBaseEdge(_ref) {
|
|
|
75
75
|
offset: 100
|
|
76
76
|
}];
|
|
77
77
|
}
|
|
78
|
-
if (edgeData.
|
|
78
|
+
if (edgeData._sourceNodeStatus === 'success' && edgeData._targetNodeStatus === 'fail') {
|
|
79
79
|
return [{
|
|
80
80
|
color: '#30A46C',
|
|
81
81
|
opacity: 1,
|
|
@@ -90,7 +90,7 @@ export default /*#__PURE__*/memo(function FlowBaseEdge(_ref) {
|
|
|
90
90
|
offset: 100
|
|
91
91
|
}];
|
|
92
92
|
}
|
|
93
|
-
if (edgeData.
|
|
93
|
+
if (edgeData._sourceNodeStatus === 'success' || edgeData._sourceNodeStatus === 'executing' && edgeData._targetNodeStatus === 'executing') {
|
|
94
94
|
return [{
|
|
95
95
|
color: '#30A46C',
|
|
96
96
|
opacity: 1,
|
|
@@ -135,22 +135,22 @@ export default /*#__PURE__*/memo(function FlowBaseEdge(_ref) {
|
|
|
135
135
|
}, [edgeData, selected]);
|
|
136
136
|
var isAnimated = useMemo(function () {
|
|
137
137
|
var _ref2;
|
|
138
|
-
if (edgeData.
|
|
139
|
-
return edgeData.
|
|
138
|
+
if (edgeData._sourceNodeStatus === 'executing' && edgeData._targetNodeStatus === 'executing') return true;
|
|
139
|
+
return edgeData._sourceNodeStatus === 'success' && !((_ref2 = ['fail', 'success']) !== null && _ref2 !== void 0 && _ref2.includes(edgeData._targetNodeStatus || ''));
|
|
140
140
|
}, [edgeData]);
|
|
141
141
|
var markerEndColor = useMemo(function () {
|
|
142
|
-
if (edgeData.
|
|
143
|
-
if (edgeData.
|
|
142
|
+
if (edgeData._sourceNodeStatus && edgeData._targetNodeStatus) {
|
|
143
|
+
if (edgeData._sourceNodeStatus === 'success' && edgeData._targetNodeStatus === 'success') {
|
|
144
144
|
return {
|
|
145
145
|
stroke: '#30A46C'
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
if (edgeData.
|
|
148
|
+
if (edgeData._sourceNodeStatus === 'success' && edgeData._targetNodeStatus === 'fail') {
|
|
149
149
|
return {
|
|
150
150
|
stroke: '#F23139'
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
if (edgeData.
|
|
153
|
+
if (edgeData._sourceNodeStatus === 'success') {
|
|
154
154
|
return {
|
|
155
155
|
stroke: '#615CED'
|
|
156
156
|
};
|
|
@@ -168,7 +168,7 @@ export default /*#__PURE__*/memo(function FlowBaseEdge(_ref) {
|
|
|
168
168
|
return {
|
|
169
169
|
stroke: "var(--".concat(antPrefix, "-color-mauve)")
|
|
170
170
|
};
|
|
171
|
-
}, [edgeData._hover, selected, getCommonConfig, edgeData.
|
|
171
|
+
}, [edgeData._hover, selected, getCommonConfig, edgeData._sourceNodeStatus, edgeData._targetNodeStatus, antPrefix]);
|
|
172
172
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !animated && /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("marker", {
|
|
173
173
|
id: "".concat(id, "-arrow"),
|
|
174
174
|
markerWidth: "20",
|
|
@@ -74,7 +74,7 @@ var NodeResultPanel = function NodeResultPanel(props) {
|
|
|
74
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
75
75
|
expand = _useState2[0],
|
|
76
76
|
setExpand = _useState2[1];
|
|
77
|
-
var isBatch = props.data.
|
|
77
|
+
var isBatch = props.data.isBatch && !!props.data.batches;
|
|
78
78
|
var _useState3 = useState(1),
|
|
79
79
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
80
80
|
batchIndex = _useState4[0],
|
|
@@ -34,15 +34,15 @@ export var useEdgesInteraction = function useEdgesInteraction() {
|
|
|
34
34
|
if (!!sourceNodeResult && !!targetNodeResult) return _objectSpread(_objectSpread({}, item), {}, {
|
|
35
35
|
animated: targetNodeResult.nodeStatus === 'executing',
|
|
36
36
|
data: _objectSpread(_objectSpread({}, item.data), {}, {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
_sourceNodeStatus: sourceNodeResult.nodeStatus,
|
|
38
|
+
_targetNodeStatus: targetNodeResult.nodeStatus
|
|
39
39
|
})
|
|
40
40
|
});
|
|
41
41
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
42
42
|
animated: false,
|
|
43
43
|
data: _objectSpread(_objectSpread({}, item.data), {}, {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
_sourceNodeStatus: undefined,
|
|
45
|
+
_targetNodeStatus: undefined
|
|
46
46
|
})
|
|
47
47
|
});
|
|
48
48
|
});
|
|
@@ -56,8 +56,8 @@ export var useEdgesInteraction = function useEdgesInteraction() {
|
|
|
56
56
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
57
57
|
animated: false,
|
|
58
58
|
data: _objectSpread(_objectSpread({}, item.data), {}, {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
_sourceNodeStatus: undefined,
|
|
60
|
+
_targetNodeStatus: undefined
|
|
61
61
|
})
|
|
62
62
|
});
|
|
63
63
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { default as CodeInput } from './components/code-input';
|
|
|
7
7
|
export { operatorLabelRender } from './components/condition-item';
|
|
8
8
|
export { default as SourceHandle } from './components/custom-handle/source-handle';
|
|
9
9
|
export { default as TargetHandle } from './components/custom-handle/target-handle';
|
|
10
|
-
export { default as CustomInputsControl,
|
|
10
|
+
export { default as CustomInputsControl, VALUE_FROM_OPTIONS, VariableFormComp, VariableSelector, variableFromLabelRender, } from './components/custom-inputs-control';
|
|
11
11
|
export * from './components/custom-outputs-form';
|
|
12
12
|
export { default as DraggableWithHandle } from './components/draggable-with-handle';
|
|
13
13
|
export { default as DragPanel } from './components/drag-panel';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { default as CodeInput } from "./components/code-input";
|
|
|
6
6
|
export { operatorLabelRender } from "./components/condition-item";
|
|
7
7
|
export { default as SourceHandle } from "./components/custom-handle/source-handle";
|
|
8
8
|
export { default as TargetHandle } from "./components/custom-handle/target-handle";
|
|
9
|
-
export { default as CustomInputsControl,
|
|
9
|
+
export { default as CustomInputsControl, VALUE_FROM_OPTIONS, VariableFormComp, VariableSelector, variableFromLabelRender } from "./components/custom-inputs-control";
|
|
10
10
|
export * from "./components/custom-outputs-form";
|
|
11
11
|
export { default as DraggableWithHandle } from "./components/draggable-with-handle";
|
|
12
12
|
export { default as DragPanel } from "./components/drag-panel";
|
|
@@ -45,8 +45,8 @@ export interface IPointItem {
|
|
|
45
45
|
}
|
|
46
46
|
export interface IEdgeData {
|
|
47
47
|
_hover?: boolean;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
_sourceNodeStatus?: IWorkFlowStatus;
|
|
49
|
+
_targetNodeStatus?: IWorkFlowStatus;
|
|
50
50
|
}
|
|
51
51
|
export interface INodeDataOutputParamItem {
|
|
52
52
|
id?: string;
|
|
@@ -115,26 +115,26 @@ export interface IWorkFlowTaskResultItem {
|
|
|
115
115
|
nodeType: string;
|
|
116
116
|
nodeName: string;
|
|
117
117
|
nodeId: string;
|
|
118
|
-
|
|
118
|
+
nodeContent: string | IUserInputItem[];
|
|
119
119
|
nodeStatus: IWorkFlowStatus;
|
|
120
|
-
|
|
120
|
+
parentNodeId?: string;
|
|
121
121
|
}
|
|
122
122
|
export interface IWorkFlowNodeResultItem {
|
|
123
|
-
|
|
123
|
+
isBatch: boolean;
|
|
124
124
|
retry?: {
|
|
125
125
|
happened: boolean;
|
|
126
|
-
|
|
126
|
+
retryTimes: number;
|
|
127
127
|
};
|
|
128
128
|
input?: string;
|
|
129
129
|
output?: string;
|
|
130
130
|
usages?: {
|
|
131
131
|
promptTokens: number;
|
|
132
132
|
completionTokens: number;
|
|
133
|
-
|
|
133
|
+
totalTokens: number;
|
|
134
134
|
}[];
|
|
135
135
|
batches: IWorkFlowNodeResultItem[];
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
isMultiBranch: boolean;
|
|
137
|
+
multiBranchResults?: {
|
|
138
138
|
conditionId: string;
|
|
139
139
|
targetIds: string[];
|
|
140
140
|
}[];
|
|
@@ -142,20 +142,20 @@ export interface IWorkFlowNodeResultItem {
|
|
|
142
142
|
nodeName: string;
|
|
143
143
|
nodeType: string;
|
|
144
144
|
nodeStatus: IWorkFlowStatus;
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
parentNodeId?: string;
|
|
146
|
+
outputType: 'json' | 'text';
|
|
147
147
|
nodeExecTime: string;
|
|
148
|
-
|
|
148
|
+
tryCatch?: {
|
|
149
149
|
happened: boolean;
|
|
150
150
|
strategy: string;
|
|
151
151
|
};
|
|
152
|
-
|
|
152
|
+
shortMemory?: {
|
|
153
153
|
round: number;
|
|
154
|
-
|
|
154
|
+
currentSelfChatMessages: {
|
|
155
155
|
role?: string;
|
|
156
156
|
content?: any;
|
|
157
157
|
name?: string;
|
|
158
|
-
|
|
158
|
+
toolCalls?: Array<{
|
|
159
159
|
id: string;
|
|
160
160
|
type: string;
|
|
161
161
|
index: number;
|
|
@@ -168,7 +168,7 @@ export interface IWorkFlowNodeResultItem {
|
|
|
168
168
|
audio?: {
|
|
169
169
|
id: string;
|
|
170
170
|
data: string;
|
|
171
|
-
|
|
171
|
+
expiresAt: number;
|
|
172
172
|
transcript: string;
|
|
173
173
|
};
|
|
174
174
|
}[];
|
|
@@ -176,12 +176,12 @@ export interface IWorkFlowNodeResultItem {
|
|
|
176
176
|
errorInfo?: string;
|
|
177
177
|
}
|
|
178
178
|
export interface IWorkFlowTaskProcess {
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
taskId: string;
|
|
180
|
+
conversationId?: string;
|
|
181
181
|
requestId: string;
|
|
182
182
|
taskStatus: IWorkFlowStatus;
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
taskResults: IWorkFlowTaskResultItem[];
|
|
184
|
+
errorCode?: string;
|
|
185
185
|
errorInfo?: string;
|
|
186
186
|
taskExecTime: string;
|
|
187
187
|
nodeResults: IWorkFlowNodeResultItem[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentscope-ai/flow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A powerful and flexible flow canvas rendering engine designed for AI applications. Provides comprehensive workflow visualization and interaction capabilities for platforms like Bailian and AgentScope, enabling seamless creation and management of complex AI agent workflows with an intuitive drag-and-drop interface.",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|