mirror of
				https://github.com/infiniflow/ragflow.git
				synced 2025-10-31 01:40:20 +00:00 
			
		
		
		
	### 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)
This commit is contained in:
		
							parent
							
								
									69fb323581
								
							
						
					
					
						commit
						8b650fc9ef
					
				| @ -2,7 +2,7 @@ import { Form, FormInstance, Input, InputRef, Typography } from 'antd'; | |||||||
| import React, { useContext, useEffect, useRef, useState } from 'react'; | import React, { useContext, useEffect, useRef, useState } from 'react'; | ||||||
| 
 | 
 | ||||||
| const EditableContext = React.createContext<FormInstance<any> | null>(null); | const EditableContext = React.createContext<FormInstance<any> | null>(null); | ||||||
| const { Paragraph, Text } = Typography; | const { Text } = Typography; | ||||||
| 
 | 
 | ||||||
| interface EditableRowProps { | interface EditableRowProps { | ||||||
|   index: number; |   index: number; | ||||||
| @ -95,9 +95,7 @@ export const EditableCell: React.FC<EditableCellProps> = ({ | |||||||
|         // style={{ paddingRight: 24 }}
 |         // style={{ paddingRight: 24 }}
 | ||||||
|         onClick={toggleEdit} |         onClick={toggleEdit} | ||||||
|       > |       > | ||||||
|         <Text ellipsis={{ tooltip: children }} style={{ width: 70 }}> |         <Text>{children}</Text> | ||||||
|           {children} |  | ||||||
|         </Text> |  | ||||||
|       </div> |       </div> | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  | |||||||
							
								
								
									
										33
									
								
								web/src/components/page-rank.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								web/src/components/page-rank.tsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | |||||||
|  | import { useTranslate } from '@/hooks/common-hooks'; | ||||||
|  | import { Flex, Form, InputNumber, Slider } from 'antd'; | ||||||
|  | 
 | ||||||
|  | const PageRank = () => { | ||||||
|  |   const { t } = useTranslate('knowledgeConfiguration'); | ||||||
|  | 
 | ||||||
|  |   return ( | ||||||
|  |     <Form.Item label={t('pageRank')} tooltip={t('pageRankTip')}> | ||||||
|  |       <Flex gap={20} align="center"> | ||||||
|  |         <Flex flex={1}> | ||||||
|  |           <Form.Item | ||||||
|  |             name={['parser_config', 'pagerank']} | ||||||
|  |             noStyle | ||||||
|  |             initialValue={0} | ||||||
|  |             rules={[{ required: true }]} | ||||||
|  |           > | ||||||
|  |             <Slider max={100} style={{ width: '100%' }} /> | ||||||
|  |           </Form.Item> | ||||||
|  |         </Flex> | ||||||
|  |         <Form.Item | ||||||
|  |           name={['parser_config', 'pagerank']} | ||||||
|  |           noStyle | ||||||
|  |           initialValue={0} | ||||||
|  |           rules={[{ required: true }]} | ||||||
|  |         > | ||||||
|  |           <InputNumber max={100} min={0} /> | ||||||
|  |         </Form.Item> | ||||||
|  |       </Flex> | ||||||
|  |     </Form.Item> | ||||||
|  |   ); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | export default PageRank; | ||||||
| @ -303,6 +303,9 @@ The above is the content you need to summarize.`, | |||||||
|       randomSeed: 'Random seed', |       randomSeed: 'Random seed', | ||||||
|       randomSeedMessage: 'Random seed is required', |       randomSeedMessage: 'Random seed is required', | ||||||
|       entityTypes: 'Entity types', |       entityTypes: 'Entity types', | ||||||
|  |       pageRank: 'Page rank', | ||||||
|  |       pageRankTip: `This is used to boost the relevance score. The relevance score with all the retrieved chunks will plus this number.
 | ||||||
|  | When you want to search the given knowledge base at first place, set a higher pagerank score than others.`,
 | ||||||
|     }, |     }, | ||||||
|     chunk: { |     chunk: { | ||||||
|       chunk: 'Chunk', |       chunk: 'Chunk', | ||||||
|  | |||||||
| @ -287,6 +287,9 @@ export default { | |||||||
|       thresholdTip: '閾值越大,聚類越少。', |       thresholdTip: '閾值越大,聚類越少。', | ||||||
|       maxClusterTip: '最大聚類數。', |       maxClusterTip: '最大聚類數。', | ||||||
|       entityTypes: '實體類型', |       entityTypes: '實體類型', | ||||||
|  |       pageRank: '頁面排名', | ||||||
|  |       pageRankTip: `這用來提高相關性分數。所有檢索到的區塊的相關性得分將加上該數字。
 | ||||||
|  | 當您想要先搜尋給定的知識庫時,請設定比其他人更高的 pagerank 分數。`,
 | ||||||
|     }, |     }, | ||||||
|     chunk: { |     chunk: { | ||||||
|       chunk: '解析塊', |       chunk: '解析塊', | ||||||
|  | |||||||
| @ -304,6 +304,9 @@ export default { | |||||||
|       thresholdTip: '阈值越大,聚类越少。', |       thresholdTip: '阈值越大,聚类越少。', | ||||||
|       maxClusterTip: '最大聚类数。', |       maxClusterTip: '最大聚类数。', | ||||||
|       entityTypes: '实体类型', |       entityTypes: '实体类型', | ||||||
|  |       pageRank: '页面排名', | ||||||
|  |       pageRankTip: `这用于提高相关性得分。所有检索到的块的相关性得分将加上此数字。
 | ||||||
|  | 当您想首先搜索给定的知识库时,请设置比其他知识库更高的 pagerank 得分。`,
 | ||||||
|     }, |     }, | ||||||
|     chunk: { |     chunk: { | ||||||
|       chunk: '解析块', |       chunk: '解析块', | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ import EntityTypesItem from '@/components/entity-types-item'; | |||||||
| import ExcelToHtml from '@/components/excel-to-html'; | import ExcelToHtml from '@/components/excel-to-html'; | ||||||
| import LayoutRecognize from '@/components/layout-recognize'; | import LayoutRecognize from '@/components/layout-recognize'; | ||||||
| import MaxTokenNumber from '@/components/max-token-number'; | import MaxTokenNumber from '@/components/max-token-number'; | ||||||
|  | import PageRank from '@/components/page-rank'; | ||||||
| import ParseConfiguration, { | import ParseConfiguration, { | ||||||
|   showRaptorParseConfiguration, |   showRaptorParseConfiguration, | ||||||
| } from '@/components/parse-configuration'; | } from '@/components/parse-configuration'; | ||||||
| @ -112,7 +113,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => { | |||||||
|           ))} |           ))} | ||||||
|         </Select> |         </Select> | ||||||
|       </Form.Item> |       </Form.Item> | ||||||
| 
 |       <PageRank></PageRank> | ||||||
|       <Form.Item noStyle dependencies={['parser_id']}> |       <Form.Item noStyle dependencies={['parser_id']}> | ||||||
|         {({ getFieldValue }) => { |         {({ getFieldValue }) => { | ||||||
|           const parserId = getFieldValue('parser_id'); |           const parserId = getFieldValue('parser_id'); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 balibabu
						balibabu