2025-01-22 19:43:27 +08:00
|
|
|
import { LlmModelType } from '@/constants/knowledge';
|
2024-07-17 19:07:34 +08:00
|
|
|
import { useTranslate } from '@/hooks/common-hooks';
|
2025-01-22 19:43:27 +08:00
|
|
|
import { useSelectLlmOptionsByModelType } from '@/hooks/llm-hooks';
|
|
|
|
import { Form, Select } from 'antd';
|
|
|
|
import { useMemo } from 'react';
|
|
|
|
|
|
|
|
const enum DocumentType {
|
|
|
|
DeepDOC = 'DeepDOC',
|
|
|
|
PlainText = 'Plain Text',
|
|
|
|
}
|
2024-05-17 14:16:55 +08:00
|
|
|
|
|
|
|
const LayoutRecognize = () => {
|
|
|
|
const { t } = useTranslate('knowledgeDetails');
|
2025-01-22 19:43:27 +08:00
|
|
|
const allOptions = useSelectLlmOptionsByModelType();
|
|
|
|
|
|
|
|
const options = useMemo(() => {
|
|
|
|
const list = [DocumentType.DeepDOC, DocumentType.PlainText].map((x) => ({
|
|
|
|
label: x,
|
|
|
|
value: x,
|
|
|
|
}));
|
|
|
|
|
|
|
|
return [...list, ...allOptions[LlmModelType.Image2text]];
|
|
|
|
}, [allOptions]);
|
|
|
|
|
2024-05-17 14:16:55 +08:00
|
|
|
return (
|
|
|
|
<Form.Item
|
|
|
|
name={['parser_config', 'layout_recognize']}
|
|
|
|
label={t('layoutRecognize')}
|
2025-01-22 19:43:27 +08:00
|
|
|
initialValue={DocumentType.DeepDOC}
|
2024-05-17 14:16:55 +08:00
|
|
|
tooltip={t('layoutRecognizeTip')}
|
|
|
|
>
|
2025-01-22 19:43:27 +08:00
|
|
|
<Select options={options} />
|
2024-05-17 14:16:55 +08:00
|
|
|
</Form.Item>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default LayoutRecognize;
|