balibabu
commited on
Commit
·
ba19dbf
1
Parent(s):
f3a1380
feat: add duckduckgo icon #918 (#1391)
Browse files### What problem does this PR solve?
feat: add duckduckgo icon #918
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
web/src/assets/svg/baidu.svg
ADDED
|
web/src/assets/svg/duck.svg
ADDED
|
web/src/assets/svg/keyword.svg
ADDED
|
web/src/pages/flow/constant.tsx
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
import { variableEnabledFieldMap } from '@/constants/chat';
|
2 |
import {
|
3 |
BranchesOutlined,
|
@@ -19,6 +22,9 @@ export enum Operator {
|
|
19 |
Message = 'Message',
|
20 |
Relevant = 'Relevant',
|
21 |
RewriteQuestion = 'RewriteQuestion',
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
export const operatorIconMap = {
|
@@ -30,6 +36,9 @@ export const operatorIconMap = {
|
|
30 |
[Operator.Message]: MessageOutlined,
|
31 |
[Operator.Relevant]: BranchesOutlined,
|
32 |
[Operator.RewriteQuestion]: FormOutlined,
|
|
|
|
|
|
|
33 |
};
|
34 |
|
35 |
export const operatorMap = {
|
@@ -116,6 +125,18 @@ export const componentMenuList = [
|
|
116 |
name: Operator.RewriteQuestion,
|
117 |
description: operatorMap[Operator.RewriteQuestion].description,
|
118 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
];
|
120 |
|
121 |
export const initialRetrievalValues = {
|
@@ -200,11 +221,21 @@ export const CategorizeAnchorPointPositions = [
|
|
200 |
// key is the source of the edge, value is the target of the edge
|
201 |
// no connection lines are allowed between key and value
|
202 |
export const RestrictedUpstreamMap = {
|
203 |
-
[Operator.Begin]: [],
|
204 |
-
[Operator.Categorize]: [
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
[Operator.Message]: [
|
209 |
Operator.Begin,
|
210 |
Operator.Message,
|
@@ -212,14 +243,16 @@ export const RestrictedUpstreamMap = {
|
|
212 |
Operator.Retrieval,
|
213 |
Operator.RewriteQuestion,
|
214 |
Operator.Categorize,
|
|
|
215 |
],
|
216 |
-
[Operator.Relevant]: [Operator.Begin, Operator.Answer],
|
217 |
[Operator.RewriteQuestion]: [
|
218 |
Operator.Begin,
|
219 |
Operator.Message,
|
220 |
Operator.Generate,
|
221 |
Operator.RewriteQuestion,
|
222 |
Operator.Categorize,
|
|
|
223 |
],
|
224 |
};
|
225 |
|
|
|
1 |
+
import { ReactComponent as BaiduIcon } from '@/assets/svg/baidu.svg';
|
2 |
+
import { ReactComponent as DuckIcon } from '@/assets/svg/duck.svg';
|
3 |
+
import { ReactComponent as KeywordIcon } from '@/assets/svg/keyword.svg';
|
4 |
import { variableEnabledFieldMap } from '@/constants/chat';
|
5 |
import {
|
6 |
BranchesOutlined,
|
|
|
22 |
Message = 'Message',
|
23 |
Relevant = 'Relevant',
|
24 |
RewriteQuestion = 'RewriteQuestion',
|
25 |
+
KeywordExtract = 'KeywordExtract',
|
26 |
+
Baidu = 'Baidu',
|
27 |
+
DuckDuckGo = 'DuckDuckGo',
|
28 |
}
|
29 |
|
30 |
export const operatorIconMap = {
|
|
|
36 |
[Operator.Message]: MessageOutlined,
|
37 |
[Operator.Relevant]: BranchesOutlined,
|
38 |
[Operator.RewriteQuestion]: FormOutlined,
|
39 |
+
[Operator.KeywordExtract]: KeywordIcon,
|
40 |
+
[Operator.DuckDuckGo]: DuckIcon,
|
41 |
+
[Operator.Baidu]: BaiduIcon,
|
42 |
};
|
43 |
|
44 |
export const operatorMap = {
|
|
|
125 |
name: Operator.RewriteQuestion,
|
126 |
description: operatorMap[Operator.RewriteQuestion].description,
|
127 |
},
|
128 |
+
// {
|
129 |
+
// name: Operator.KeywordExtract,
|
130 |
+
// description: operatorMap[Operator.Message].description,
|
131 |
+
// },
|
132 |
+
// {
|
133 |
+
// name: Operator.DuckDuckGo,
|
134 |
+
// description: operatorMap[Operator.Relevant].description,
|
135 |
+
// },
|
136 |
+
// {
|
137 |
+
// name: Operator.Baidu,
|
138 |
+
// description: operatorMap[Operator.RewriteQuestion].description,
|
139 |
+
// },
|
140 |
];
|
141 |
|
142 |
export const initialRetrievalValues = {
|
|
|
221 |
// key is the source of the edge, value is the target of the edge
|
222 |
// no connection lines are allowed between key and value
|
223 |
export const RestrictedUpstreamMap = {
|
224 |
+
[Operator.Begin]: [Operator.Relevant],
|
225 |
+
[Operator.Categorize]: [
|
226 |
+
Operator.Begin,
|
227 |
+
Operator.Categorize,
|
228 |
+
Operator.Answer,
|
229 |
+
Operator.Relevant,
|
230 |
+
],
|
231 |
+
[Operator.Answer]: [
|
232 |
+
Operator.Begin,
|
233 |
+
Operator.Answer,
|
234 |
+
Operator.Message,
|
235 |
+
Operator.Relevant,
|
236 |
+
],
|
237 |
+
[Operator.Retrieval]: [Operator.Begin, Operator.Retrieval],
|
238 |
+
[Operator.Generate]: [Operator.Begin, Operator.Relevant],
|
239 |
[Operator.Message]: [
|
240 |
Operator.Begin,
|
241 |
Operator.Message,
|
|
|
243 |
Operator.Retrieval,
|
244 |
Operator.RewriteQuestion,
|
245 |
Operator.Categorize,
|
246 |
+
Operator.Relevant,
|
247 |
],
|
248 |
+
[Operator.Relevant]: [Operator.Begin, Operator.Answer, Operator.Relevant],
|
249 |
[Operator.RewriteQuestion]: [
|
250 |
Operator.Begin,
|
251 |
Operator.Message,
|
252 |
Operator.Generate,
|
253 |
Operator.RewriteQuestion,
|
254 |
Operator.Categorize,
|
255 |
+
Operator.Relevant,
|
256 |
],
|
257 |
};
|
258 |
|
web/src/pages/flow/flow-sider/index.tsx
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import { useTranslate } from '@/hooks/commonHooks';
|
2 |
-
import { Card, Flex, Layout,
|
3 |
import classNames from 'classnames';
|
4 |
import lowerFirst from 'lodash/lowerFirst';
|
5 |
-
import { componentMenuList } from '../constant';
|
6 |
import { useHandleDrag } from '../hooks';
|
7 |
import OperatorIcon from '../operator-icon';
|
8 |
import styles from './index.less';
|
@@ -29,24 +29,35 @@ const FlowSide = ({ setCollapsed, collapsed }: IProps) => {
|
|
29 |
<Flex vertical gap={10} className={styles.siderContent}>
|
30 |
{componentMenuList.map((x) => {
|
31 |
return (
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
<OperatorIcon name={x.name}></OperatorIcon>
|
42 |
<section>
|
43 |
<Tooltip title={t(`${lowerFirst(x.name)}Description`)}>
|
44 |
<b>{x.name}</b>
|
45 |
</Tooltip>
|
46 |
</section>
|
47 |
-
</
|
48 |
-
</
|
49 |
-
|
50 |
);
|
51 |
})}
|
52 |
</Flex>
|
|
|
1 |
import { useTranslate } from '@/hooks/commonHooks';
|
2 |
+
import { Card, Divider, Flex, Layout, Tooltip } from 'antd';
|
3 |
import classNames from 'classnames';
|
4 |
import lowerFirst from 'lodash/lowerFirst';
|
5 |
+
import { Operator, componentMenuList } from '../constant';
|
6 |
import { useHandleDrag } from '../hooks';
|
7 |
import OperatorIcon from '../operator-icon';
|
8 |
import styles from './index.less';
|
|
|
29 |
<Flex vertical gap={10} className={styles.siderContent}>
|
30 |
{componentMenuList.map((x) => {
|
31 |
return (
|
32 |
+
<>
|
33 |
+
{x.name === Operator.DuckDuckGo && (
|
34 |
+
<Divider
|
35 |
+
style={{
|
36 |
+
marginTop: 10,
|
37 |
+
marginBottom: 10,
|
38 |
+
padding: 0,
|
39 |
+
borderBlockColor: '#b4afaf',
|
40 |
+
borderStyle: 'dotted',
|
41 |
+
}}
|
42 |
+
></Divider>
|
43 |
+
)}
|
44 |
+
<Card
|
45 |
+
key={x.name}
|
46 |
+
hoverable
|
47 |
+
draggable
|
48 |
+
className={classNames(styles.operatorCard)}
|
49 |
+
onDragStart={handleDragStart(x.name)}
|
50 |
+
>
|
51 |
+
<Flex align="center" gap={15}>
|
52 |
<OperatorIcon name={x.name}></OperatorIcon>
|
53 |
<section>
|
54 |
<Tooltip title={t(`${lowerFirst(x.name)}Description`)}>
|
55 |
<b>{x.name}</b>
|
56 |
</Tooltip>
|
57 |
</section>
|
58 |
+
</Flex>
|
59 |
+
</Card>
|
60 |
+
</>
|
61 |
);
|
62 |
})}
|
63 |
</Flex>
|
web/src/pages/flow/operator-icon/index.less
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
.icon {
|
2 |
color: rgb(59, 118, 244);
|
3 |
font-size: 24px;
|
|
|
|
|
4 |
}
|
|
|
1 |
.icon {
|
2 |
color: rgb(59, 118, 244);
|
3 |
font-size: 24px;
|
4 |
+
max-width: 24px;
|
5 |
+
max-height: 24px;
|
6 |
}
|