feat: add pages to ChunkMethodModal (#143)
This commit is contained in:
@@ -1,22 +1,12 @@
|
||||
import { normFile } from '@/utils/fileUtil';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
Button,
|
||||
Flex,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Radio,
|
||||
Select,
|
||||
Slider,
|
||||
Space,
|
||||
Upload,
|
||||
} from 'antd';
|
||||
import { Button, Form, Input, Radio, Select, Space, Upload } from 'antd';
|
||||
import {
|
||||
useFetchKnowledgeConfigurationOnMount,
|
||||
useSubmitKnowledgeConfiguration,
|
||||
} from './hooks';
|
||||
|
||||
import MaxTokenNumber from '@/components/max-token-number';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import styles from './index.less';
|
||||
|
||||
@@ -121,35 +111,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
|
||||
const parserId = getFieldValue('parser_id');
|
||||
|
||||
if (parserId === 'naive') {
|
||||
return (
|
||||
<Form.Item label="Token number" tooltip="It determine the token number of a chunk approximately.">
|
||||
<Flex gap={20} align="center">
|
||||
<Flex flex={1}>
|
||||
<Form.Item
|
||||
name={['parser_config', 'chunk_token_num']}
|
||||
noStyle
|
||||
initialValue={128}
|
||||
rules={[
|
||||
{ required: true, message: 'Province is required' },
|
||||
]}
|
||||
>
|
||||
<Slider className={styles.variableSlider} max={2048} />
|
||||
</Form.Item>
|
||||
</Flex>
|
||||
<Form.Item
|
||||
name={['parser_config', 'chunk_token_num']}
|
||||
noStyle
|
||||
rules={[{ required: true, message: 'Street is required' }]}
|
||||
>
|
||||
<InputNumber
|
||||
className={styles.sliderInputNumber}
|
||||
max={2048}
|
||||
min={0}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Flex>
|
||||
</Form.Item>
|
||||
);
|
||||
return <MaxTokenNumber></MaxTokenNumber>;
|
||||
}
|
||||
return null;
|
||||
}}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { DvaModel } from 'umi';
|
||||
|
||||
export interface KSModelState {
|
||||
isShowPSwModal: boolean;
|
||||
isShowTntModal: boolean;
|
||||
tenantIfo: any;
|
||||
knowledgeDetails: IKnowledge;
|
||||
}
|
||||
@@ -14,7 +13,6 @@ const model: DvaModel<KSModelState> = {
|
||||
namespace: 'kSModel',
|
||||
state: {
|
||||
isShowPSwModal: false,
|
||||
isShowTntModal: false,
|
||||
tenantIfo: {},
|
||||
knowledgeDetails: {} as any,
|
||||
},
|
||||
|
||||
@@ -5,9 +5,9 @@ const getImageName = (prefix: string, length: number) =>
|
||||
|
||||
export const ImageMap = {
|
||||
book: getImageName('book', 4),
|
||||
laws: getImageName('law', 4),
|
||||
laws: getImageName('law', 2),
|
||||
manual: getImageName('manual', 4),
|
||||
picture: getImageName('picture', 2),
|
||||
picture: getImageName('media', 2),
|
||||
naive: getImageName('naive', 2),
|
||||
paper: getImageName('paper', 2),
|
||||
presentation: getImageName('presentation', 2),
|
||||
@@ -32,10 +32,13 @@ export const TextMap = {
|
||||
The chunk granularity is consistent with 'ARTICLE', and all the upper level text will be included in the chunk.
|
||||
</p>`,
|
||||
},
|
||||
manual: { title: '', description: `<p>Only <b>PDF</b> is supported.</p><p>
|
||||
manual: {
|
||||
title: '',
|
||||
description: `<p>Only <b>PDF</b> is supported.</p><p>
|
||||
We assume manual has hierarchical section structure. We use the lowest section titles as pivots to slice documents.
|
||||
So, the figures and tables in the same section will not be sliced apart, and chunk size might be large.
|
||||
</p>` },
|
||||
</p>`,
|
||||
},
|
||||
naive: {
|
||||
title: '',
|
||||
description: `<p>Supported file formats are <b>DOCX, EXCEL, PPT, IMAGE, PDF, TXT</b>.</p>
|
||||
@@ -100,19 +103,19 @@ export const TextMap = {
|
||||
</li>
|
||||
<li>Every row in table will be treated as a chunk.</li>
|
||||
</ul>`,
|
||||
},
|
||||
picture: {
|
||||
title: '',
|
||||
description: `
|
||||
},
|
||||
picture: {
|
||||
title: '',
|
||||
description: `
|
||||
<p>Image files are supported. Video is coming soon.</p><p>
|
||||
If the picture has text in it, OCR is applied to extract the text as its text description.
|
||||
</p><p>
|
||||
If the text extracted by OCR is not enough, visual LLM is used to get the descriptions.
|
||||
</p>`,
|
||||
},
|
||||
one: {
|
||||
title: '',
|
||||
description: `
|
||||
one: {
|
||||
title: '',
|
||||
description: `
|
||||
<p>Supported file formats are <b>DOCX, EXCEL, PDF, TXT</b>.
|
||||
</p><p>
|
||||
For a document, it will be treated as an entire chunk, no split at all.
|
||||
|
||||
Reference in New Issue
Block a user