@agentscope-ai/flow 0.0.17 → 0.0.18

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.
@@ -2,7 +2,7 @@ import { IConditionItem } from "../../types/work-flow";
2
2
  import React from 'react';
3
3
  import { IVarTreeItem } from '../variable-tree-select';
4
4
  import './index.less';
5
- export declare const operatorLabelRender: (val: string) => "=" | "" | ">" | "" | "<" | "≤" | "∋" | "∌" | undefined;
5
+ export declare const operatorLabelRender: (val: string) => "<" | ">" | "=" | "" | "" | "≤" | "∋" | "∌" | undefined;
6
6
  export interface IConditionItemProps {
7
7
  value: IConditionItem;
8
8
  onChange: (value: Partial<IConditionItem>) => void;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import './index.less';
3
3
  declare const _default: React.NamedExoticComponent<{
4
4
  nodeType: string;
5
- size?: "small" | "default" | undefined;
5
+ size?: "default" | "small" | undefined;
6
6
  showBg?: boolean | undefined;
7
7
  noWidth?: boolean | undefined;
8
8
  }>;
@@ -10,8 +10,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { useStore } from "../../flow/context";
12
12
  import $i18n from "../../i18n";
13
- import { Pagination } from '@agentscope-ai/design';
14
- import { SparkUpLine } from '@agentscope-ai/icons';
13
+ import { Pagination, Tooltip } from '@agentscope-ai/design';
14
+ import { SparkTargetLine, SparkUpLine } from '@agentscope-ai/icons';
15
15
  import { Typography } from 'antd';
16
16
  import classNames from 'classnames';
17
17
  import React, { memo, useMemo, useState } from 'react';
@@ -70,6 +70,12 @@ var ResultContent = function ResultContent(props) {
70
70
  }, output))));
71
71
  };
72
72
  var NodeResultPanel = function NodeResultPanel(props) {
73
+ var onFlowEvent = useStore(function (state) {
74
+ return state.onFlowEvent;
75
+ });
76
+ var showNodeResultTargetButton = useStore(function (state) {
77
+ return state.showNodeResultTargetButton;
78
+ });
73
79
  var _useState = useState(false),
74
80
  _useState2 = _slicedToArray(_useState, 2),
75
81
  expand = _useState2[0],
@@ -121,9 +127,21 @@ var NodeResultPanel = function NodeResultPanel(props) {
121
127
  className: "spark-flow-node-result-status"
122
128
  }, statusNameMap[props.data.nodeStatus]), /*#__PURE__*/React.createElement("span", {
123
129
  className: "spark-flow-node-result-time"
124
- }, props.data.nodeExecTime)), props.data.nodeStatus !== 'skip' && /*#__PURE__*/React.createElement(SparkUpLine, {
130
+ }, props.data.nodeExecTime)), /*#__PURE__*/React.createElement("div", {
131
+ className: "flex-center gap-[8px]"
132
+ }, showNodeResultTargetButton && /*#__PURE__*/React.createElement(Tooltip, {
133
+ title: $i18n.get({
134
+ id: 'spark-flow.components.NodeResultPanel.index.locateNodeInTestPanel',
135
+ dm: '定位到测试窗中节点位置'
136
+ })
137
+ }, /*#__PURE__*/React.createElement(SparkTargetLine, {
138
+ className: "text-base cursor-pointer",
139
+ onClick: function onClick() {
140
+ onFlowEvent === null || onFlowEvent === void 0 || onFlowEvent('nodeResultTargetClick', props.data.nodeId);
141
+ }
142
+ })), props.data.nodeStatus !== 'skip' && /*#__PURE__*/React.createElement(SparkUpLine, {
125
143
  className: "text-base spark-flow-node-result-expand-icon"
126
- })), expand && batch && /*#__PURE__*/React.createElement(Pagination, {
144
+ }))), expand && batch && /*#__PURE__*/React.createElement(Pagination, {
127
145
  current: batchIndex,
128
146
  total: props.data.batches.length,
129
147
  pageSize: 1,
@@ -29,5 +29,5 @@ export declare const VariableTreeNodeItem: React.MemoExoticComponent<(props: IVa
29
29
  value?: string | undefined;
30
30
  onChange?: ((value: Pick<IVarItem, 'type' | 'value'>) => void) | undefined;
31
31
  }) => React.JSX.Element>;
32
- declare const VariableTreeSelect: React.MemoExoticComponent<(props: IVariableTreeSelectProps) => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined>;
32
+ declare const VariableTreeSelect: React.MemoExoticComponent<(props: IVariableTreeSelectProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined>;
33
33
  export default VariableTreeSelect;
@@ -67,8 +67,17 @@ var Flow = /*#__PURE__*/memo(function (props) {
67
67
  var showSingleTest = useStore(function (state) {
68
68
  return state.showSingleTest;
69
69
  });
70
+ var setOnFlowEvent = useStore(function (state) {
71
+ return state.setOnFlowEvent;
72
+ });
70
73
  var _useNodesReadOnly = useNodesReadOnly(),
71
74
  nodesReadOnly = _useNodesReadOnly.nodesReadOnly;
75
+ useEffect(function () {
76
+ setOnFlowEvent(props.onFlowEvent);
77
+ return function () {
78
+ return setOnFlowEvent(undefined);
79
+ };
80
+ }, [props.onFlowEvent, setOnFlowEvent]);
72
81
  useEffect(function () {
73
82
  var _props$onFlowEvent;
74
83
  (_props$onFlowEvent = props.onFlowEvent) === null || _props$onFlowEvent === void 0 || _props$onFlowEvent.call(props, 'showSingleTest', null);
@@ -89,6 +89,7 @@
89
89
  "spark-flow.components.NodeResultPanel.index.paused": "Paused",
90
90
  "spark-flow.components.NodeResultPanel.index.input": "Input",
91
91
  "spark-flow.components.NodeResultPanel.index.output": "Output",
92
+ "spark-flow.components.NodeResultPanel.index.locateNodeInTestPanel": "Locate node in test panel",
92
93
  "spark-flow.components.NodeTree.index.searchNodeName": "Search",
93
94
  "spark-flow.components.ShortMemoryForm.index.nodeCache": "Node cache",
94
95
  "spark-flow.components.ShortMemoryForm.index.customCache": "Custom cache",
@@ -89,6 +89,7 @@
89
89
  "spark-flow.components.NodeResultPanel.index.paused": "一時停止",
90
90
  "spark-flow.components.NodeResultPanel.index.input": "入力",
91
91
  "spark-flow.components.NodeResultPanel.index.output": "出力",
92
+ "spark-flow.components.NodeResultPanel.index.locateNodeInTestPanel": "テストパネルでノード位置を表示",
92
93
  "spark-flow.components.NodeTree.index.searchNodeName": "ノード名を検索",
93
94
  "spark-flow.components.ShortMemoryForm.index.nodeCache": "このノードのキャッシュ",
94
95
  "spark-flow.components.ShortMemoryForm.index.customCache": "カスタムキャッシュ",
@@ -89,6 +89,7 @@
89
89
  "spark-flow.components.NodeResultPanel.index.paused": "暂停",
90
90
  "spark-flow.components.NodeResultPanel.index.input": "输入",
91
91
  "spark-flow.components.NodeResultPanel.index.output": "输出",
92
+ "spark-flow.components.NodeResultPanel.index.locateNodeInTestPanel": "定位到测试窗中节点位置",
92
93
  "spark-flow.components.NodeTree.index.searchNodeName": "搜索节点名称",
93
94
  "spark-flow.components.ShortMemoryForm.index.nodeCache": "本节点缓存",
94
95
  "spark-flow.components.ShortMemoryForm.index.customCache": "自定义缓存",
@@ -66,5 +66,9 @@ export interface IWorkFlowStore {
66
66
  setShowCheckList: (val: boolean) => void;
67
67
  NodeMenuItemRenderer?: (props: INodeMenuItemProps) => React.ReactNode;
68
68
  debounceChangeTimeout: number;
69
+ onFlowEvent?: (type: string, params: any) => void;
70
+ setOnFlowEvent: (fn: ((type: string, params: any) => void) | undefined) => void;
71
+ showNodeResultTargetButton: boolean;
72
+ setShowNodeResultTargetButton: (val: boolean) => void;
69
73
  }
70
74
  export declare const createWorkflowStore: (initialState?: Partial<IWorkFlowStore>) => import("zustand/vanilla").StoreApi<IWorkFlowStore>;
@@ -140,7 +140,23 @@ export var createWorkflowStore = function createWorkflowStore() {
140
140
  };
141
141
  });
142
142
  },
143
- debounceChangeTimeout: 300
143
+ debounceChangeTimeout: 300,
144
+ onFlowEvent: undefined,
145
+ setOnFlowEvent: function setOnFlowEvent(fn) {
146
+ return set(function () {
147
+ return {
148
+ onFlowEvent: fn
149
+ };
150
+ });
151
+ },
152
+ showNodeResultTargetButton: false,
153
+ setShowNodeResultTargetButton: function setShowNodeResultTargetButton(val) {
154
+ return set(function () {
155
+ return {
156
+ showNodeResultTargetButton: val
157
+ };
158
+ });
159
+ }
144
160
  }, initialState);
145
161
  });
146
162
  };
@@ -209,7 +209,7 @@ export var getParentInputParams = function getParentInputParams(node) {
209
209
  var list = [];
210
210
  inputParams.forEach(function (item) {
211
211
  var _item$value, _item$type;
212
- // 检查是不是数组里的子变量,例如${DocumentParse_AKQK.layout.[markdownContent]
212
+ // check if item.value is the children property of an array, for example: ${DocumentParse_AKQK.layout.[markdownContent]
213
213
  var matches = (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.match(/\[[^\[\]]+\]/g);
214
214
  var isSubPropertyInArray = matches === null || matches === void 0 ? void 0 : matches.length;
215
215
  if (((_item$type = item.type) !== null && _item$type !== void 0 && _item$type.includes('Array') || isSubPropertyInArray) && !!item.value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/flow",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
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",