balibabu
commited on
Commit
·
9bf66a3
1
Parent(s):
68f947e
Feat: Supports page rank score for different knowledge bases. #3794 (#3800)
Browse files### What problem does this PR solve?
Feat: Supports page rank score for different knowledge bases. #3794
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
web/src/components/editable-cell.tsx
CHANGED
@@ -2,7 +2,7 @@ import { Form, FormInstance, Input, InputRef, Typography } from 'antd';
|
|
2 |
import React, { useContext, useEffect, useRef, useState } from 'react';
|
3 |
|
4 |
const EditableContext = React.createContext<FormInstance<any> | null>(null);
|
5 |
-
const {
|
6 |
|
7 |
interface EditableRowProps {
|
8 |
index: number;
|
@@ -95,9 +95,7 @@ export const EditableCell: React.FC<EditableCellProps> = ({
|
|
95 |
// style={{ paddingRight: 24 }}
|
96 |
onClick={toggleEdit}
|
97 |
>
|
98 |
-
<Text
|
99 |
-
{children}
|
100 |
-
</Text>
|
101 |
</div>
|
102 |
);
|
103 |
}
|
|
|
2 |
import React, { useContext, useEffect, useRef, useState } from 'react';
|
3 |
|
4 |
const EditableContext = React.createContext<FormInstance<any> | null>(null);
|
5 |
+
const { Text } = Typography;
|
6 |
|
7 |
interface EditableRowProps {
|
8 |
index: number;
|
|
|
95 |
// style={{ paddingRight: 24 }}
|
96 |
onClick={toggleEdit}
|
97 |
>
|
98 |
+
<Text>{children}</Text>
|
|
|
|
|
99 |
</div>
|
100 |
);
|
101 |
}
|
web/src/components/page-rank.tsx
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { useTranslate } from '@/hooks/common-hooks';
|
2 |
+
import { Flex, Form, InputNumber, Slider } from 'antd';
|
3 |
+
|
4 |
+
const PageRank = () => {
|
5 |
+
const { t } = useTranslate('knowledgeConfiguration');
|
6 |
+
|
7 |
+
return (
|
8 |
+
<Form.Item label={t('pageRank')} tooltip={t('pageRankTip')}>
|
9 |
+
<Flex gap={20} align="center">
|
10 |
+
<Flex flex={1}>
|
11 |
+
<Form.Item
|
12 |
+
name={['parser_config', 'pagerank']}
|
13 |
+
noStyle
|
14 |
+
initialValue={0}
|
15 |
+
rules={[{ required: true }]}
|
16 |
+
>
|
17 |
+
<Slider max={100} style={{ width: '100%' }} />
|
18 |
+
</Form.Item>
|
19 |
+
</Flex>
|
20 |
+
<Form.Item
|
21 |
+
name={['parser_config', 'pagerank']}
|
22 |
+
noStyle
|
23 |
+
initialValue={0}
|
24 |
+
rules={[{ required: true }]}
|
25 |
+
>
|
26 |
+
<InputNumber max={100} min={0} />
|
27 |
+
</Form.Item>
|
28 |
+
</Flex>
|
29 |
+
</Form.Item>
|
30 |
+
);
|
31 |
+
};
|
32 |
+
|
33 |
+
export default PageRank;
|
web/src/locales/en.ts
CHANGED
@@ -303,6 +303,9 @@ The above is the content you need to summarize.`,
|
|
303 |
randomSeed: 'Random seed',
|
304 |
randomSeedMessage: 'Random seed is required',
|
305 |
entityTypes: 'Entity types',
|
|
|
|
|
|
|
306 |
},
|
307 |
chunk: {
|
308 |
chunk: 'Chunk',
|
|
|
303 |
randomSeed: 'Random seed',
|
304 |
randomSeedMessage: 'Random seed is required',
|
305 |
entityTypes: 'Entity types',
|
306 |
+
pageRank: 'Page rank',
|
307 |
+
pageRankTip: `This is used to boost the relevance score. The relevance score with all the retrieved chunks will plus this number.
|
308 |
+
When you want to search the given knowledge base at first place, set a higher pagerank score than others.`,
|
309 |
},
|
310 |
chunk: {
|
311 |
chunk: 'Chunk',
|
web/src/locales/zh-traditional.ts
CHANGED
@@ -287,6 +287,9 @@ export default {
|
|
287 |
thresholdTip: '閾值越大,聚類越少。',
|
288 |
maxClusterTip: '最大聚類數。',
|
289 |
entityTypes: '實體類型',
|
|
|
|
|
|
|
290 |
},
|
291 |
chunk: {
|
292 |
chunk: '解析塊',
|
|
|
287 |
thresholdTip: '閾值越大,聚類越少。',
|
288 |
maxClusterTip: '最大聚類數。',
|
289 |
entityTypes: '實體類型',
|
290 |
+
pageRank: '頁面排名',
|
291 |
+
pageRankTip: `這用來提高相關性分數。所有檢索到的區塊的相關性得分將加上該數字。
|
292 |
+
當您想要先搜尋給定的知識庫時,請設定比其他人更高的 pagerank 分數。`,
|
293 |
},
|
294 |
chunk: {
|
295 |
chunk: '解析塊',
|
web/src/locales/zh.ts
CHANGED
@@ -304,6 +304,9 @@ export default {
|
|
304 |
thresholdTip: '阈值越大,聚类越少。',
|
305 |
maxClusterTip: '最大聚类数。',
|
306 |
entityTypes: '实体类型',
|
|
|
|
|
|
|
307 |
},
|
308 |
chunk: {
|
309 |
chunk: '解析块',
|
|
|
304 |
thresholdTip: '阈值越大,聚类越少。',
|
305 |
maxClusterTip: '最大聚类数。',
|
306 |
entityTypes: '实体类型',
|
307 |
+
pageRank: '页面排名',
|
308 |
+
pageRankTip: `这用于提高相关性得分。所有检索到的块的相关性得分将加上此数字。
|
309 |
+
当您想首先搜索给定的知识库时,请设置比其他知识库更高的 pagerank 得分。`,
|
310 |
},
|
311 |
chunk: {
|
312 |
chunk: '解析块',
|
web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx
CHANGED
@@ -8,6 +8,7 @@ import EntityTypesItem from '@/components/entity-types-item';
|
|
8 |
import ExcelToHtml from '@/components/excel-to-html';
|
9 |
import LayoutRecognize from '@/components/layout-recognize';
|
10 |
import MaxTokenNumber from '@/components/max-token-number';
|
|
|
11 |
import ParseConfiguration, {
|
12 |
showRaptorParseConfiguration,
|
13 |
} from '@/components/parse-configuration';
|
@@ -112,7 +113,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
|
|
112 |
))}
|
113 |
</Select>
|
114 |
</Form.Item>
|
115 |
-
|
116 |
<Form.Item noStyle dependencies={['parser_id']}>
|
117 |
{({ getFieldValue }) => {
|
118 |
const parserId = getFieldValue('parser_id');
|
|
|
8 |
import ExcelToHtml from '@/components/excel-to-html';
|
9 |
import LayoutRecognize from '@/components/layout-recognize';
|
10 |
import MaxTokenNumber from '@/components/max-token-number';
|
11 |
+
import PageRank from '@/components/page-rank';
|
12 |
import ParseConfiguration, {
|
13 |
showRaptorParseConfiguration,
|
14 |
} from '@/components/parse-configuration';
|
|
|
113 |
))}
|
114 |
</Select>
|
115 |
</Form.Item>
|
116 |
+
<PageRank></PageRank>
|
117 |
<Form.Item noStyle dependencies={['parser_id']}>
|
118 |
{({ getFieldValue }) => {
|
119 |
const parserId = getFieldValue('parser_id');
|