mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: After selecting the parsing method as knowledge graph, the delimiter and chunk token number are displayed. #1594 (#1929)
### What problem does this PR solve? feat: After selecting the parsing method as knowledge graph, the delimiter and chunk token number are displayed. #1594 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -8,6 +8,7 @@ import { IChangeParserConfigRequestBody } from '@/interfaces/request/document';
|
||||
import api from '@/utils/api';
|
||||
import { getAuthorization } from '@/utils/authorization-util';
|
||||
import { PaginationProps } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import axios from 'axios';
|
||||
import { EventSourceParserStream } from 'eventsource-parser/stream';
|
||||
import {
|
||||
@ -337,3 +338,25 @@ export const useFetchModelId = () => {
|
||||
|
||||
return tenantInfo?.llm_id ?? '';
|
||||
};
|
||||
|
||||
const ChunkTokenNumMap = {
|
||||
naive: 128,
|
||||
knowledge_graph: 8192,
|
||||
};
|
||||
|
||||
export const useHandleChunkMethodSelectChange = (form: FormInstance) => {
|
||||
// const form = Form.useFormInstance();
|
||||
const handleChange = useCallback(
|
||||
(value: string) => {
|
||||
if (value in ChunkTokenNumMap) {
|
||||
form.setFieldValue(
|
||||
['parser_config', 'chunk_token_num'],
|
||||
ChunkTokenNumMap[value as keyof typeof ChunkTokenNumMap],
|
||||
);
|
||||
}
|
||||
},
|
||||
[form],
|
||||
);
|
||||
|
||||
return handleChange;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user