@datatechsolutions/ui 2.7.114 → 2.7.115
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/workflow/index.d.mts +40 -19
- package/dist/workflow/index.d.ts +40 -19
- package/dist/workflow/index.js +149 -86
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/index.mjs +149 -87
- package/dist/workflow/index.mjs.map +1 -1
- package/dist/workflow/workflow-canvas.js +117 -62
- package/dist/workflow/workflow-canvas.js.map +1 -1
- package/dist/workflow/workflow-canvas.mjs +117 -62
- package/dist/workflow/workflow-canvas.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -254,6 +254,48 @@ var useWorkflowStore = create((set, get) => ({
|
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
}));
|
|
257
|
+
var useDrawerStore = create((set) => ({
|
|
258
|
+
activeDrawer: null,
|
|
259
|
+
agentData: null,
|
|
260
|
+
subworkflowData: null,
|
|
261
|
+
logicNodeData: null,
|
|
262
|
+
pipelineSettingsData: null,
|
|
263
|
+
openAgentDrawer: (agent, models, isCreateMode = false) => set({
|
|
264
|
+
activeDrawer: "agent",
|
|
265
|
+
agentData: { agent, models, isCreateMode },
|
|
266
|
+
subworkflowData: null,
|
|
267
|
+
logicNodeData: null,
|
|
268
|
+
pipelineSettingsData: null
|
|
269
|
+
}),
|
|
270
|
+
openSubworkflowDrawer: (tool) => set({
|
|
271
|
+
activeDrawer: "subworkflow",
|
|
272
|
+
subworkflowData: { tool },
|
|
273
|
+
agentData: null,
|
|
274
|
+
logicNodeData: null,
|
|
275
|
+
pipelineSettingsData: null
|
|
276
|
+
}),
|
|
277
|
+
openLogicNodeDrawer: (nodeId, nodeLabel, config) => set({
|
|
278
|
+
activeDrawer: "logic-node",
|
|
279
|
+
logicNodeData: { nodeId, nodeLabel, config },
|
|
280
|
+
agentData: null,
|
|
281
|
+
subworkflowData: null,
|
|
282
|
+
pipelineSettingsData: null
|
|
283
|
+
}),
|
|
284
|
+
openPipelineSettingsDrawer: (name, description) => set({
|
|
285
|
+
activeDrawer: "pipeline-settings",
|
|
286
|
+
pipelineSettingsData: { name, description },
|
|
287
|
+
agentData: null,
|
|
288
|
+
subworkflowData: null,
|
|
289
|
+
logicNodeData: null
|
|
290
|
+
}),
|
|
291
|
+
closeDrawer: () => set({
|
|
292
|
+
activeDrawer: null,
|
|
293
|
+
agentData: null,
|
|
294
|
+
subworkflowData: null,
|
|
295
|
+
logicNodeData: null,
|
|
296
|
+
pipelineSettingsData: null
|
|
297
|
+
})
|
|
298
|
+
}));
|
|
257
299
|
var GRAPH_ACTIVE_EDGE_COLOR = "#14b8a6";
|
|
258
300
|
var GRAPH_TRUE_EDGE_COLOR = "#22c55e";
|
|
259
301
|
var GRAPH_FALSE_EDGE_COLOR = "#ef4444";
|
|
@@ -8131,8 +8173,15 @@ var NODE_TITLE_KEYS = {
|
|
|
8131
8173
|
entity: "entityNodeConfig",
|
|
8132
8174
|
group: "groupNodeConfig"
|
|
8133
8175
|
};
|
|
8134
|
-
function LogicNodeDrawer({
|
|
8176
|
+
function LogicNodeDrawer({ onSave, entities = [] }) {
|
|
8135
8177
|
const t = useTranslations("agents.workflow");
|
|
8178
|
+
const activeDrawer = useDrawerStore((s) => s.activeDrawer);
|
|
8179
|
+
const logicNodeData = useDrawerStore((s) => s.logicNodeData);
|
|
8180
|
+
const closeDrawer = useDrawerStore((s) => s.closeDrawer);
|
|
8181
|
+
const open = activeDrawer === "logic-node";
|
|
8182
|
+
const nodeId = logicNodeData?.nodeId ?? null;
|
|
8183
|
+
const nodeLabel = logicNodeData?.nodeLabel ?? "";
|
|
8184
|
+
const config = logicNodeData?.config ?? null;
|
|
8136
8185
|
if (!config || !nodeId) return null;
|
|
8137
8186
|
const entityMasterId = config.type === "entity" ? config.entityMasterId : void 0;
|
|
8138
8187
|
const IconComponent = entityMasterId ? getEntityIcon(entityMasterId) : LOGIC_ICON_MAP[config.type];
|
|
@@ -8145,41 +8194,41 @@ function LogicNodeDrawer({ nodeId, nodeLabel, config, open, onClose, onSave, ent
|
|
|
8145
8194
|
const renderForm = () => {
|
|
8146
8195
|
switch (config.type) {
|
|
8147
8196
|
case "start":
|
|
8148
|
-
return /* @__PURE__ */ jsx(StartNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8197
|
+
return /* @__PURE__ */ jsx(StartNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8149
8198
|
case "end":
|
|
8150
|
-
return /* @__PURE__ */ jsx(EndNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8199
|
+
return /* @__PURE__ */ jsx(EndNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8151
8200
|
case "if_else":
|
|
8152
|
-
return /* @__PURE__ */ jsx(IfElseNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8201
|
+
return /* @__PURE__ */ jsx(IfElseNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8153
8202
|
case "code":
|
|
8154
|
-
return /* @__PURE__ */ jsx(CodeNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8203
|
+
return /* @__PURE__ */ jsx(CodeNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8155
8204
|
case "http_request":
|
|
8156
|
-
return /* @__PURE__ */ jsx(HttpRequestNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8205
|
+
return /* @__PURE__ */ jsx(HttpRequestNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8157
8206
|
case "template_transform":
|
|
8158
|
-
return /* @__PURE__ */ jsx(TemplateTransformNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8207
|
+
return /* @__PURE__ */ jsx(TemplateTransformNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8159
8208
|
case "iteration":
|
|
8160
|
-
return /* @__PURE__ */ jsx(IterationNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8209
|
+
return /* @__PURE__ */ jsx(IterationNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8161
8210
|
case "knowledge_base":
|
|
8162
|
-
return /* @__PURE__ */ jsx(KnowledgeBaseNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8211
|
+
return /* @__PURE__ */ jsx(KnowledgeBaseNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8163
8212
|
case "answer":
|
|
8164
|
-
return /* @__PURE__ */ jsx(AnswerNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8213
|
+
return /* @__PURE__ */ jsx(AnswerNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8165
8214
|
case "question_classifier":
|
|
8166
|
-
return /* @__PURE__ */ jsx(QuestionClassifierNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8215
|
+
return /* @__PURE__ */ jsx(QuestionClassifierNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8167
8216
|
case "parameter_extractor":
|
|
8168
|
-
return /* @__PURE__ */ jsx(ParameterExtractorNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8217
|
+
return /* @__PURE__ */ jsx(ParameterExtractorNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8169
8218
|
case "variable_assigner":
|
|
8170
|
-
return /* @__PURE__ */ jsx(VariableAssignerNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8219
|
+
return /* @__PURE__ */ jsx(VariableAssignerNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8171
8220
|
case "variable_aggregator":
|
|
8172
|
-
return /* @__PURE__ */ jsx(VariableAggregatorNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8221
|
+
return /* @__PURE__ */ jsx(VariableAggregatorNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8173
8222
|
case "document_extractor":
|
|
8174
|
-
return /* @__PURE__ */ jsx(DocumentExtractorNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8223
|
+
return /* @__PURE__ */ jsx(DocumentExtractorNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8175
8224
|
case "list_operator":
|
|
8176
|
-
return /* @__PURE__ */ jsx(ListOperatorNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8225
|
+
return /* @__PURE__ */ jsx(ListOperatorNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8177
8226
|
case "iteration_start":
|
|
8178
|
-
return /* @__PURE__ */ jsx(IterationStartNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8227
|
+
return /* @__PURE__ */ jsx(IterationStartNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8179
8228
|
case "entity":
|
|
8180
|
-
return /* @__PURE__ */ jsx(EntityNodeConfigForm, { config, entities, onSave: handleSave, onCancel:
|
|
8229
|
+
return /* @__PURE__ */ jsx(EntityNodeConfigForm, { config, entities, onSave: handleSave, onCancel: closeDrawer });
|
|
8181
8230
|
case "group":
|
|
8182
|
-
return /* @__PURE__ */ jsx(GroupNodeConfigForm, { config, onSave: handleSave, onCancel:
|
|
8231
|
+
return /* @__PURE__ */ jsx(GroupNodeConfigForm, { config, onSave: handleSave, onCancel: closeDrawer });
|
|
8183
8232
|
default:
|
|
8184
8233
|
return null;
|
|
8185
8234
|
}
|
|
@@ -8188,7 +8237,7 @@ function LogicNodeDrawer({ nodeId, nodeLabel, config, open, onClose, onSave, ent
|
|
|
8188
8237
|
WorkspaceDrawer,
|
|
8189
8238
|
{
|
|
8190
8239
|
open,
|
|
8191
|
-
onClose,
|
|
8240
|
+
onClose: closeDrawer,
|
|
8192
8241
|
title,
|
|
8193
8242
|
subtitle: nodeLabel,
|
|
8194
8243
|
icon: IconComponent ? /* @__PURE__ */ jsx(IconComponent, { className: "h-5 w-5 text-white" }) : void 0,
|
|
@@ -8617,23 +8666,26 @@ function WorkflowCanvasInner({
|
|
|
8617
8666
|
isCreatingAgent = false,
|
|
8618
8667
|
nodeTypes: externalNodeTypes,
|
|
8619
8668
|
renderAgentDrawer,
|
|
8620
|
-
renderLogicNodeDrawer
|
|
8669
|
+
renderLogicNodeDrawer: _renderLogicNodeDrawer
|
|
8621
8670
|
}) {
|
|
8622
8671
|
const { screenToFlowPosition, getNode, toObject, fitView, zoomIn, zoomOut, zoomTo } = useReactFlow();
|
|
8623
8672
|
const tWorkflow = useTranslations("agents.workflow");
|
|
8624
8673
|
const sortedAgents = useMemo(() => [...agents].sort((agentA, agentB) => (agentA.order ?? 0) - (agentB.order ?? 0)), [agents]);
|
|
8625
8674
|
const [selectedAgentId, setSelectedAgentId] = useState(null);
|
|
8626
|
-
const
|
|
8627
|
-
const
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8675
|
+
const openAgentDrawerAction = useDrawerStore((s) => s.openAgentDrawer);
|
|
8676
|
+
const openLogicNodeDrawerAction = useDrawerStore((s) => s.openLogicNodeDrawer);
|
|
8677
|
+
const closeDrawerAction = useDrawerStore((s) => s.closeDrawer);
|
|
8678
|
+
const activeDrawer = useDrawerStore((s) => s.activeDrawer);
|
|
8679
|
+
const drawerOpen = activeDrawer === "agent";
|
|
8680
|
+
useEffect(() => {
|
|
8681
|
+
if (isCreatingAgent) {
|
|
8682
|
+
openAgentDrawerAction(
|
|
8683
|
+
{ agentId: "", name: "", order: 0, enabled: true, temperature: 0.7, maxTokens: 4096 },
|
|
8684
|
+
models,
|
|
8685
|
+
true
|
|
8686
|
+
);
|
|
8687
|
+
}
|
|
8688
|
+
}, [isCreatingAgent]);
|
|
8637
8689
|
const graphChangeTimerRef = useRef(null);
|
|
8638
8690
|
const insertNodeOnEdgeRef = useRef(() => {
|
|
8639
8691
|
});
|
|
@@ -8670,9 +8722,16 @@ function WorkflowCanvasInner({
|
|
|
8670
8722
|
const setLayoutDirection = useWorkflowStore((s) => s.setLayoutDirection);
|
|
8671
8723
|
const [editingLogicNodeId, setEditingLogicNodeId] = useState(null);
|
|
8672
8724
|
const handleEditLogicNode = useCallback((nodeId) => {
|
|
8673
|
-
closeAllDrawers();
|
|
8674
8725
|
setEditingLogicNodeId(nodeId);
|
|
8675
|
-
|
|
8726
|
+
const node = getNode(nodeId);
|
|
8727
|
+
if (node) {
|
|
8728
|
+
const nodeData = node.data;
|
|
8729
|
+
const config = nodeData.config;
|
|
8730
|
+
if (config) {
|
|
8731
|
+
openLogicNodeDrawerAction(nodeId, nodeData.label ?? "", config);
|
|
8732
|
+
}
|
|
8733
|
+
}
|
|
8734
|
+
}, [getNode, openLogicNodeDrawerAction]);
|
|
8676
8735
|
const agentMap = useMemo(() => {
|
|
8677
8736
|
const map = /* @__PURE__ */ new Map();
|
|
8678
8737
|
for (const agent of agents) {
|
|
@@ -8756,8 +8815,7 @@ function WorkflowCanvasInner({
|
|
|
8756
8815
|
selected: selectedAgentId === savedNode.id,
|
|
8757
8816
|
onSelect: () => {
|
|
8758
8817
|
setSelectedAgentId(agent.agentId);
|
|
8759
|
-
|
|
8760
|
-
openAgentDrawer(agent, models);
|
|
8818
|
+
openAgentDrawerAction(agent, models);
|
|
8761
8819
|
},
|
|
8762
8820
|
onRemoveFromCanvas: handleRemoveNodeFromCanvas
|
|
8763
8821
|
}
|
|
@@ -9106,11 +9164,9 @@ function WorkflowCanvasInner({
|
|
|
9106
9164
|
if (!targetNode) return;
|
|
9107
9165
|
if (targetNode.type === "agent") {
|
|
9108
9166
|
const agent = targetNode.data?.agent;
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
setDrawerOpen(true);
|
|
9113
|
-
openAgentDrawer(agent, models);
|
|
9167
|
+
if (agent) {
|
|
9168
|
+
setSelectedAgentId(agent.agentId ?? agent.id ?? null);
|
|
9169
|
+
openAgentDrawerAction(agent, models);
|
|
9114
9170
|
}
|
|
9115
9171
|
} else if (targetNode.type === "tool") {
|
|
9116
9172
|
const tool = targetNode.data?.tool;
|
|
@@ -9120,7 +9176,7 @@ function WorkflowCanvasInner({
|
|
|
9120
9176
|
} else {
|
|
9121
9177
|
handleEditLogicNode(nodeId);
|
|
9122
9178
|
}
|
|
9123
|
-
}, [nodes, setSelectedAgentId,
|
|
9179
|
+
}, [nodes, setSelectedAgentId, openAgentDrawerAction, models, onEditTool, onEditRule, handleEditLogicNode]);
|
|
9124
9180
|
const DUPLICATE_OFFSET = 40;
|
|
9125
9181
|
const contextMenuDuplicateNode = useCallback((nodeId) => {
|
|
9126
9182
|
storeTakeSnapshot();
|
|
@@ -9601,8 +9657,7 @@ function WorkflowCanvasInner({
|
|
|
9601
9657
|
selected: false,
|
|
9602
9658
|
onSelect: () => {
|
|
9603
9659
|
setSelectedAgentId(agent.agentId);
|
|
9604
|
-
|
|
9605
|
-
openAgentDrawer(agent, models);
|
|
9660
|
+
openAgentDrawerAction(agent, models);
|
|
9606
9661
|
},
|
|
9607
9662
|
onRemoveFromCanvas: handleRemoveNodeFromCanvas
|
|
9608
9663
|
}
|
|
@@ -9897,7 +9952,7 @@ function WorkflowCanvasInner({
|
|
|
9897
9952
|
const handleEdgeClick = useCallback(() => {
|
|
9898
9953
|
closeContextMenu();
|
|
9899
9954
|
}, [closeContextMenu]);
|
|
9900
|
-
|
|
9955
|
+
useMemo(() => {
|
|
9901
9956
|
if (!editingLogicNodeId) return null;
|
|
9902
9957
|
const node = nodes.find((matchingNode) => matchingNode.id === editingLogicNodeId);
|
|
9903
9958
|
if (!node) return null;
|
|
@@ -10050,28 +10105,28 @@ function WorkflowCanvasInner({
|
|
|
10050
10105
|
open: drawerOpen || isCreatingAgent,
|
|
10051
10106
|
isCreateMode: isCreatingAgent,
|
|
10052
10107
|
onClose: () => {
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
}
|
|
10108
|
+
closeDrawerAction();
|
|
10109
|
+
setSelectedAgentId(null);
|
|
10110
|
+
if (isCreatingAgent) onCancelCreateAgent?.();
|
|
10057
10111
|
},
|
|
10058
10112
|
onSaved: () => {
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
}
|
|
10113
|
+
closeDrawerAction();
|
|
10114
|
+
setSelectedAgentId(null);
|
|
10115
|
+
if (isCreatingAgent) onCancelCreateAgent?.();
|
|
10063
10116
|
onAgentSaved?.();
|
|
10064
10117
|
}
|
|
10065
10118
|
}),
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10119
|
+
/* @__PURE__ */ jsx(
|
|
10120
|
+
LogicNodeDrawer,
|
|
10121
|
+
{
|
|
10122
|
+
onSave: (nodeId, config) => {
|
|
10123
|
+
handleSaveLogicNodeConfig(nodeId, config);
|
|
10124
|
+
closeDrawerAction();
|
|
10125
|
+
setEditingLogicNodeId(null);
|
|
10126
|
+
},
|
|
10127
|
+
entities: allEntities
|
|
10128
|
+
}
|
|
10129
|
+
)
|
|
10075
10130
|
] });
|
|
10076
10131
|
}
|
|
10077
10132
|
function WorkflowCanvas(props) {
|