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:
balibabu
2024-08-13 15:21:03 +08:00
committed by GitHub
parent 77f0fb03e3
commit 7a08e91909
7 changed files with 67 additions and 11 deletions

View File

@ -6,6 +6,7 @@ import ParseConfiguration, {
showRaptorParseConfiguration,
} from '@/components/parse-configuration';
import { useTranslate } from '@/hooks/common-hooks';
import { useHandleChunkMethodSelectChange } from '@/hooks/logic-hooks';
import { normFile } from '@/utils/file-util';
import { PlusOutlined } from '@ant-design/icons';
import { Button, Form, Input, Radio, Select, Space, Upload } from 'antd';
@ -24,6 +25,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
const { parserList, embeddingModelOptions, disabled } =
useFetchKnowledgeConfigurationOnMount(form);
const { t } = useTranslate('knowledgeConfiguration');
const handleChunkMethodSelectChange = useHandleChunkMethodSelectChange(form);
return (
<Form form={form} name="validateOnly" layout="vertical" autoComplete="off">
@ -91,7 +93,11 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
tooltip={t('chunkMethodTip')}
rules={[{ required: true }]}
>
<Select placeholder={t('chunkMethodPlaceholder')} disabled={disabled}>
<Select
placeholder={t('chunkMethodPlaceholder')}
disabled={disabled}
onChange={handleChunkMethodSelectChange}
>
{parserList.map((x) => (
<Option value={x.value} key={x.value}>
{x.label}
@ -107,7 +113,11 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
return (
<>
{parserId === 'knowledge_graph' && (
<EntityTypesItem></EntityTypesItem>
<>
<EntityTypesItem></EntityTypesItem>
<MaxTokenNumber max={8192 * 2}></MaxTokenNumber>
<Delimiter></Delimiter>
</>
)}
{parserId === 'naive' && (
<>