@agentscope-ai/flow 0.0.13 → 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.
@@ -10,10 +10,6 @@ interface IProps extends NodeProps<IWorkFlowNode> {
10
10
  disableAction?: boolean;
11
11
  className?: string;
12
12
  hasFailBranch?: boolean;
13
- slots?: {
14
- label?: React.ReactNode;
15
- afterLabel?: React.ReactNode;
16
- };
17
13
  }
18
14
  export declare const NodeStatusIcon: React.MemoExoticComponent<({ status }: {
19
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, _props$slots2;
68
67
  var containerRef = useRef(null);
69
68
  var taskStore = useStore(function (store) {
70
69
  return store.taskStore;
@@ -175,12 +174,12 @@ function BaseNode(props) {
175
174
  className: "flex gap-[8px] items-center flex-1"
176
175
  }, /*#__PURE__*/React.createElement(FlowIcon, {
177
176
  nodeType: props.type
178
- }), !!((_props$slots = props.slots) !== null && _props$slots !== void 0 && _props$slots.label) ? props.slots.label : /*#__PURE__*/React.createElement(Typography.Text, {
177
+ }), /*#__PURE__*/React.createElement(Typography.Text, {
179
178
  ellipsis: {
180
179
  tooltip: true
181
180
  },
182
181
  className: "spark-flow-node-label flex-1 w-1"
183
- }, props.data.label), !!((_props$slots2 = props.slots) !== null && _props$slots2 !== void 0 && _props$slots2.afterLabel) && props.slots.afterLabel), !!nodeResult && showResults ? /*#__PURE__*/React.createElement(NodeStatusIcon, {
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
- disabledTypes: props.disabledTypes,
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
- list.push(_objectSpread(_objectSpread({}, item), {}, {
57
- children: (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.filter(function (child) {
58
- return enabledTypes.includes(child.value);
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
- // 黑名单策略:如果没有设置enabledTypes,使用disabledTypes
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
- list.push(_objectSpread(_objectSpread({}, item), {}, {
69
- children: (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.filter(function (child) {
70
- return !disabledTypes.includes(child.value);
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.13",
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",