@agentscope-ai/flow 0.0.13 → 0.0.15

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.
@@ -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,15 @@ 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
+ }, $i18n.get({
125
+ id: 'spark-flow.components.VariableInput.index.fileTypeNotSupportManualInput',
126
+ dm: '文件类型不支持手动输入'
127
+ }));
120
128
  default:
121
129
  return null;
122
130
  }
@@ -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
+ }
@@ -116,6 +116,7 @@
116
116
  "spark-flow.components.VariableInput.index.select": "Select",
117
117
  "spark-flow.components.VariableInput.index.yes": "Yes",
118
118
  "spark-flow.components.VariableInput.index.no": "No",
119
+ "spark-flow.components.VariableInput.index.fileTypeNotSupportManualInput": "File type does not support manual input",
119
120
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.defaultValue": "Default Value",
120
121
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.defaultOutputWhenExceptionOccurs": "Specify Default Output When Exception Occurs",
121
122
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.exceptionBranch": "Exceptional Branch",
@@ -116,6 +116,7 @@
116
116
  "spark-flow.components.VariableInput.index.select": "選択してください",
117
117
  "spark-flow.components.VariableInput.index.yes": "はい",
118
118
  "spark-flow.components.VariableInput.index.no": "いいえ",
119
+ "spark-flow.components.VariableInput.index.fileTypeNotSupportManualInput": "ファイルタイプは手動入力をサポートしていません",
119
120
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.defaultValue": "デフォルト値",
120
121
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.defaultOutputWhenExceptionOccurs": "例外が発生した場合、デフォルトの出力内容を指定します",
121
122
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.exceptionBranch": "例外ブランチ",
@@ -116,6 +116,7 @@
116
116
  "spark-flow.components.VariableInput.index.select": "请选择",
117
117
  "spark-flow.components.VariableInput.index.yes": "是",
118
118
  "spark-flow.components.VariableInput.index.no": "否",
119
+ "spark-flow.components.VariableInput.index.fileTypeNotSupportManualInput": "文件类型不支持手动输入",
119
120
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.defaultValue": "默认值",
120
121
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.defaultOutputWhenExceptionOccurs": "当发生异常时,指定默认输出内容",
121
122
  "spark-flow.demos.spark-flow-1.components.ErrorCatchForm.index.exceptionBranch": "异常分支",
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.15",
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",