balibabu
commited on
Commit
·
cd85d9e
1
Parent(s):
fa01f2d
feat: Add a note node to the agent canvas #2767 (#2768)
Browse files### What problem does this PR solve?
feat: Add a note node to the agent canvas #2767
### Type of change
- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
- web/src/assets/svg/note.svg +9 -0
- web/src/locales/en.ts +3 -0
- web/src/locales/zh-traditional.ts +3 -0
- web/src/locales/zh.ts +3 -0
- web/src/pages/flow/canvas/index.tsx +9 -14
- web/src/pages/flow/canvas/node/index.less +21 -6
- web/src/pages/flow/canvas/node/index.tsx +1 -14
- web/src/pages/flow/canvas/node/note-node.tsx +46 -0
- web/src/pages/flow/constant.tsx +12 -0
- web/src/pages/flow/flow-drawer/index.tsx +28 -28
- web/src/pages/flow/flow-sider/index.tsx +12 -9
- web/src/pages/flow/{akshare-form → form/akshare-form}/index.tsx +1 -1
- web/src/pages/flow/{answer-form → form/answer-form}/index.tsx +0 -0
- web/src/pages/flow/{arxiv-form → form/arxiv-form}/index.tsx +1 -1
- web/src/pages/flow/{baidu-fanyi-form → form/baidu-fanyi-form}/index.tsx +2 -2
- web/src/pages/flow/{baidu-form → form/baidu-form}/index.tsx +1 -1
- web/src/pages/flow/{begin-form → form/begin-form}/index.tsx +1 -1
- web/src/pages/flow/{bing-form → form/bing-form}/index.tsx +2 -2
- web/src/pages/flow/{categorize-form → form/categorize-form}/dynamic-categorize.tsx +2 -2
- web/src/pages/flow/{categorize-form → form/categorize-form}/hooks.ts +2 -2
- web/src/pages/flow/{categorize-form → form/categorize-form}/index.tsx +2 -2
- web/src/pages/flow/{concentrator-form → form/concentrator-form}/index.tsx +1 -1
- web/src/pages/flow/{deepl-form → form/deepl-form}/index.tsx +3 -3
- web/src/pages/flow/{duckduckgo-form → form/duckduckgo-form}/index.tsx +2 -2
- web/src/pages/flow/{exesql-form → form/exesql-form}/index.tsx +2 -2
- web/src/pages/flow/{generate-form → form/generate-form}/dynamic-parameters.tsx +2 -2
- web/src/pages/flow/{generate-form → form/generate-form}/hooks.ts +2 -2
- web/src/pages/flow/{generate-form → form/generate-form}/index.less +0 -0
- web/src/pages/flow/{generate-form → form/generate-form}/index.tsx +2 -2
- web/src/pages/flow/{github-form → form/github-form}/index.tsx +1 -1
- web/src/pages/flow/{google-form → form/google-form}/index.tsx +2 -2
- web/src/pages/flow/{google-scholar-form → form/google-scholar-form}/index.tsx +2 -2
- web/src/pages/flow/{jin10-form → form/jin10-form}/index.tsx +2 -2
- web/src/pages/flow/{keyword-extract-form → form/keyword-extract-form}/index.tsx +2 -2
- web/src/pages/flow/{message-form → form/message-form}/index.less +0 -0
- web/src/pages/flow/{message-form → form/message-form}/index.tsx +1 -1
- web/src/pages/flow/{pubmed-form → form/pubmed-form}/index.tsx +1 -1
- web/src/pages/flow/{qweather-form → form/qweather-form}/index.tsx +2 -2
- web/src/pages/flow/{relevant-form → form/relevant-form}/hooks.ts +2 -2
- web/src/pages/flow/{relevant-form → form/relevant-form}/index.tsx +4 -4
- web/src/pages/flow/{retrieval-form → form/retrieval-form}/index.tsx +1 -1
- web/src/pages/flow/{rewrite-question-form → form/rewrite-question-form}/index.tsx +2 -2
- web/src/pages/flow/{switch-form → form/switch-form}/index.tsx +5 -5
- web/src/pages/flow/{tushare-form → form/tushare-form}/index.tsx +2 -2
- web/src/pages/flow/{wencai-form → form/wencai-form}/index.tsx +2 -2
- web/src/pages/flow/{wikipedia-form → form/wikipedia-form}/index.tsx +2 -2
- web/src/pages/flow/{yahoo-finance-form → form/yahoo-finance-form}/index.tsx +1 -1
- web/src/pages/flow/hooks.ts +2 -0
- web/src/pages/flow/utils.ts +17 -15
web/src/assets/svg/note.svg
ADDED
|
web/src/locales/en.ts
CHANGED
@@ -985,6 +985,9 @@ The above is the content you need to summarize.`,
|
|
985 |
startDate: 'Start date',
|
986 |
endDate: 'End date',
|
987 |
keyword: 'Keyword',
|
|
|
|
|
|
|
988 |
},
|
989 |
footer: {
|
990 |
profile: 'All rights reserved @ React',
|
|
|
985 |
startDate: 'Start date',
|
986 |
endDate: 'End date',
|
987 |
keyword: 'Keyword',
|
988 |
+
note: 'Note',
|
989 |
+
noteDescription: 'Note',
|
990 |
+
notePlaceholder: 'Please enter a note',
|
991 |
},
|
992 |
footer: {
|
993 |
profile: 'All rights reserved @ React',
|
web/src/locales/zh-traditional.ts
CHANGED
@@ -937,6 +937,9 @@ export default {
|
|
937 |
startDate: '開始日期',
|
938 |
endDate: '結束日期',
|
939 |
keyword: '關鍵字',
|
|
|
|
|
|
|
940 |
},
|
941 |
footer: {
|
942 |
profile: '“保留所有權利 @ react”',
|
|
|
937 |
startDate: '開始日期',
|
938 |
endDate: '結束日期',
|
939 |
keyword: '關鍵字',
|
940 |
+
note: '註解',
|
941 |
+
noteDescription: '註解',
|
942 |
+
notePlaceholder: '請輸入註釋',
|
943 |
},
|
944 |
footer: {
|
945 |
profile: '“保留所有權利 @ react”',
|
web/src/locales/zh.ts
CHANGED
@@ -955,6 +955,9 @@ export default {
|
|
955 |
startDate: '开始日期',
|
956 |
endDate: '结束日期',
|
957 |
keyword: '关键字',
|
|
|
|
|
|
|
958 |
},
|
959 |
footer: {
|
960 |
profile: 'All rights reserved @ React',
|
|
|
955 |
startDate: '开始日期',
|
956 |
endDate: '结束日期',
|
957 |
keyword: '关键字',
|
958 |
+
note: '注释',
|
959 |
+
noteDescription: '注释',
|
960 |
+
notePlaceholder: '请输入注释',
|
961 |
},
|
962 |
footer: {
|
963 |
profile: 'All rights reserved @ React',
|
web/src/pages/flow/canvas/index.tsx
CHANGED
@@ -6,9 +6,8 @@ import ReactFlow, {
|
|
6 |
NodeMouseHandler,
|
7 |
} from 'reactflow';
|
8 |
import 'reactflow/dist/style.css';
|
9 |
-
|
10 |
-
import {
|
11 |
-
|
12 |
import FlowDrawer from '../flow-drawer';
|
13 |
import {
|
14 |
useHandleDrop,
|
@@ -18,13 +17,13 @@ import {
|
|
18 |
useValidateConnection,
|
19 |
useWatchNodeFormDataChange,
|
20 |
} from '../hooks';
|
21 |
-
import {
|
22 |
-
|
23 |
-
import ChatDrawer from '../chat/drawer';
|
24 |
import styles from './index.less';
|
|
|
25 |
import { BeginNode } from './node/begin-node';
|
26 |
import { CategorizeNode } from './node/categorize-node';
|
27 |
import { LogicNode } from './node/logic-node';
|
|
|
28 |
import { RelevantNode } from './node/relevant-node';
|
29 |
|
30 |
const nodeTypes = {
|
@@ -33,6 +32,7 @@ const nodeTypes = {
|
|
33 |
beginNode: BeginNode,
|
34 |
relevantNode: RelevantNode,
|
35 |
logicNode: LogicNode,
|
|
|
36 |
};
|
37 |
|
38 |
const edgeTypes = {
|
@@ -60,7 +60,9 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
|
|
60 |
|
61 |
const onNodeClick: NodeMouseHandler = useCallback(
|
62 |
(e, node) => {
|
63 |
-
|
|
|
|
|
64 |
},
|
65 |
[showDrawer],
|
66 |
);
|
@@ -121,14 +123,7 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
|
|
121 |
defaultEdgeOptions={{
|
122 |
type: 'buttonEdge',
|
123 |
markerEnd: 'logo',
|
124 |
-
// markerEnd: {
|
125 |
-
// type: MarkerType.ArrowClosed,
|
126 |
-
// color: 'rgb(157 149 225)',
|
127 |
-
// width: 20,
|
128 |
-
// height: 20,
|
129 |
-
// },
|
130 |
style: {
|
131 |
-
// edge style
|
132 |
strokeWidth: 2,
|
133 |
stroke: 'rgb(202 197 245)',
|
134 |
},
|
|
|
6 |
NodeMouseHandler,
|
7 |
} from 'reactflow';
|
8 |
import 'reactflow/dist/style.css';
|
9 |
+
import ChatDrawer from '../chat/drawer';
|
10 |
+
import { Operator } from '../constant';
|
|
|
11 |
import FlowDrawer from '../flow-drawer';
|
12 |
import {
|
13 |
useHandleDrop,
|
|
|
17 |
useValidateConnection,
|
18 |
useWatchNodeFormDataChange,
|
19 |
} from '../hooks';
|
20 |
+
import { ButtonEdge } from './edge';
|
|
|
|
|
21 |
import styles from './index.less';
|
22 |
+
import { RagNode } from './node';
|
23 |
import { BeginNode } from './node/begin-node';
|
24 |
import { CategorizeNode } from './node/categorize-node';
|
25 |
import { LogicNode } from './node/logic-node';
|
26 |
+
import NoteNode from './node/note-node';
|
27 |
import { RelevantNode } from './node/relevant-node';
|
28 |
|
29 |
const nodeTypes = {
|
|
|
32 |
beginNode: BeginNode,
|
33 |
relevantNode: RelevantNode,
|
34 |
logicNode: LogicNode,
|
35 |
+
noteNode: NoteNode,
|
36 |
};
|
37 |
|
38 |
const edgeTypes = {
|
|
|
60 |
|
61 |
const onNodeClick: NodeMouseHandler = useCallback(
|
62 |
(e, node) => {
|
63 |
+
if (node.data.label !== Operator.Note) {
|
64 |
+
showDrawer(node);
|
65 |
+
}
|
66 |
},
|
67 |
[showDrawer],
|
68 |
);
|
|
|
123 |
defaultEdgeOptions={{
|
124 |
type: 'buttonEdge',
|
125 |
markerEnd: 'logo',
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
style: {
|
|
|
127 |
strokeWidth: 2,
|
128 |
stroke: 'rgb(202 197 245)',
|
129 |
},
|
web/src/pages/flow/canvas/node/index.less
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
-
.
|
2 |
-
position: relative;
|
3 |
box-shadow:
|
4 |
-6px 0 12px 0 rgba(179, 177, 177, 0.08),
|
5 |
-3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
6 |
-6px 0 16px 6px rgba(0, 0, 0, 0.05);
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
padding: 5px;
|
9 |
border-radius: 5px;
|
@@ -68,10 +72,7 @@
|
|
68 |
|
69 |
.logicNode {
|
70 |
position: relative;
|
71 |
-
|
72 |
-
-6px 0 12px 0 rgba(179, 177, 177, 0.08),
|
73 |
-
-3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
74 |
-
-6px 0 16px 6px rgba(0, 0, 0, 0.05);
|
75 |
|
76 |
padding: 5px;
|
77 |
border-radius: 5px;
|
@@ -116,3 +117,17 @@
|
|
116 |
white-space: nowrap;
|
117 |
}
|
118 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.commonNode() {
|
|
|
2 |
box-shadow:
|
3 |
-6px 0 12px 0 rgba(179, 177, 177, 0.08),
|
4 |
-3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
5 |
-6px 0 16px 6px rgba(0, 0, 0, 0.05);
|
6 |
+
}
|
7 |
+
|
8 |
+
.ragNode {
|
9 |
+
position: relative;
|
10 |
+
.commonNode();
|
11 |
|
12 |
padding: 5px;
|
13 |
border-radius: 5px;
|
|
|
72 |
|
73 |
.logicNode {
|
74 |
position: relative;
|
75 |
+
.commonNode();
|
|
|
|
|
|
|
76 |
|
77 |
padding: 5px;
|
78 |
border-radius: 5px;
|
|
|
117 |
white-space: nowrap;
|
118 |
}
|
119 |
}
|
120 |
+
|
121 |
+
.noteNode {
|
122 |
+
.commonNode();
|
123 |
+
width: 140px;
|
124 |
+
padding: 4px 6px 6px;
|
125 |
+
border-radius: 10px;
|
126 |
+
background-color: #dbf8f4;
|
127 |
+
.noteTitle {
|
128 |
+
font-size: 12px;
|
129 |
+
}
|
130 |
+
.noteForm {
|
131 |
+
margin-top: 4px;
|
132 |
+
}
|
133 |
+
}
|
web/src/pages/flow/canvas/node/index.tsx
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { Flex } from 'antd';
|
3 |
import classNames from 'classnames';
|
4 |
import pick from 'lodash/pick';
|
@@ -10,12 +9,6 @@ import NodeDropdown from './dropdown';
|
|
10 |
import styles from './index.less';
|
11 |
import NodePopover from './popover';
|
12 |
|
13 |
-
const ZeroGapOperators = [
|
14 |
-
Operator.RewriteQuestion,
|
15 |
-
Operator.KeywordExtract,
|
16 |
-
Operator.ArXiv,
|
17 |
-
];
|
18 |
-
|
19 |
export function RagNode({
|
20 |
id,
|
21 |
data,
|
@@ -23,7 +16,6 @@ export function RagNode({
|
|
23 |
selected,
|
24 |
}: NodeProps<NodeData>) {
|
25 |
const style = operatorMap[data.label as Operator];
|
26 |
-
const { t } = useTranslate('flow');
|
27 |
|
28 |
return (
|
29 |
<NodePopover nodeId={id}>
|
@@ -51,12 +43,7 @@ export function RagNode({
|
|
51 |
id="b"
|
52 |
></Handle>
|
53 |
<Handle type="source" position={Position.Bottom} id="a" isConnectable />
|
54 |
-
<Flex
|
55 |
-
vertical
|
56 |
-
align="center"
|
57 |
-
justify={'space-around'}
|
58 |
-
// gap={ZeroGapOperators.some((x) => x === data.label) ? 0 : 6}
|
59 |
-
>
|
60 |
<Flex flex={1} justify="center" align="center">
|
61 |
<label htmlFor=""> </label>
|
62 |
</Flex>
|
|
|
|
|
1 |
import { Flex } from 'antd';
|
2 |
import classNames from 'classnames';
|
3 |
import pick from 'lodash/pick';
|
|
|
9 |
import styles from './index.less';
|
10 |
import NodePopover from './popover';
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
export function RagNode({
|
13 |
id,
|
14 |
data,
|
|
|
16 |
selected,
|
17 |
}: NodeProps<NodeData>) {
|
18 |
const style = operatorMap[data.label as Operator];
|
|
|
19 |
|
20 |
return (
|
21 |
<NodePopover nodeId={id}>
|
|
|
43 |
id="b"
|
44 |
></Handle>
|
45 |
<Handle type="source" position={Position.Bottom} id="a" isConnectable />
|
46 |
+
<Flex vertical align="center" justify={'space-around'}>
|
|
|
|
|
|
|
|
|
|
|
47 |
<Flex flex={1} justify="center" align="center">
|
48 |
<label htmlFor=""> </label>
|
49 |
</Flex>
|
web/src/pages/flow/canvas/node/note-node.tsx
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Flex, Form, Input, Space } from 'antd';
|
2 |
+
import { NodeProps } from 'reactflow';
|
3 |
+
import { NodeData } from '../../interface';
|
4 |
+
import NodeDropdown from './dropdown';
|
5 |
+
|
6 |
+
import SvgIcon from '@/components/svg-icon';
|
7 |
+
import { useEffect } from 'react';
|
8 |
+
import { useTranslation } from 'react-i18next';
|
9 |
+
import { useHandleFormValuesChange } from '../../hooks';
|
10 |
+
import styles from './index.less';
|
11 |
+
|
12 |
+
const { TextArea } = Input;
|
13 |
+
|
14 |
+
function NoteNode({ data, id }: NodeProps<NodeData>) {
|
15 |
+
const { t } = useTranslation();
|
16 |
+
const [form] = Form.useForm();
|
17 |
+
|
18 |
+
const { handleValuesChange } = useHandleFormValuesChange(id);
|
19 |
+
|
20 |
+
useEffect(() => {
|
21 |
+
form.setFieldsValue(data?.form);
|
22 |
+
}, [form, data?.form]);
|
23 |
+
|
24 |
+
return (
|
25 |
+
<section className={styles.noteNode}>
|
26 |
+
<Flex justify={'space-between'}>
|
27 |
+
<Space size={'small'}>
|
28 |
+
<SvgIcon name="note" width={14}></SvgIcon>
|
29 |
+
<span className={styles.noteTitle}>{t('flow.note')}</span>
|
30 |
+
</Space>
|
31 |
+
<NodeDropdown id={id}></NodeDropdown>
|
32 |
+
</Flex>
|
33 |
+
<Form
|
34 |
+
onValuesChange={handleValuesChange}
|
35 |
+
form={form}
|
36 |
+
className={styles.noteForm}
|
37 |
+
>
|
38 |
+
<Form.Item name="text" noStyle>
|
39 |
+
<TextArea rows={3} placeholder={t('flow.notePlaceholder')} />
|
40 |
+
</Form.Item>
|
41 |
+
</Form>
|
42 |
+
</section>
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
export default NoteNode;
|
web/src/pages/flow/constant.tsx
CHANGED
@@ -12,6 +12,7 @@ import { ReactComponent as GoogleScholarIcon } from '@/assets/svg/google-scholar
|
|
12 |
import { ReactComponent as GoogleIcon } from '@/assets/svg/google.svg';
|
13 |
import { ReactComponent as Jin10Icon } from '@/assets/svg/jin10.svg';
|
14 |
import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
|
|
|
15 |
import { ReactComponent as PubMedIcon } from '@/assets/svg/pubmed.svg';
|
16 |
import { ReactComponent as QWeatherIcon } from '@/assets/svg/qweather.svg';
|
17 |
import { ReactComponent as SwitchIcon } from '@/assets/svg/switch.svg';
|
@@ -71,6 +72,7 @@ export enum Operator {
|
|
71 |
Jin10 = 'Jin10',
|
72 |
Concentrator = 'Concentrator',
|
73 |
TuShare = 'TuShare',
|
|
|
74 |
}
|
75 |
|
76 |
export const operatorIconMap = {
|
@@ -103,6 +105,7 @@ export const operatorIconMap = {
|
|
103 |
[Operator.Jin10]: Jin10Icon,
|
104 |
[Operator.Concentrator]: ConcentratorIcon,
|
105 |
[Operator.TuShare]: TuShareIcon,
|
|
|
106 |
};
|
107 |
|
108 |
export const operatorMap: Record<
|
@@ -225,6 +228,7 @@ export const operatorMap: Record<
|
|
225 |
iconFontSize: 16,
|
226 |
},
|
227 |
[Operator.TuShare]: { backgroundColor: '#f8cfa0' },
|
|
|
228 |
};
|
229 |
|
230 |
export const componentMenuList = [
|
@@ -258,6 +262,9 @@ export const componentMenuList = [
|
|
258 |
{
|
259 |
name: Operator.Concentrator,
|
260 |
},
|
|
|
|
|
|
|
261 |
{
|
262 |
name: Operator.DuckDuckGo,
|
263 |
},
|
@@ -480,6 +487,10 @@ export const initialTuShareValues = {
|
|
480 |
start_date: '2024-01-01 09:00:00',
|
481 |
};
|
482 |
|
|
|
|
|
|
|
|
|
483 |
export const CategorizeAnchorPointPositions = [
|
484 |
{ top: 1, right: 34 },
|
485 |
{ top: 8, right: 18 },
|
@@ -588,6 +599,7 @@ export const NodeMap = {
|
|
588 |
[Operator.YahooFinance]: 'ragNode',
|
589 |
[Operator.Jin10]: 'ragNode',
|
590 |
[Operator.TuShare]: 'ragNode',
|
|
|
591 |
};
|
592 |
|
593 |
export const LanguageOptions = [
|
|
|
12 |
import { ReactComponent as GoogleIcon } from '@/assets/svg/google.svg';
|
13 |
import { ReactComponent as Jin10Icon } from '@/assets/svg/jin10.svg';
|
14 |
import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
|
15 |
+
import { ReactComponent as NoteIcon } from '@/assets/svg/note.svg';
|
16 |
import { ReactComponent as PubMedIcon } from '@/assets/svg/pubmed.svg';
|
17 |
import { ReactComponent as QWeatherIcon } from '@/assets/svg/qweather.svg';
|
18 |
import { ReactComponent as SwitchIcon } from '@/assets/svg/switch.svg';
|
|
|
72 |
Jin10 = 'Jin10',
|
73 |
Concentrator = 'Concentrator',
|
74 |
TuShare = 'TuShare',
|
75 |
+
Note = 'Note',
|
76 |
}
|
77 |
|
78 |
export const operatorIconMap = {
|
|
|
105 |
[Operator.Jin10]: Jin10Icon,
|
106 |
[Operator.Concentrator]: ConcentratorIcon,
|
107 |
[Operator.TuShare]: TuShareIcon,
|
108 |
+
[Operator.Note]: NoteIcon,
|
109 |
};
|
110 |
|
111 |
export const operatorMap: Record<
|
|
|
228 |
iconFontSize: 16,
|
229 |
},
|
230 |
[Operator.TuShare]: { backgroundColor: '#f8cfa0' },
|
231 |
+
[Operator.Note]: { backgroundColor: '#f8cfa0' },
|
232 |
};
|
233 |
|
234 |
export const componentMenuList = [
|
|
|
262 |
{
|
263 |
name: Operator.Concentrator,
|
264 |
},
|
265 |
+
{
|
266 |
+
name: Operator.Note,
|
267 |
+
},
|
268 |
{
|
269 |
name: Operator.DuckDuckGo,
|
270 |
},
|
|
|
487 |
start_date: '2024-01-01 09:00:00',
|
488 |
};
|
489 |
|
490 |
+
export const initialNoteValues = {
|
491 |
+
text: '',
|
492 |
+
};
|
493 |
+
|
494 |
export const CategorizeAnchorPointPositions = [
|
495 |
{ top: 1, right: 34 },
|
496 |
{ top: 8, right: 18 },
|
|
|
599 |
[Operator.YahooFinance]: 'ragNode',
|
600 |
[Operator.Jin10]: 'ragNode',
|
601 |
[Operator.TuShare]: 'ragNode',
|
602 |
+
[Operator.Note]: 'noteNode',
|
603 |
};
|
604 |
|
605 |
export const LanguageOptions = [
|
web/src/pages/flow/flow-drawer/index.tsx
CHANGED
@@ -3,38 +3,38 @@ import { IModalProps } from '@/interfaces/common';
|
|
3 |
import { Drawer, Flex, Form, Input } from 'antd';
|
4 |
import { useEffect } from 'react';
|
5 |
import { Node } from 'reactflow';
|
6 |
-
import AkShareForm from '../akshare-form';
|
7 |
-
import AnswerForm from '../answer-form';
|
8 |
-
import ArXivForm from '../arxiv-form';
|
9 |
-
import BaiduFanyiForm from '../baidu-fanyi-form';
|
10 |
-
import BaiduForm from '../baidu-form';
|
11 |
-
import BeginForm from '../begin-form';
|
12 |
-
import BingForm from '../bing-form';
|
13 |
-
import CategorizeForm from '../categorize-form';
|
14 |
import { Operator } from '../constant';
|
15 |
-
import
|
16 |
-
import
|
17 |
-
import
|
18 |
-
import
|
19 |
-
import
|
20 |
-
import
|
21 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
import { useHandleFormValuesChange, useHandleNodeNameChange } from '../hooks';
|
23 |
-
import KeywordExtractForm from '../keyword-extract-form';
|
24 |
-
import MessageForm from '../message-form';
|
25 |
import OperatorIcon from '../operator-icon';
|
26 |
-
import PubMedForm from '../pubmed-form';
|
27 |
-
import QWeatherForm from '../qweather-form';
|
28 |
-
import RelevantForm from '../relevant-form';
|
29 |
-
import RetrievalForm from '../retrieval-form';
|
30 |
-
import RewriteQuestionForm from '../rewrite-question-form';
|
31 |
-
import SwitchForm from '../switch-form';
|
32 |
-
import TuShareForm from '../tushare-form';
|
33 |
-
import WenCaiForm from '../wencai-form';
|
34 |
-
import WikipediaForm from '../wikipedia-form';
|
35 |
|
36 |
-
import Jin10Form from '../jin10-form';
|
37 |
-
import YahooFinanceForm from '../yahoo-finance-form';
|
38 |
import styles from './index.less';
|
39 |
|
40 |
interface IProps {
|
|
|
3 |
import { Drawer, Flex, Form, Input } from 'antd';
|
4 |
import { useEffect } from 'react';
|
5 |
import { Node } from 'reactflow';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
import { Operator } from '../constant';
|
7 |
+
import AkShareForm from '../form/akshare-form';
|
8 |
+
import AnswerForm from '../form/answer-form';
|
9 |
+
import ArXivForm from '../form/arxiv-form';
|
10 |
+
import BaiduFanyiForm from '../form/baidu-fanyi-form';
|
11 |
+
import BaiduForm from '../form/baidu-form';
|
12 |
+
import BeginForm from '../form/begin-form';
|
13 |
+
import BingForm from '../form/bing-form';
|
14 |
+
import CategorizeForm from '../form/categorize-form';
|
15 |
+
import DeepLForm from '../form/deepl-form';
|
16 |
+
import DuckDuckGoForm from '../form/duckduckgo-form';
|
17 |
+
import ExeSQLForm from '../form/exesql-form';
|
18 |
+
import GenerateForm from '../form/generate-form';
|
19 |
+
import GithubForm from '../form/github-form';
|
20 |
+
import GoogleForm from '../form/google-form';
|
21 |
+
import GoogleScholarForm from '../form/google-scholar-form';
|
22 |
+
import Jin10Form from '../form/jin10-form';
|
23 |
+
import KeywordExtractForm from '../form/keyword-extract-form';
|
24 |
+
import MessageForm from '../form/message-form';
|
25 |
+
import PubMedForm from '../form/pubmed-form';
|
26 |
+
import QWeatherForm from '../form/qweather-form';
|
27 |
+
import RelevantForm from '../form/relevant-form';
|
28 |
+
import RetrievalForm from '../form/retrieval-form';
|
29 |
+
import RewriteQuestionForm from '../form/rewrite-question-form';
|
30 |
+
import SwitchForm from '../form/switch-form';
|
31 |
+
import TuShareForm from '../form/tushare-form';
|
32 |
+
import WenCaiForm from '../form/wencai-form';
|
33 |
+
import WikipediaForm from '../form/wikipedia-form';
|
34 |
+
import YahooFinanceForm from '../form/yahoo-finance-form';
|
35 |
import { useHandleFormValuesChange, useHandleNodeNameChange } from '../hooks';
|
|
|
|
|
36 |
import OperatorIcon from '../operator-icon';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
|
|
|
|
38 |
import styles from './index.less';
|
39 |
|
40 |
interface IProps {
|
web/src/pages/flow/flow-sider/index.tsx
CHANGED
@@ -15,6 +15,14 @@ interface IProps {
|
|
15 |
collapsed: boolean;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
const FlowSide = ({ setCollapsed, collapsed }: IProps) => {
|
19 |
const { handleDragStart } = useHandleDrag();
|
20 |
const { t } = useTranslate('flow');
|
@@ -31,16 +39,11 @@ const FlowSide = ({ setCollapsed, collapsed }: IProps) => {
|
|
31 |
{componentMenuList.map((x) => {
|
32 |
return (
|
33 |
<React.Fragment key={x.name}>
|
|
|
|
|
|
|
34 |
{x.name === Operator.DuckDuckGo && (
|
35 |
-
<Divider
|
36 |
-
style={{
|
37 |
-
marginTop: 10,
|
38 |
-
marginBottom: 10,
|
39 |
-
padding: 0,
|
40 |
-
borderBlockColor: '#b4afaf',
|
41 |
-
borderStyle: 'dotted',
|
42 |
-
}}
|
43 |
-
></Divider>
|
44 |
)}
|
45 |
<Card
|
46 |
key={x.name}
|
|
|
15 |
collapsed: boolean;
|
16 |
}
|
17 |
|
18 |
+
const dividerProps = {
|
19 |
+
marginTop: 10,
|
20 |
+
marginBottom: 10,
|
21 |
+
padding: 0,
|
22 |
+
borderBlockColor: '#b4afaf',
|
23 |
+
borderStyle: 'dotted',
|
24 |
+
};
|
25 |
+
|
26 |
const FlowSide = ({ setCollapsed, collapsed }: IProps) => {
|
27 |
const { handleDragStart } = useHandleDrag();
|
28 |
const { t } = useTranslate('flow');
|
|
|
39 |
{componentMenuList.map((x) => {
|
40 |
return (
|
41 |
<React.Fragment key={x.name}>
|
42 |
+
{x.name === Operator.Note && (
|
43 |
+
<Divider style={dividerProps}></Divider>
|
44 |
+
)}
|
45 |
{x.name === Operator.DuckDuckGo && (
|
46 |
+
<Divider style={dividerProps}></Divider>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
)}
|
48 |
<Card
|
49 |
key={x.name}
|
web/src/pages/flow/{akshare-form → form/akshare-form}/index.tsx
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { Form } from 'antd';
|
3 |
-
import { IOperatorForm } from '
|
4 |
|
5 |
const AkShareForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
return (
|
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { Form } from 'antd';
|
3 |
+
import { IOperatorForm } from '../../interface';
|
4 |
|
5 |
const AkShareForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
return (
|
web/src/pages/flow/{answer-form → form/answer-form}/index.tsx
RENAMED
File without changes
|
web/src/pages/flow/{arxiv-form → form/arxiv-form}/index.tsx
RENAMED
@@ -2,7 +2,7 @@ import TopNItem from '@/components/top-n-item';
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
-
import { IOperatorForm } from '
|
6 |
|
7 |
const ArXivForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('flow');
|
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
+
import { IOperatorForm } from '../../interface';
|
6 |
|
7 |
const ArXivForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{baidu-fanyi-form → form/baidu-fanyi-form}/index.tsx
RENAMED
@@ -4,8 +4,8 @@ import { useMemo } from 'react';
|
|
4 |
import {
|
5 |
BaiduFanyiDomainOptions,
|
6 |
BaiduFanyiSourceLangOptions,
|
7 |
-
} from '
|
8 |
-
import { IOperatorForm } from '
|
9 |
|
10 |
const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => {
|
11 |
const { t } = useTranslate('flow');
|
|
|
4 |
import {
|
5 |
BaiduFanyiDomainOptions,
|
6 |
BaiduFanyiSourceLangOptions,
|
7 |
+
} from '../../constant';
|
8 |
+
import { IOperatorForm } from '../../interface';
|
9 |
|
10 |
const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => {
|
11 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{baidu-form → form/baidu-form}/index.tsx
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { Form } from 'antd';
|
3 |
-
import { IOperatorForm } from '
|
4 |
|
5 |
const BaiduForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
return (
|
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { Form } from 'antd';
|
3 |
+
import { IOperatorForm } from '../../interface';
|
4 |
|
5 |
const BaiduForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
return (
|
web/src/pages/flow/{begin-form → form/begin-form}/index.tsx
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { Form, Input } from 'antd';
|
3 |
-
import { IOperatorForm } from '
|
4 |
|
5 |
type FieldType = {
|
6 |
prologue?: string;
|
|
|
1 |
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { Form, Input } from 'antd';
|
3 |
+
import { IOperatorForm } from '../../interface';
|
4 |
|
5 |
type FieldType = {
|
6 |
prologue?: string;
|
web/src/pages/flow/{bing-form → form/bing-form}/index.tsx
RENAMED
@@ -2,8 +2,8 @@ import TopNItem from '@/components/top-n-item';
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
-
import { BingCountryOptions, BingLanguageOptions } from '
|
6 |
-
import { IOperatorForm } from '
|
7 |
|
8 |
const BingForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
+
import { BingCountryOptions, BingLanguageOptions } from '../../constant';
|
6 |
+
import { IOperatorForm } from '../../interface';
|
7 |
|
8 |
const BingForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{categorize-form → form/categorize-form}/dynamic-categorize.tsx
RENAMED
@@ -12,8 +12,8 @@ import {
|
|
12 |
useState,
|
13 |
} from 'react';
|
14 |
import { useUpdateNodeInternals } from 'reactflow';
|
15 |
-
import { Operator } from '
|
16 |
-
import { useBuildFormSelectOptions } from '
|
17 |
|
18 |
interface IProps {
|
19 |
nodeId?: string;
|
|
|
12 |
useState,
|
13 |
} from 'react';
|
14 |
import { useUpdateNodeInternals } from 'reactflow';
|
15 |
+
import { Operator } from '../../constant';
|
16 |
+
import { useBuildFormSelectOptions } from '../../form-hooks';
|
17 |
|
18 |
interface IProps {
|
19 |
nodeId?: string;
|
web/src/pages/flow/{categorize-form → form/categorize-form}/hooks.ts
RENAMED
@@ -5,8 +5,8 @@ import {
|
|
5 |
ICategorizeItem,
|
6 |
ICategorizeItemResult,
|
7 |
IOperatorForm,
|
8 |
-
} from '
|
9 |
-
import useGraphStore from '
|
10 |
|
11 |
/**
|
12 |
* convert the following object into a list
|
|
|
5 |
ICategorizeItem,
|
6 |
ICategorizeItemResult,
|
7 |
IOperatorForm,
|
8 |
+
} from '../../interface';
|
9 |
+
import useGraphStore from '../../store';
|
10 |
|
11 |
/**
|
12 |
* convert the following object into a list
|
web/src/pages/flow/{categorize-form → form/categorize-form}/index.tsx
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form } from 'antd';
|
4 |
-
import { useSetLlmSetting } from '
|
5 |
-
import { IOperatorForm } from '
|
6 |
import DynamicCategorize from './dynamic-categorize';
|
7 |
import { useHandleFormValuesChange } from './hooks';
|
8 |
|
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form } from 'antd';
|
4 |
+
import { useSetLlmSetting } from '../../hooks';
|
5 |
+
import { IOperatorForm } from '../../interface';
|
6 |
import DynamicCategorize from './dynamic-categorize';
|
7 |
import { useHandleFormValuesChange } from './hooks';
|
8 |
|
web/src/pages/flow/{concentrator-form → form/concentrator-form}/index.tsx
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
import { Form } from 'antd';
|
2 |
-
import { IOperatorForm } from '
|
3 |
|
4 |
const ConcentratorForm = ({ onValuesChange, form }: IOperatorForm) => {
|
5 |
return (
|
|
|
1 |
import { Form } from 'antd';
|
2 |
+
import { IOperatorForm } from '../../interface';
|
3 |
|
4 |
const ConcentratorForm = ({ onValuesChange, form }: IOperatorForm) => {
|
5 |
return (
|
web/src/pages/flow/{deepl-form → form/deepl-form}/index.tsx
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
-
import { DeepLSourceLangOptions, DeepLTargetLangOptions } from '
|
5 |
-
import { useBuildSortOptions } from '
|
6 |
-
import { IOperatorForm } from '
|
7 |
|
8 |
const DeepLForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
+
import { DeepLSourceLangOptions, DeepLTargetLangOptions } from '../../constant';
|
5 |
+
import { useBuildSortOptions } from '../../form-hooks';
|
6 |
+
import { IOperatorForm } from '../../interface';
|
7 |
|
8 |
const DeepLForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{duckduckgo-form → form/duckduckgo-form}/index.tsx
RENAMED
@@ -2,8 +2,8 @@ import TopNItem from '@/components/top-n-item';
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
-
import { Channel } from '
|
6 |
-
import { IOperatorForm } from '
|
7 |
|
8 |
const DuckDuckGoForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
+
import { Channel } from '../../constant';
|
6 |
+
import { IOperatorForm } from '../../interface';
|
7 |
|
8 |
const DuckDuckGoForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{exesql-form → form/exesql-form}/index.tsx
RENAMED
@@ -3,8 +3,8 @@ import { useTranslate } from '@/hooks/common-hooks';
|
|
3 |
import { useTestDbConnect } from '@/hooks/flow-hooks';
|
4 |
import { Button, Flex, Form, Input, InputNumber, Select } from 'antd';
|
5 |
import { useCallback } from 'react';
|
6 |
-
import { ExeSQLOptions } from '
|
7 |
-
import { IOperatorForm } from '
|
8 |
|
9 |
const ExeSQLForm = ({ onValuesChange, form }: IOperatorForm) => {
|
10 |
const { t } = useTranslate('flow');
|
|
|
3 |
import { useTestDbConnect } from '@/hooks/flow-hooks';
|
4 |
import { Button, Flex, Form, Input, InputNumber, Select } from 'antd';
|
5 |
import { useCallback } from 'react';
|
6 |
+
import { ExeSQLOptions } from '../../constant';
|
7 |
+
import { IOperatorForm } from '../../interface';
|
8 |
|
9 |
const ExeSQLForm = ({ onValuesChange, form }: IOperatorForm) => {
|
10 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{generate-form → form/generate-form}/dynamic-parameters.tsx
RENAMED
@@ -2,9 +2,9 @@ import { EditableCell, EditableRow } from '@/components/editable-cell';
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { DeleteOutlined } from '@ant-design/icons';
|
4 |
import { Button, Flex, Select, Table, TableProps } from 'antd';
|
5 |
-
import { IGenerateParameter } from '
|
6 |
|
7 |
-
import { useBuildComponentIdSelectOptions } from '
|
8 |
import { useHandleOperateParameters } from './hooks';
|
9 |
import styles from './index.less';
|
10 |
|
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { DeleteOutlined } from '@ant-design/icons';
|
4 |
import { Button, Flex, Select, Table, TableProps } from 'antd';
|
5 |
+
import { IGenerateParameter } from '../../interface';
|
6 |
|
7 |
+
import { useBuildComponentIdSelectOptions } from '../../hooks';
|
8 |
import { useHandleOperateParameters } from './hooks';
|
9 |
import styles from './index.less';
|
10 |
|
web/src/pages/flow/{generate-form → form/generate-form}/hooks.ts
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import get from 'lodash/get';
|
2 |
import { useCallback, useMemo } from 'react';
|
3 |
import { v4 as uuid } from 'uuid';
|
4 |
-
import { IGenerateParameter } from '
|
5 |
-
import useGraphStore from '
|
6 |
|
7 |
export const useHandleOperateParameters = (nodeId: string) => {
|
8 |
const { getNode, updateNodeForm } = useGraphStore((state) => state);
|
|
|
1 |
import get from 'lodash/get';
|
2 |
import { useCallback, useMemo } from 'react';
|
3 |
import { v4 as uuid } from 'uuid';
|
4 |
+
import { IGenerateParameter } from '../../interface';
|
5 |
+
import useGraphStore from '../../store';
|
6 |
|
7 |
export const useHandleOperateParameters = (nodeId: string) => {
|
8 |
const { getNode, updateNodeForm } = useGraphStore((state) => state);
|
web/src/pages/flow/{generate-form → form/generate-form}/index.less
RENAMED
File without changes
|
web/src/pages/flow/{generate-form → form/generate-form}/index.tsx
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input, InputNumber, Switch } from 'antd';
|
4 |
-
import { useSetLlmSetting } from '
|
5 |
-
import { IOperatorForm } from '
|
6 |
import DynamicParameters from './dynamic-parameters';
|
7 |
|
8 |
const GenerateForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input, InputNumber, Switch } from 'antd';
|
4 |
+
import { useSetLlmSetting } from '../../hooks';
|
5 |
+
import { IOperatorForm } from '../../interface';
|
6 |
import DynamicParameters from './dynamic-parameters';
|
7 |
|
8 |
const GenerateForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
web/src/pages/flow/{github-form → form/github-form}/index.tsx
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { Form } from 'antd';
|
3 |
-
import { IOperatorForm } from '
|
4 |
|
5 |
const GithubForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
return (
|
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { Form } from 'antd';
|
3 |
+
import { IOperatorForm } from '../../interface';
|
4 |
|
5 |
const GithubForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
return (
|
web/src/pages/flow/{google-form → form/google-form}/index.tsx
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input, Select } from 'antd';
|
4 |
-
import { GoogleCountryOptions, GoogleLanguageOptions } from '
|
5 |
-
import { IOperatorForm } from '
|
6 |
|
7 |
const GoogleForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('flow');
|
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input, Select } from 'antd';
|
4 |
+
import { GoogleCountryOptions, GoogleLanguageOptions } from '../../constant';
|
5 |
+
import { IOperatorForm } from '../../interface';
|
6 |
|
7 |
const GoogleForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{google-scholar-form → form/google-scholar-form}/index.tsx
RENAMED
@@ -3,8 +3,8 @@ import { useTranslate } from '@/hooks/common-hooks';
|
|
3 |
import { DatePicker, DatePickerProps, Form, Select, Switch } from 'antd';
|
4 |
import dayjs from 'dayjs';
|
5 |
import { useCallback, useMemo } from 'react';
|
6 |
-
import { useBuildSortOptions } from '
|
7 |
-
import { IOperatorForm } from '
|
8 |
|
9 |
const YearPicker = ({
|
10 |
onChange,
|
|
|
3 |
import { DatePicker, DatePickerProps, Form, Select, Switch } from 'antd';
|
4 |
import dayjs from 'dayjs';
|
5 |
import { useCallback, useMemo } from 'react';
|
6 |
+
import { useBuildSortOptions } from '../../form-hooks';
|
7 |
+
import { IOperatorForm } from '../../interface';
|
8 |
|
9 |
const YearPicker = ({
|
10 |
onChange,
|
web/src/pages/flow/{jin10-form → form/jin10-form}/index.tsx
RENAMED
@@ -8,8 +8,8 @@ import {
|
|
8 |
Jin10SymbolsDatatypeOptions,
|
9 |
Jin10SymbolsTypeOptions,
|
10 |
Jin10TypeOptions,
|
11 |
-
} from '
|
12 |
-
import { IOperatorForm } from '
|
13 |
|
14 |
const Jin10Form = ({ onValuesChange, form }: IOperatorForm) => {
|
15 |
const { t } = useTranslate('flow');
|
|
|
8 |
Jin10SymbolsDatatypeOptions,
|
9 |
Jin10SymbolsTypeOptions,
|
10 |
Jin10TypeOptions,
|
11 |
+
} from '../../constant';
|
12 |
+
import { IOperatorForm } from '../../interface';
|
13 |
|
14 |
const Jin10Form = ({ onValuesChange, form }: IOperatorForm) => {
|
15 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{keyword-extract-form → form/keyword-extract-form}/index.tsx
RENAMED
@@ -2,8 +2,8 @@ import LLMSelect from '@/components/llm-select';
|
|
2 |
import TopNItem from '@/components/top-n-item';
|
3 |
import { useTranslate } from '@/hooks/common-hooks';
|
4 |
import { Form } from 'antd';
|
5 |
-
import { useSetLlmSetting } from '
|
6 |
-
import { IOperatorForm } from '
|
7 |
|
8 |
const KeywordExtractForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
|
|
2 |
import TopNItem from '@/components/top-n-item';
|
3 |
import { useTranslate } from '@/hooks/common-hooks';
|
4 |
import { Form } from 'antd';
|
5 |
+
import { useSetLlmSetting } from '../../hooks';
|
6 |
+
import { IOperatorForm } from '../../interface';
|
7 |
|
8 |
const KeywordExtractForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{message-form → form/message-form}/index.less
RENAMED
File without changes
|
web/src/pages/flow/{message-form → form/message-form}/index.tsx
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
3 |
import { Button, Form, Input } from 'antd';
|
4 |
-
import { IOperatorForm } from '
|
5 |
|
6 |
import styles from './index.less';
|
7 |
|
|
|
1 |
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
3 |
import { Button, Form, Input } from 'antd';
|
4 |
+
import { IOperatorForm } from '../../interface';
|
5 |
|
6 |
import styles from './index.less';
|
7 |
|
web/src/pages/flow/{pubmed-form → form/pubmed-form}/index.tsx
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input } from 'antd';
|
4 |
-
import { IOperatorForm } from '
|
5 |
|
6 |
const PubMedForm = ({ onValuesChange, form }: IOperatorForm) => {
|
7 |
const { t } = useTranslate('flow');
|
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Input } from 'antd';
|
4 |
+
import { IOperatorForm } from '../../interface';
|
5 |
|
6 |
const PubMedForm = ({ onValuesChange, form }: IOperatorForm) => {
|
7 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{qweather-form → form/qweather-form}/index.tsx
RENAMED
@@ -6,8 +6,8 @@ import {
|
|
6 |
QWeatherTimePeriodOptions,
|
7 |
QWeatherTypeOptions,
|
8 |
QWeatherUserTypeOptions,
|
9 |
-
} from '
|
10 |
-
import { IOperatorForm } from '
|
11 |
|
12 |
const QWeatherForm = ({ onValuesChange, form }: IOperatorForm) => {
|
13 |
const { t } = useTranslate('flow');
|
|
|
6 |
QWeatherTimePeriodOptions,
|
7 |
QWeatherTypeOptions,
|
8 |
QWeatherUserTypeOptions,
|
9 |
+
} from '../../constant';
|
10 |
+
import { IOperatorForm } from '../../interface';
|
11 |
|
12 |
const QWeatherForm = ({ onValuesChange, form }: IOperatorForm) => {
|
13 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{relevant-form → form/relevant-form}/hooks.ts
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import pick from 'lodash/pick';
|
2 |
import { useCallback, useEffect } from 'react';
|
3 |
import { Edge } from 'reactflow';
|
4 |
-
import { IOperatorForm } from '
|
5 |
-
import useGraphStore from '
|
6 |
|
7 |
export const useBuildRelevantOptions = () => {
|
8 |
const nodes = useGraphStore((state) => state.nodes);
|
|
|
1 |
import pick from 'lodash/pick';
|
2 |
import { useCallback, useEffect } from 'react';
|
3 |
import { Edge } from 'reactflow';
|
4 |
+
import { IOperatorForm } from '../../interface';
|
5 |
+
import useGraphStore from '../../store';
|
6 |
|
7 |
export const useBuildRelevantOptions = () => {
|
8 |
const nodes = useGraphStore((state) => state.nodes);
|
web/src/pages/flow/{relevant-form → form/relevant-form}/index.tsx
RENAMED
@@ -1,10 +1,10 @@
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
-
import { Operator } from '
|
5 |
-
import { useBuildFormSelectOptions } from '
|
6 |
-
import { useSetLlmSetting } from '
|
7 |
-
import { IOperatorForm } from '
|
8 |
import { useWatchConnectionChanges } from './hooks';
|
9 |
|
10 |
const RelevantForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
+
import { Operator } from '../../constant';
|
5 |
+
import { useBuildFormSelectOptions } from '../../form-hooks';
|
6 |
+
import { useSetLlmSetting } from '../../hooks';
|
7 |
+
import { IOperatorForm } from '../../interface';
|
8 |
import { useWatchConnectionChanges } from './hooks';
|
9 |
|
10 |
const RelevantForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
web/src/pages/flow/{retrieval-form → form/retrieval-form}/index.tsx
RENAMED
@@ -5,7 +5,7 @@ import TopNItem from '@/components/top-n-item';
|
|
5 |
import { useTranslate } from '@/hooks/common-hooks';
|
6 |
import type { FormProps } from 'antd';
|
7 |
import { Form, Input } from 'antd';
|
8 |
-
import { IOperatorForm } from '
|
9 |
|
10 |
type FieldType = {
|
11 |
top_n?: number;
|
|
|
5 |
import { useTranslate } from '@/hooks/common-hooks';
|
6 |
import type { FormProps } from 'antd';
|
7 |
import { Form, Input } from 'antd';
|
8 |
+
import { IOperatorForm } from '../../interface';
|
9 |
|
10 |
type FieldType = {
|
11 |
top_n?: number;
|
web/src/pages/flow/{rewrite-question-form → form/rewrite-question-form}/index.tsx
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, InputNumber } from 'antd';
|
4 |
-
import { useSetLlmSetting } from '
|
5 |
-
import { IOperatorForm } from '
|
6 |
|
7 |
const RewriteQuestionForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('chat');
|
|
|
1 |
import LLMSelect from '@/components/llm-select';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, InputNumber } from 'antd';
|
4 |
+
import { useSetLlmSetting } from '../../hooks';
|
5 |
+
import { IOperatorForm } from '../../interface';
|
6 |
|
7 |
const RewriteQuestionForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('chat');
|
web/src/pages/flow/{switch-form → form/switch-form}/index.tsx
RENAMED
@@ -7,11 +7,11 @@ import {
|
|
7 |
SwitchElseTo,
|
8 |
SwitchLogicOperatorOptions,
|
9 |
SwitchOperatorOptions,
|
10 |
-
} from '
|
11 |
-
import { useBuildFormSelectOptions } from '
|
12 |
-
import { useBuildComponentIdSelectOptions } from '
|
13 |
-
import { IOperatorForm, ISwitchForm } from '
|
14 |
-
import { getOtherFieldValues } from '
|
15 |
|
16 |
const subLabelCol = {
|
17 |
span: 11,
|
|
|
7 |
SwitchElseTo,
|
8 |
SwitchLogicOperatorOptions,
|
9 |
SwitchOperatorOptions,
|
10 |
+
} from '../../constant';
|
11 |
+
import { useBuildFormSelectOptions } from '../../form-hooks';
|
12 |
+
import { useBuildComponentIdSelectOptions } from '../../hooks';
|
13 |
+
import { IOperatorForm, ISwitchForm } from '../../interface';
|
14 |
+
import { getOtherFieldValues } from '../../utils';
|
15 |
|
16 |
const subLabelCol = {
|
17 |
span: 11,
|
web/src/pages/flow/{tushare-form → form/tushare-form}/index.tsx
RENAMED
@@ -2,8 +2,8 @@ import { useTranslate } from '@/hooks/common-hooks';
|
|
2 |
import { DatePicker, DatePickerProps, Form, Input, Select } from 'antd';
|
3 |
import dayjs from 'dayjs';
|
4 |
import { useCallback, useMemo } from 'react';
|
5 |
-
import { TuShareSrcOptions } from '
|
6 |
-
import { IOperatorForm } from '
|
7 |
|
8 |
const DateTimePicker = ({
|
9 |
onChange,
|
|
|
2 |
import { DatePicker, DatePickerProps, Form, Input, Select } from 'antd';
|
3 |
import dayjs from 'dayjs';
|
4 |
import { useCallback, useMemo } from 'react';
|
5 |
+
import { TuShareSrcOptions } from '../../constant';
|
6 |
+
import { IOperatorForm } from '../../interface';
|
7 |
|
8 |
const DateTimePicker = ({
|
9 |
onChange,
|
web/src/pages/flow/{wencai-form → form/wencai-form}/index.tsx
RENAMED
@@ -2,8 +2,8 @@ import TopNItem from '@/components/top-n-item';
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
-
import { WenCaiQueryTypeOptions } from '
|
6 |
-
import { IOperatorForm } from '
|
7 |
|
8 |
const WenCaiForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
|
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
import { useMemo } from 'react';
|
5 |
+
import { WenCaiQueryTypeOptions } from '../../constant';
|
6 |
+
import { IOperatorForm } from '../../interface';
|
7 |
|
8 |
const WenCaiForm = ({ onValuesChange, form }: IOperatorForm) => {
|
9 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/{wikipedia-form → form/wikipedia-form}/index.tsx
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
-
import { LanguageOptions } from '
|
5 |
-
import { IOperatorForm } from '
|
6 |
|
7 |
const WikipediaForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('common');
|
|
|
1 |
import TopNItem from '@/components/top-n-item';
|
2 |
import { useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Form, Select } from 'antd';
|
4 |
+
import { LanguageOptions } from '../../constant';
|
5 |
+
import { IOperatorForm } from '../../interface';
|
6 |
|
7 |
const WikipediaForm = ({ onValuesChange, form }: IOperatorForm) => {
|
8 |
const { t } = useTranslate('common');
|
web/src/pages/flow/{yahoo-finance-form → form/yahoo-finance-form}/index.tsx
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { Form, Switch } from 'antd';
|
3 |
-
import { IOperatorForm } from '
|
4 |
|
5 |
const YahooFinanceForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
const { t } = useTranslate('flow');
|
|
|
1 |
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
import { Form, Switch } from 'antd';
|
3 |
+
import { IOperatorForm } from '../../interface';
|
4 |
|
5 |
const YahooFinanceForm = ({ onValuesChange, form }: IOperatorForm) => {
|
6 |
const { t } = useTranslate('flow');
|
web/src/pages/flow/hooks.ts
CHANGED
@@ -49,6 +49,7 @@ import {
|
|
49 |
initialJin10Values,
|
50 |
initialKeywordExtractValues,
|
51 |
initialMessageValues,
|
|
|
52 |
initialPubMedValues,
|
53 |
initialQWeatherValues,
|
54 |
initialRelevantValues,
|
@@ -125,6 +126,7 @@ export const useInitializeOperatorParams = () => {
|
|
125 |
[Operator.Jin10]: initialJin10Values,
|
126 |
[Operator.Concentrator]: initialConcentratorValues,
|
127 |
[Operator.TuShare]: initialTuShareValues,
|
|
|
128 |
};
|
129 |
}, [llmId]);
|
130 |
|
|
|
49 |
initialJin10Values,
|
50 |
initialKeywordExtractValues,
|
51 |
initialMessageValues,
|
52 |
+
initialNoteValues,
|
53 |
initialPubMedValues,
|
54 |
initialQWeatherValues,
|
55 |
initialRelevantValues,
|
|
|
126 |
[Operator.Jin10]: initialJin10Values,
|
127 |
[Operator.Concentrator]: initialConcentratorValues,
|
128 |
[Operator.TuShare]: initialTuShareValues,
|
129 |
+
[Operator.Note]: initialNoteValues,
|
130 |
};
|
131 |
}, [llmId]);
|
132 |
|
web/src/pages/flow/utils.ts
CHANGED
@@ -122,21 +122,23 @@ export const buildDslComponentsByGraph = (
|
|
122 |
): DSLComponents => {
|
123 |
const components: DSLComponents = {};
|
124 |
|
125 |
-
nodes
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
140 |
|
141 |
return components;
|
142 |
};
|
|
|
122 |
): DSLComponents => {
|
123 |
const components: DSLComponents = {};
|
124 |
|
125 |
+
nodes
|
126 |
+
.filter((x) => x.data.label !== Operator.Note)
|
127 |
+
.forEach((x) => {
|
128 |
+
const id = x.id;
|
129 |
+
const operatorName = x.data.label;
|
130 |
+
components[id] = {
|
131 |
+
obj: {
|
132 |
+
component_name: operatorName,
|
133 |
+
params:
|
134 |
+
buildOperatorParams(operatorName)(
|
135 |
+
x.data.form as Record<string, unknown>,
|
136 |
+
) ?? {},
|
137 |
+
},
|
138 |
+
downstream: buildComponentDownstreamOrUpstream(edges, id, true),
|
139 |
+
upstream: buildComponentDownstreamOrUpstream(edges, id, false),
|
140 |
+
};
|
141 |
+
});
|
142 |
|
143 |
return components;
|
144 |
};
|