@agentscope-ai/flow 0.0.1
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/README.zh-CN.md +67 -0
- package/dist/components/base-node/index.d.ts +27 -0
- package/dist/components/base-node/index.js +320 -0
- package/dist/components/base-node/index.less +258 -0
- package/dist/components/branch-title-header/index.d.ts +12 -0
- package/dist/components/branch-title-header/index.js +176 -0
- package/dist/components/branch-title-header/index.less +28 -0
- package/dist/components/check-list-btn/index.d.ts +4 -0
- package/dist/components/check-list-btn/index.js +144 -0
- package/dist/components/check-list-btn/index.less +113 -0
- package/dist/components/code-input/index.d.ts +24 -0
- package/dist/components/code-input/index.js +356 -0
- package/dist/components/code-input/index.less +87 -0
- package/dist/components/condition-item/index.d.ts +13 -0
- package/dist/components/condition-item/index.js +185 -0
- package/dist/components/condition-item/index.less +23 -0
- package/dist/components/custom-connection-line/index.d.ts +4 -0
- package/dist/components/custom-connection-line/index.js +28 -0
- package/dist/components/custom-handle/source-handle.d.ts +10 -0
- package/dist/components/custom-handle/source-handle.js +45 -0
- package/dist/components/custom-handle/target-handle.d.ts +6 -0
- package/dist/components/custom-handle/target-handle.js +21 -0
- package/dist/components/custom-inputs-control/index.d.ts +56 -0
- package/dist/components/custom-inputs-control/index.js +366 -0
- package/dist/components/custom-inputs-control/index.less +28 -0
- package/dist/components/custom-outputs-form/index.d.ts +24 -0
- package/dist/components/custom-outputs-form/index.js +346 -0
- package/dist/components/custom-outputs-form/index.less +51 -0
- package/dist/components/drag-panel/index.d.ts +10 -0
- package/dist/components/drag-panel/index.js +79 -0
- package/dist/components/drag-panel/index.less +23 -0
- package/dist/components/draggable-with-handle/index.d.ts +13 -0
- package/dist/components/draggable-with-handle/index.js +81 -0
- package/dist/components/draggable-with-handle/index.less +23 -0
- package/dist/components/flow-aside/index.d.ts +4 -0
- package/dist/components/flow-aside/index.js +62 -0
- package/dist/components/flow-aside/index.less +84 -0
- package/dist/components/flow-base-edge/index.d.ts +5 -0
- package/dist/components/flow-base-edge/index.js +226 -0
- package/dist/components/flow-base-edge/index.less +28 -0
- package/dist/components/flow-base-edge/linear-gradient-svg.d.ts +21 -0
- package/dist/components/flow-base-edge/linear-gradient-svg.js +32 -0
- package/dist/components/flow-icon/index.d.ts +9 -0
- package/dist/components/flow-icon/index.js +30 -0
- package/dist/components/flow-icon/index.less +20 -0
- package/dist/components/flow-mini-map/index.d.ts +4 -0
- package/dist/components/flow-mini-map/index.js +26 -0
- package/dist/components/flow-mini-map/index.less +22 -0
- package/dist/components/flow-panel/config-panel.d.ts +15 -0
- package/dist/components/flow-panel/config-panel.js +303 -0
- package/dist/components/flow-panel/index.d.ts +7 -0
- package/dist/components/flow-panel/index.js +7 -0
- package/dist/components/flow-panel/index.less +85 -0
- package/dist/components/flow-panel/panel-container.d.ts +12 -0
- package/dist/components/flow-panel/panel-container.js +25 -0
- package/dist/components/flow-tools/add-node-btn.d.ts +3 -0
- package/dist/components/flow-tools/add-node-btn.js +26 -0
- package/dist/components/flow-tools/history-btn.d.ts +3 -0
- package/dist/components/flow-tools/history-btn.js +59 -0
- package/dist/components/flow-tools/index.d.ts +4 -0
- package/dist/components/flow-tools/index.js +29 -0
- package/dist/components/flow-tools/index.less +82 -0
- package/dist/components/flow-tools/layout-btn.d.ts +3 -0
- package/dist/components/flow-tools/layout-btn.js +27 -0
- package/dist/components/flow-tools/mini-map-btn.d.ts +3 -0
- package/dist/components/flow-tools/mini-map-btn.js +32 -0
- package/dist/components/flow-tools/scale-btn.d.ts +3 -0
- package/dist/components/flow-tools/scale-btn.js +101 -0
- package/dist/components/flow-tools/short-key-btn.d.ts +3 -0
- package/dist/components/flow-tools/short-key-btn.js +38 -0
- package/dist/components/flow-tools/short-key-content.d.ts +4 -0
- package/dist/components/flow-tools/short-key-content.js +153 -0
- package/dist/components/flow-tools/short-key-content.less +38 -0
- package/dist/components/flow-tools/touch-mode-btn.d.ts +3 -0
- package/dist/components/flow-tools/touch-mode-btn.js +89 -0
- package/dist/components/input-text-area/index.d.ts +16 -0
- package/dist/components/input-text-area/index.js +74 -0
- package/dist/components/input-text-area/index.less +30 -0
- package/dist/components/judge-form/index.d.ts +13 -0
- package/dist/components/judge-form/index.js +182 -0
- package/dist/components/judge-form/index.less +11 -0
- package/dist/components/node-menu/index.d.ts +35 -0
- package/dist/components/node-menu/index.js +266 -0
- package/dist/components/node-menu/index.less +79 -0
- package/dist/components/node-resizer/index.d.ts +11 -0
- package/dist/components/node-resizer/index.js +46 -0
- package/dist/components/node-resizer/index.less +12 -0
- package/dist/components/node-result-panel/index.d.ts +9 -0
- package/dist/components/node-result-panel/index.js +155 -0
- package/dist/components/node-result-panel/index.less +132 -0
- package/dist/components/node-tree/index.d.ts +4 -0
- package/dist/components/node-tree/index.js +213 -0
- package/dist/components/node-tree/index.less +51 -0
- package/dist/components/output-params-tree/index.d.ts +10 -0
- package/dist/components/output-params-tree/index.js +34 -0
- package/dist/components/output-params-tree/index.less +27 -0
- package/dist/components/script-code-mirror/index.d.ts +14 -0
- package/dist/components/script-code-mirror/index.js +162 -0
- package/dist/components/script-code-mirror/index.less +11 -0
- package/dist/components/script-edit-modal/index.d.ts +30 -0
- package/dist/components/script-edit-modal/index.js +84 -0
- package/dist/components/script-edit-modal/index.less +24 -0
- package/dist/components/select-with-desc/index.d.ts +5 -0
- package/dist/components/select-with-desc/index.js +20 -0
- package/dist/components/select-with-desc/index.less +11 -0
- package/dist/components/task-status/index.d.ts +4 -0
- package/dist/components/task-status/index.js +209 -0
- package/dist/components/task-status/index.less +65 -0
- package/dist/components/var-input-text-area/index.d.ts +17 -0
- package/dist/components/var-input-text-area/index.js +211 -0
- package/dist/components/var-input-text-area/index.less +64 -0
- package/dist/components/var-type-prefix/index.d.ts +17 -0
- package/dist/components/var-type-prefix/index.js +21 -0
- package/dist/components/variable-input/index.d.ts +24 -0
- package/dist/components/variable-input/index.js +163 -0
- package/dist/components/variable-input/index.less +13 -0
- package/dist/components/variable-tree-select/index.d.ts +33 -0
- package/dist/components/variable-tree-select/index.js +160 -0
- package/dist/components/variable-tree-select/index.less +61 -0
- package/dist/constant/index.d.ts +61 -0
- package/dist/constant/index.js +515 -0
- package/dist/flow/animate.css +5 -0
- package/dist/flow/context.d.ts +12 -0
- package/dist/flow/context.js +44 -0
- package/dist/flow/index.d.ts +13 -0
- package/dist/flow/index.js +162 -0
- package/dist/flow/index.less +72 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/use-edges-interaction.d.ts +11 -0
- package/dist/hooks/use-edges-interaction.js +125 -0
- package/dist/hooks/use-flow-debug-interaction.d.ts +5 -0
- package/dist/hooks/use-flow-debug-interaction.js +23 -0
- package/dist/hooks/use-flow-interaction.d.ts +12 -0
- package/dist/hooks/use-flow-interaction.js +173 -0
- package/dist/hooks/use-flow-key-press.d.ts +1 -0
- package/dist/hooks/use-flow-key-press.js +32 -0
- package/dist/hooks/use-flow-save.d.ts +5 -0
- package/dist/hooks/use-flow-save.js +47 -0
- package/dist/hooks/use-flow-view-port.d.ts +7 -0
- package/dist/hooks/use-flow-view-port.js +46 -0
- package/dist/hooks/use-history.d.ts +21 -0
- package/dist/hooks/use-history.js +80 -0
- package/dist/hooks/use-nodes-interaction.d.ts +34 -0
- package/dist/hooks/use-nodes-interaction.js +777 -0
- package/dist/hooks/use-nodes-output-params.d.ts +31 -0
- package/dist/hooks/use-nodes-output-params.js +300 -0
- package/dist/hooks/use-nodes-update.d.ts +9 -0
- package/dist/hooks/use-nodes-update.js +38 -0
- package/dist/hooks/use-work-flow.d.ts +4 -0
- package/dist/hooks/use-work-flow.js +21 -0
- package/dist/i18n/i18n.d.ts +62 -0
- package/dist/i18n/i18n.js +111 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.js +12 -0
- package/dist/i18n/locales/en-us.json +327 -0
- package/dist/i18n/locales/ja-jp.json +300 -0
- package/dist/i18n/locales/zh-cn.json +327 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +47 -0
- package/dist/index.less +1 -0
- package/dist/store/index.d.ts +70 -0
- package/dist/store/index.js +146 -0
- package/dist/tailwind.css +28 -0
- package/dist/types/work-flow.d.ts +188 -0
- package/dist/types/work-flow.js +1 -0
- package/dist/utils/default-values.d.ts +2 -0
- package/dist/utils/default-values.js +16 -0
- package/dist/utils/index.d.ts +39 -0
- package/dist/utils/index.js +273 -0
- package/dist/utils/unique-id.d.ts +2 -0
- package/dist/utils/unique-id.js +39 -0
- package/dist/utils/work-flow.d.ts +17 -0
- package/dist/utils/work-flow.js +44 -0
- package/package.json +78 -0
|
@@ -0,0 +1,146 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
import { debounce } from 'lodash-es';
|
|
8
|
+
import { createStore } from 'zustand/vanilla';
|
|
9
|
+
export var createWorkflowStore = function createWorkflowStore() {
|
|
10
|
+
var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
+
return createStore(function (set) {
|
|
12
|
+
return _objectSpread({
|
|
13
|
+
showResults: false,
|
|
14
|
+
setShowResults: function setShowResults(val) {
|
|
15
|
+
return set(function () {
|
|
16
|
+
return {
|
|
17
|
+
showResults: val
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
readyOnly: false,
|
|
22
|
+
setReadyOnly: function setReadyOnly(val) {
|
|
23
|
+
return set(function () {
|
|
24
|
+
return {
|
|
25
|
+
readyOnly: val
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
taskStore: void 0,
|
|
30
|
+
setTaskStore: function setTaskStore(val) {
|
|
31
|
+
return set(function () {
|
|
32
|
+
return {
|
|
33
|
+
taskStore: val
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
debounceSaveDraft: debounce(function (syncWorkflowDraft) {
|
|
38
|
+
syncWorkflowDraft();
|
|
39
|
+
}, 5000),
|
|
40
|
+
hiddenMenu: false,
|
|
41
|
+
setHiddenMenu: function setHiddenMenu(val) {
|
|
42
|
+
return set(function () {
|
|
43
|
+
return {
|
|
44
|
+
hiddenMenu: val
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
selectedNode: null,
|
|
49
|
+
setSelectedNode: function setSelectedNode(val) {
|
|
50
|
+
return set(function () {
|
|
51
|
+
return {
|
|
52
|
+
selectedNode: val
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
variableTree: [],
|
|
57
|
+
setVariableTree: function setVariableTree(val) {
|
|
58
|
+
return set(function () {
|
|
59
|
+
return {
|
|
60
|
+
variableTree: val
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
checkList: [],
|
|
65
|
+
setCheckList: function setCheckList(val) {
|
|
66
|
+
return set(function () {
|
|
67
|
+
return {
|
|
68
|
+
checkList: val
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
nodeSchemaMap: {},
|
|
73
|
+
setNodeSchema: function setNodeSchema(val) {
|
|
74
|
+
return set(function () {
|
|
75
|
+
return {
|
|
76
|
+
nodeSchemaMap: val
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
slots: {},
|
|
81
|
+
onChange: function onChange() {},
|
|
82
|
+
showSingleTest: false,
|
|
83
|
+
setShowSingleTest: function setShowSingleTest(val) {
|
|
84
|
+
return set(function () {
|
|
85
|
+
return {
|
|
86
|
+
showSingleTest: val
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
onAddCustomNode: function onAddCustomNode() {
|
|
91
|
+
return Promise.resolve(null);
|
|
92
|
+
},
|
|
93
|
+
showMiniMap: false,
|
|
94
|
+
setShowMiniMap: function setShowMiniMap(val) {
|
|
95
|
+
return set(function () {
|
|
96
|
+
return {
|
|
97
|
+
showMiniMap: val
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
futureSteps: [],
|
|
102
|
+
setFutureSteps: function setFutureSteps(val) {
|
|
103
|
+
return set(function () {
|
|
104
|
+
return {
|
|
105
|
+
futureSteps: val
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
historySteps: [],
|
|
110
|
+
setHistorySteps: function setHistorySteps(val) {
|
|
111
|
+
return set(function () {
|
|
112
|
+
return {
|
|
113
|
+
historySteps: val
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
minMaxZoom: [0.1, 2],
|
|
118
|
+
interactiveMode: localStorage.getItem('spark-flow-interactive-mode') || 'mouse',
|
|
119
|
+
setInteractiveMode: function setInteractiveMode(val) {
|
|
120
|
+
localStorage.setItem('spark-flow-interactive-mode', val);
|
|
121
|
+
set(function () {
|
|
122
|
+
return {
|
|
123
|
+
interactiveMode: val
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
isDragging: false,
|
|
128
|
+
setIsDragging: function setIsDragging(val) {
|
|
129
|
+
return set(function () {
|
|
130
|
+
return {
|
|
131
|
+
isDragging: val
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
showCheckList: false,
|
|
136
|
+
setShowCheckList: function setShowCheckList(val) {
|
|
137
|
+
return set(function () {
|
|
138
|
+
return {
|
|
139
|
+
showCheckList: val
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
debounceChangeTimeout: 300
|
|
144
|
+
}, initialState);
|
|
145
|
+
});
|
|
146
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
/* 不引入 base (reset) 样式,避免与项目现有样式冲突 */
|
|
3
|
+
|
|
4
|
+
/* @tailwind base; */
|
|
5
|
+
@tailwind components;
|
|
6
|
+
@tailwind utilities;
|
|
7
|
+
|
|
8
|
+
@layer components {
|
|
9
|
+
.flex-justify-between {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.flex-center {
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.full-center {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { IVarTreeItem } from "../components/variable-tree-select";
|
|
2
|
+
import { SparkIconProps } from '@agentscope-ai/icons/src/utils';
|
|
3
|
+
import { Node } from '@xyflow/react';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
export type INodeProps = {
|
|
6
|
+
id: string;
|
|
7
|
+
data: IWorkFlowNodeData;
|
|
8
|
+
};
|
|
9
|
+
export interface INodeSchema {
|
|
10
|
+
type: string;
|
|
11
|
+
iconType: (props: SparkIconProps) => ReactNode;
|
|
12
|
+
title: string;
|
|
13
|
+
desc: string;
|
|
14
|
+
defaultParams: Omit<IWorkFlowNodeData, 'label'>;
|
|
15
|
+
isSystem?: boolean;
|
|
16
|
+
allowSingleTest?: boolean;
|
|
17
|
+
allowSourceNodeTypes?: string[];
|
|
18
|
+
allowTargetNodeTypes?: string[];
|
|
19
|
+
disableConnectSource?: boolean;
|
|
20
|
+
disableConnectTarget?: boolean;
|
|
21
|
+
defaultHeight?: number;
|
|
22
|
+
checkValid?: (data: IWorkFlowNodeData) => {
|
|
23
|
+
label: string;
|
|
24
|
+
error: string;
|
|
25
|
+
}[];
|
|
26
|
+
getRefVariables?: (data: IWorkFlowNodeData) => string[];
|
|
27
|
+
getParentNodeVariableList?: (data: IWorkFlowNode, options?: {
|
|
28
|
+
disableShowVariableParameters?: boolean;
|
|
29
|
+
}) => IVarTreeItem[];
|
|
30
|
+
groupLabel?: string;
|
|
31
|
+
bgColor: string;
|
|
32
|
+
customAdd?: boolean;
|
|
33
|
+
hideInMenu?: boolean;
|
|
34
|
+
/** Whether configuration is prohibited */
|
|
35
|
+
notAllowConfig?: boolean;
|
|
36
|
+
/** Whether it is a group node */
|
|
37
|
+
isGroup?: boolean;
|
|
38
|
+
/** Whether it is prohibited to appear on group nodes, if is a string array, it means the node type is prohibited to appear on the specified group nodes */
|
|
39
|
+
disableInGroup?: boolean | string[];
|
|
40
|
+
}
|
|
41
|
+
export interface IPointItem {
|
|
42
|
+
type: string;
|
|
43
|
+
id: string;
|
|
44
|
+
handleId: string;
|
|
45
|
+
}
|
|
46
|
+
export interface IEdgeData {
|
|
47
|
+
_hover?: boolean;
|
|
48
|
+
_source_node_status?: IWorkFlowStatus;
|
|
49
|
+
_target_node_status?: IWorkFlowStatus;
|
|
50
|
+
}
|
|
51
|
+
export interface INodeDataOutputParamItem {
|
|
52
|
+
id?: string;
|
|
53
|
+
key: string;
|
|
54
|
+
type?: IValueType;
|
|
55
|
+
desc?: string;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
value_from?: 'refer' | 'input' | 'clear';
|
|
58
|
+
properties?: INodeDataOutputParamItem[];
|
|
59
|
+
}
|
|
60
|
+
export interface INodeDataInputParamItem {
|
|
61
|
+
id?: string;
|
|
62
|
+
key: string;
|
|
63
|
+
type?: IValueType;
|
|
64
|
+
value?: string;
|
|
65
|
+
value_from?: 'refer' | 'input' | 'clear';
|
|
66
|
+
/** Whether the parameter is required */
|
|
67
|
+
required?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export type IWorkFlowNodeData<T = any> = {
|
|
70
|
+
label: string;
|
|
71
|
+
input_params: INodeDataInputParamItem[];
|
|
72
|
+
output_params: INodeDataOutputParamItem[];
|
|
73
|
+
node_param: T;
|
|
74
|
+
desc?: string;
|
|
75
|
+
};
|
|
76
|
+
export interface IConditionItem {
|
|
77
|
+
operator?: string;
|
|
78
|
+
left: Omit<INodeDataInputParamItem, 'key'>;
|
|
79
|
+
right: Omit<INodeDataInputParamItem, 'key'>;
|
|
80
|
+
}
|
|
81
|
+
export interface IBranchItem {
|
|
82
|
+
id: string;
|
|
83
|
+
label: string;
|
|
84
|
+
logic?: 'and' | 'or';
|
|
85
|
+
conditions?: IConditionItem[];
|
|
86
|
+
}
|
|
87
|
+
export interface ICheckListItem {
|
|
88
|
+
node_id: string;
|
|
89
|
+
node_type: string;
|
|
90
|
+
node_name: string;
|
|
91
|
+
error_msgs: {
|
|
92
|
+
label: string;
|
|
93
|
+
error: string;
|
|
94
|
+
}[];
|
|
95
|
+
}
|
|
96
|
+
export interface IWorkFlowNode extends Node<IWorkFlowNodeData> {
|
|
97
|
+
type: string;
|
|
98
|
+
}
|
|
99
|
+
export type IValueType = 'Array<Object>' | 'Array<File>' | 'Array<String>' | 'Array<Number>' | 'Array<Boolean>' | 'Object' | 'File' | 'String' | 'Number' | 'Boolean';
|
|
100
|
+
export type IValueTypeOption = {
|
|
101
|
+
label: string;
|
|
102
|
+
value: IValueType | 'Array';
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
children?: IValueTypeOption[];
|
|
105
|
+
};
|
|
106
|
+
export type IWorkFlowStatus = 'wait' | 'success' | 'fail' | 'skip' | 'executing' | 'stop';
|
|
107
|
+
export interface IUserInputItem {
|
|
108
|
+
key: string;
|
|
109
|
+
type: IValueType;
|
|
110
|
+
desc: string;
|
|
111
|
+
value?: string;
|
|
112
|
+
required?: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface IWorkFlowTaskResultItem {
|
|
115
|
+
node_type: string;
|
|
116
|
+
node_name: string;
|
|
117
|
+
node_id: string;
|
|
118
|
+
node_content: string | IUserInputItem[];
|
|
119
|
+
node_status: IWorkFlowStatus;
|
|
120
|
+
parent_node_id?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface IWorkFlowNodeResultItem {
|
|
123
|
+
is_batch: boolean;
|
|
124
|
+
retry?: {
|
|
125
|
+
happened: boolean;
|
|
126
|
+
retry_times: number;
|
|
127
|
+
};
|
|
128
|
+
input?: string;
|
|
129
|
+
output?: string;
|
|
130
|
+
usages?: {
|
|
131
|
+
prompt_tokens: number;
|
|
132
|
+
completion_tokens: number;
|
|
133
|
+
total_tokens: number;
|
|
134
|
+
}[];
|
|
135
|
+
batches: IWorkFlowNodeResultItem[];
|
|
136
|
+
is_multi_branch: boolean;
|
|
137
|
+
multi_branch_results?: {
|
|
138
|
+
condition_id: string;
|
|
139
|
+
target_ids: string[];
|
|
140
|
+
}[];
|
|
141
|
+
node_id: string;
|
|
142
|
+
node_name: string;
|
|
143
|
+
node_type: string;
|
|
144
|
+
node_status: IWorkFlowStatus;
|
|
145
|
+
parent_node_id?: string;
|
|
146
|
+
output_type: 'json' | 'text';
|
|
147
|
+
node_exec_time: string;
|
|
148
|
+
try_catch?: {
|
|
149
|
+
happened: boolean;
|
|
150
|
+
strategy: string;
|
|
151
|
+
};
|
|
152
|
+
short_memory?: {
|
|
153
|
+
round: number;
|
|
154
|
+
current_self_chat_messages: {
|
|
155
|
+
role?: string;
|
|
156
|
+
content?: any;
|
|
157
|
+
name?: string;
|
|
158
|
+
tool_calls?: Array<{
|
|
159
|
+
id: string;
|
|
160
|
+
type: string;
|
|
161
|
+
index: number;
|
|
162
|
+
function: {
|
|
163
|
+
name: string;
|
|
164
|
+
arguments: string;
|
|
165
|
+
outputs: string;
|
|
166
|
+
};
|
|
167
|
+
}>;
|
|
168
|
+
audio?: {
|
|
169
|
+
id: string;
|
|
170
|
+
data: string;
|
|
171
|
+
expires_at: number;
|
|
172
|
+
transcript: string;
|
|
173
|
+
};
|
|
174
|
+
}[];
|
|
175
|
+
};
|
|
176
|
+
error_info?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface IWorkFlowTaskProcess {
|
|
179
|
+
task_id: string;
|
|
180
|
+
conversation_id?: string;
|
|
181
|
+
request_id: string;
|
|
182
|
+
task_status: IWorkFlowStatus;
|
|
183
|
+
task_results: IWorkFlowTaskResultItem[];
|
|
184
|
+
error_code?: string;
|
|
185
|
+
error_info?: string;
|
|
186
|
+
task_exec_time: string;
|
|
187
|
+
node_results: IWorkFlowNodeResultItem[];
|
|
188
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export var defaultValueMap = {
|
|
2
|
+
String: '',
|
|
3
|
+
Number: '0',
|
|
4
|
+
Boolean: 'false',
|
|
5
|
+
Object: JSON.stringify({
|
|
6
|
+
key: 'value'
|
|
7
|
+
}, null, 2),
|
|
8
|
+
File: '',
|
|
9
|
+
'Array<Object>': JSON.stringify([{
|
|
10
|
+
key: 'value'
|
|
11
|
+
}], null, 2),
|
|
12
|
+
'Array<String>': JSON.stringify([''], null, 2),
|
|
13
|
+
'Array<Number>': JSON.stringify([0], null, 2),
|
|
14
|
+
'Array<Boolean>': JSON.stringify([false], null, 2),
|
|
15
|
+
'Array<File>': JSON.stringify([], null, 2)
|
|
16
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IVarItem } from "../components/variable-tree-select";
|
|
2
|
+
import { IWorkFlowNode } from "../types/work-flow";
|
|
3
|
+
import { Connection, Edge, Node } from '@xyflow/react';
|
|
4
|
+
export declare const generateEdge: (connection: Connection, isParent?: boolean) => {
|
|
5
|
+
id: string;
|
|
6
|
+
type: string;
|
|
7
|
+
source: string;
|
|
8
|
+
target: string;
|
|
9
|
+
sourceHandle: string | null;
|
|
10
|
+
targetHandle: string | null;
|
|
11
|
+
zIndex: number;
|
|
12
|
+
data: {};
|
|
13
|
+
};
|
|
14
|
+
export declare function splitAtFirstDigit(str: string): string[];
|
|
15
|
+
export declare const generateUniqueName: (name: string, names: string[]) => string;
|
|
16
|
+
export declare const getTypeFromId: (source: string) => string;
|
|
17
|
+
export declare function isMacOS(): boolean;
|
|
18
|
+
export declare const MAC_KEY_MAP: {
|
|
19
|
+
ctrl: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function transformToMacKey(key: keyof typeof MAC_KEY_MAP): string;
|
|
22
|
+
export declare function extractVariables(text: string, saveFormat?: boolean): string[];
|
|
23
|
+
export declare const getIteratorNodeSize: (childrenNodes: Node[]) => {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const layoutFlow: ({ nodes, edges, isSubFlow, }: {
|
|
28
|
+
nodes: Node[];
|
|
29
|
+
edges: Edge[];
|
|
30
|
+
isSubFlow?: boolean | undefined;
|
|
31
|
+
}) => Promise<{
|
|
32
|
+
layoutedNodes: Node[];
|
|
33
|
+
}>;
|
|
34
|
+
export declare const getParentInputParams: (node: IWorkFlowNode) => IVarItem[];
|
|
35
|
+
export declare const copyNodeConfig: (node: IWorkFlowNode, nodes: IWorkFlowNode[]) => IWorkFlowNode;
|
|
36
|
+
export declare const copySubFlowNodeConfig: (node: IWorkFlowNode, nodes: IWorkFlowNode[]) => IWorkFlowNode;
|
|
37
|
+
export declare const isEventInInput: (event: KeyboardEvent) => boolean;
|
|
38
|
+
export declare const setWorkFlowLanguage: (language: string) => void;
|
|
39
|
+
export declare const matchVariableFromVarItem: (variable: string, varItems: IVarItem[]) => IVarItem | undefined;
|