@agentscope-ai/flow 0.0.12 → 0.0.14
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/base-node/index.d.ts +0 -3
- package/dist/components/base-node/index.js +1 -2
- package/dist/components/custom-inputs-control/index.js +6 -4
- package/dist/components/custom-outputs-form/index.js +32 -16
- package/dist/components/variable-input/index.js +9 -4
- package/dist/components/variable-input/index.less +7 -1
- package/package.json +1 -1
|
@@ -10,9 +10,6 @@ interface IProps extends NodeProps<IWorkFlowNode> {
|
|
|
10
10
|
disableAction?: boolean;
|
|
11
11
|
className?: string;
|
|
12
12
|
hasFailBranch?: boolean;
|
|
13
|
-
slots?: {
|
|
14
|
-
afterLabel?: React.ReactNode;
|
|
15
|
-
};
|
|
16
13
|
}
|
|
17
14
|
export declare const NodeStatusIcon: React.MemoExoticComponent<({ status }: {
|
|
18
15
|
status: IWorkFlowStatus;
|
|
@@ -64,7 +64,6 @@ export var NodeStatusIcon = /*#__PURE__*/memo(function (_ref) {
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
function BaseNode(props) {
|
|
67
|
-
var _props$slots;
|
|
68
67
|
var containerRef = useRef(null);
|
|
69
68
|
var taskStore = useStore(function (store) {
|
|
70
69
|
return store.taskStore;
|
|
@@ -180,7 +179,7 @@ function BaseNode(props) {
|
|
|
180
179
|
tooltip: true
|
|
181
180
|
},
|
|
182
181
|
className: "spark-flow-node-label flex-1 w-1"
|
|
183
|
-
}, props.data.label)
|
|
182
|
+
}, props.data.label)), !!nodeResult && showResults ? /*#__PURE__*/React.createElement(NodeStatusIcon, {
|
|
184
183
|
status: nodeResult.nodeStatus
|
|
185
184
|
}) : props.disableAction ? null : /*#__PURE__*/React.createElement("div", {
|
|
186
185
|
onClick: function onClick(e) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
2
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
8
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -196,8 +196,10 @@ export var VariableFormComp = /*#__PURE__*/memo(function (props) {
|
|
|
196
196
|
}));
|
|
197
197
|
}
|
|
198
198
|
return /*#__PURE__*/React.createElement(VariableInput, {
|
|
199
|
-
enabledTypes: props.enabledTypes
|
|
200
|
-
|
|
199
|
+
enabledTypes: props.enabledTypes ? props.enabledTypes.filter(function (type) {
|
|
200
|
+
return type !== 'File' && type !== 'Array<File>';
|
|
201
|
+
}) : undefined,
|
|
202
|
+
disabledTypes: [].concat(_toConsumableArray(props.disabledTypes || []), ['File', 'Array<File>']),
|
|
201
203
|
disabled: props.disabled,
|
|
202
204
|
value: props.data.value,
|
|
203
205
|
type: props.data.type,
|
|
@@ -47,29 +47,45 @@ export var VariableTypeSelect = /*#__PURE__*/memo(function (props) {
|
|
|
47
47
|
return VALUE_TYPE_OPTIONS;
|
|
48
48
|
}
|
|
49
49
|
var list = [];
|
|
50
|
-
|
|
51
|
-
// 白名单优先:如果设置了enabledTypes,只有在白名单中的类型才可用
|
|
52
50
|
if (enabledTypes && enabledTypes.length > 0) {
|
|
51
|
+
// 白名单优先:如果设置了enabledTypes,只有在白名单中的类型才可用
|
|
53
52
|
VALUE_TYPE_OPTIONS.forEach(function (item) {
|
|
54
53
|
var _item$children;
|
|
55
|
-
if (!enabledTypes.includes(item.value)) return;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
if (!enabledTypes.includes(item.value) && item.value !== 'Array') return;
|
|
55
|
+
var children = (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.filter(function (child) {
|
|
56
|
+
return enabledTypes.includes(child.value);
|
|
57
|
+
});
|
|
58
|
+
if (item.value === 'Array') {
|
|
59
|
+
if (children !== null && children !== void 0 && children.length) {
|
|
60
|
+
list.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
61
|
+
children: children
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
list.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
66
|
+
children: children
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
61
69
|
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
else if (disabledTypes && disabledTypes.length > 0) {
|
|
70
|
+
} else if (disabledTypes && disabledTypes.length > 0) {
|
|
71
|
+
// 黑名单策略:如果没有设置enabledTypes,使用disabledTypes
|
|
65
72
|
VALUE_TYPE_OPTIONS.forEach(function (item) {
|
|
66
73
|
var _item$children2;
|
|
67
74
|
if (disabledTypes.includes(item.value)) return;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
var children = (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.filter(function (child) {
|
|
76
|
+
return !disabledTypes.includes(child.value);
|
|
77
|
+
});
|
|
78
|
+
if (item.value === 'Array') {
|
|
79
|
+
if (children !== null && children !== void 0 && children.length) {
|
|
80
|
+
list.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
81
|
+
children: children
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
list.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
86
|
+
children: children
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
73
89
|
});
|
|
74
90
|
}
|
|
75
91
|
return list;
|
|
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import $i18n from "../../i18n";
|
|
8
8
|
import { defaultValueMap } from "../../utils/default-values";
|
|
9
|
-
import { Input, InputNumber, Select, Space } from 'antd';
|
|
9
|
+
import { Flex, Input, InputNumber, Select, Space } from 'antd';
|
|
10
10
|
import React, { memo, useMemo } from 'react';
|
|
11
11
|
import CodeInput from "../code-input";
|
|
12
12
|
import { VariableTypeSelect } from "../custom-outputs-form";
|
|
@@ -99,11 +99,10 @@ export var VariableBaseInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
99
99
|
case 'Array<String>':
|
|
100
100
|
case 'Array<Number>':
|
|
101
101
|
case 'Array<Boolean>':
|
|
102
|
-
case 'File':
|
|
103
|
-
case 'Array<File>':
|
|
104
102
|
return /*#__PURE__*/React.createElement(CodeInput, {
|
|
105
103
|
style: _objectSpread({
|
|
106
|
-
overflow: 'auto'
|
|
104
|
+
overflow: 'auto',
|
|
105
|
+
height: '100%'
|
|
107
106
|
}, style),
|
|
108
107
|
className: className,
|
|
109
108
|
isCompact: isCompact,
|
|
@@ -117,6 +116,12 @@ export var VariableBaseInput = /*#__PURE__*/memo(function (_ref) {
|
|
|
117
116
|
},
|
|
118
117
|
onErrorChange: onErrorChange
|
|
119
118
|
});
|
|
119
|
+
case 'File':
|
|
120
|
+
case 'Array<File>':
|
|
121
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
122
|
+
align: "center",
|
|
123
|
+
className: "spark-flow-variable-input-file-tip"
|
|
124
|
+
}, "\u6587\u4EF6\u7C7B\u578B\u4E0D\u652F\u6301\u624B\u52A8\u8F93\u5165");
|
|
120
125
|
default:
|
|
121
126
|
return null;
|
|
122
127
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import '../../index.less';
|
|
2
2
|
|
|
3
|
-
.variable-input-container {
|
|
3
|
+
.spark-flow-variable-input-container {
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: stretch;
|
|
6
6
|
|
|
@@ -8,3 +8,9 @@
|
|
|
8
8
|
background-color: e('var(--@{ant-prefix}-color-bg-layout)');
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
.spark-flow-variable-input-file-tip {
|
|
13
|
+
height: 100%;
|
|
14
|
+
padding: 0 12px;
|
|
15
|
+
color: e('var(--@{ant-prefix}-color-text-secondary)');
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentscope-ai/flow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
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",
|