@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.
@@ -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 { valueFrom_OPTIONS, variableFromLabelRender, VariableSelector } from "../custom-inputs-control";
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: valueFrom_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 valueFrom_OPTIONS: {
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 valueFrom_OPTIONS = [{
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: valueFrom_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._source_nodeStatus && edgeData._target_nodeStatus) {
67
- if (edgeData._source_nodeStatus === 'success' && edgeData._target_nodeStatus === 'success') {
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._source_nodeStatus === 'success' && edgeData._target_nodeStatus === 'fail') {
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._source_nodeStatus === 'success' || edgeData._source_nodeStatus === 'executing' && edgeData._target_nodeStatus === 'executing') {
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._source_nodeStatus === 'executing' && edgeData._target_nodeStatus === 'executing') return true;
139
- return edgeData._source_nodeStatus === 'success' && !((_ref2 = ['fail', 'success']) !== null && _ref2 !== void 0 && _ref2.includes(edgeData._target_nodeStatus || ''));
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._source_nodeStatus && edgeData._target_nodeStatus) {
143
- if (edgeData._source_nodeStatus === 'success' && edgeData._target_nodeStatus === 'success') {
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._source_nodeStatus === 'success' && edgeData._target_nodeStatus === 'fail') {
148
+ if (edgeData._sourceNodeStatus === 'success' && edgeData._targetNodeStatus === 'fail') {
149
149
  return {
150
150
  stroke: '#F23139'
151
151
  };
152
152
  }
153
- if (edgeData._source_nodeStatus === 'success') {
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._source_nodeStatus, edgeData._target_nodeStatus, antPrefix]);
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.is_batch && !!props.data.batches;
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
- _source_nodeStatus: sourceNodeResult.nodeStatus,
38
- _target_nodeStatus: targetNodeResult.nodeStatus
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
- _source_nodeStatus: undefined,
45
- _target_nodeStatus: undefined
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
- _source_nodeStatus: undefined,
60
- _target_nodeStatus: undefined
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, valueFrom_OPTIONS, VariableFormComp, VariableSelector, variableFromLabelRender, } from './components/custom-inputs-control';
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, valueFrom_OPTIONS, VariableFormComp, VariableSelector, variableFromLabelRender } from "./components/custom-inputs-control";
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
- _source_nodeStatus?: IWorkFlowStatus;
49
- _target_nodeStatus?: IWorkFlowStatus;
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
- node_content: string | IUserInputItem[];
118
+ nodeContent: string | IUserInputItem[];
119
119
  nodeStatus: IWorkFlowStatus;
120
- parent_nodeId?: string;
120
+ parentNodeId?: string;
121
121
  }
122
122
  export interface IWorkFlowNodeResultItem {
123
- is_batch: boolean;
123
+ isBatch: boolean;
124
124
  retry?: {
125
125
  happened: boolean;
126
- retry_times: number;
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
- total_tokens: number;
133
+ totalTokens: number;
134
134
  }[];
135
135
  batches: IWorkFlowNodeResultItem[];
136
- is_multi_branch: boolean;
137
- multi_branch_results?: {
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
- parent_nodeId?: string;
146
- output_type: 'json' | 'text';
145
+ parentNodeId?: string;
146
+ outputType: 'json' | 'text';
147
147
  nodeExecTime: string;
148
- try_catch?: {
148
+ tryCatch?: {
149
149
  happened: boolean;
150
150
  strategy: string;
151
151
  };
152
- short_memory?: {
152
+ shortMemory?: {
153
153
  round: number;
154
- current_self_chat_messages: {
154
+ currentSelfChatMessages: {
155
155
  role?: string;
156
156
  content?: any;
157
157
  name?: string;
158
- tool_calls?: Array<{
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
- expires_at: number;
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
- task_id: string;
180
- conversation_id?: string;
179
+ taskId: string;
180
+ conversationId?: string;
181
181
  requestId: string;
182
182
  taskStatus: IWorkFlowStatus;
183
- task_results: IWorkFlowTaskResultItem[];
184
- error_code?: string;
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.2",
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",