Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Configurable for excel, html table or row based text #2516 #2538

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions web/src/components/chunk-method-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useFetchParserListOnMount } from './hooks';
import { useTranslate } from '@/hooks/common-hooks';
import Delimiter from '../delimiter';
import EntityTypesItem from '../entity-types-item';
import ExcelToHtml from '../excel-to-html';
import LayoutRecognize from '../layout-recognize';
import ParseConfiguration, {
showRaptorParseConfiguration,
Expand Down Expand Up @@ -104,6 +105,9 @@ const ChunkMethodModal: React.FC<IProps> = ({

const showEntityTypes = selectedTag === 'knowledge_graph';

const showExcelToHtml =
selectedTag === 'naive' && documentExtension === 'xlsx';

const afterClose = () => {
form.resetFields();
};
Expand Down Expand Up @@ -279,6 +283,7 @@ const ChunkMethodModal: React.FC<IProps> = ({
<Delimiter></Delimiter>
</>
)}
{showExcelToHtml && <ExcelToHtml></ExcelToHtml>}
{showRaptorParseConfiguration(selectedTag) && (
<ParseConfiguration></ParseConfiguration>
)}
Expand Down
19 changes: 19 additions & 0 deletions web/src/components/excel-to-html.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useTranslate } from '@/hooks/common-hooks';
import { Form, Switch } from 'antd';

const ExcelToHtml = () => {
const { t } = useTranslate('knowledgeDetails');
return (
<Form.Item
name={['parser_config', 'html4excel']}
label={t('html4excel')}
initialValue={false}
valuePropName="checked"
tooltip={t('html4excelTip')}
>
<Switch />
</Form.Item>
);
};

export default ExcelToHtml;
2 changes: 2 additions & 0 deletions web/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ export default {
topK: 'Top-K',
topKTip: `K chunks will be fed into rerank models.`,
delimiter: `Delimiter`,
html4excel: 'Excel to HTML',
html4excelTip: `Excel will be parsed into HTML table or not. If it's FALSE, every row in Excel will be formed as a chunk.`,
},
knowledgeConfiguration: {
titleDescription:
Expand Down
2 changes: 2 additions & 0 deletions web/src/locales/zh-traditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ export default {
topK: 'Top-K',
topKTip: `K塊將被送入Rerank型號。`,
delimiter: `分段標識符`,
html4excel: '表格轉HTML',
html4excelTip: `Excel 是否會被解析為 HTML 表格。如果為 FALSE,Excel 中的每一行都會形成一個區塊。`,
},
knowledgeConfiguration: {
titleDescription: '在這裡更新您的知識庫詳細信息,尤其是解析方法。',
Expand Down
2 changes: 2 additions & 0 deletions web/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ export default {
topK: 'Top-K',
topKTip: `K块将被送入Rerank型号。`,
delimiter: `分段标识符`,
html4excel: '表格转HTML',
html4excelTip: `Excel 是否将被解析为 HTML 表。如果为 FALSE,Excel 中的每一行都将形成一个块。`,
},
knowledgeConfiguration: {
titleDescription: '在这里更新您的知识库详细信息,尤其是解析方法。',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Delimiter from '@/components/delimiter';
import EntityTypesItem from '@/components/entity-types-item';
import ExcelToHtml from '@/components/excel-to-html';
import LayoutRecognize from '@/components/layout-recognize';
import MaxTokenNumber from '@/components/max-token-number';
import ParseConfiguration, {
Expand Down Expand Up @@ -124,6 +125,7 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
<MaxTokenNumber></MaxTokenNumber>
<Delimiter></Delimiter>
<LayoutRecognize></LayoutRecognize>
<ExcelToHtml></ExcelToHtml>
</>
)}
{showRaptorParseConfiguration(parserId) && (
Expand Down