mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-18 00:55:54 +08:00
For any type of file, if the parsing method is general, the chunk token number needs to be displayed. #217 (#218)
…k token number needs to be displayed. #217 ### What problem does this PR solve? For any type of file, if the parsing method is general, the chunk token number needs to be displayed. #217 Issue link: #217 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
963533bc27
commit
33d01150d5
@ -68,13 +68,26 @@ const ChunkMethodModal: React.FC<IProps> = ({
|
||||
onOk(selectedTag, parser_config);
|
||||
};
|
||||
|
||||
const isPdf = documentExtension === 'pdf';
|
||||
|
||||
const showPages = useMemo(() => {
|
||||
return hidePagesChunkMethods.every((x) => x !== selectedTag);
|
||||
}, [selectedTag]);
|
||||
return isPdf && hidePagesChunkMethods.every((x) => x !== selectedTag);
|
||||
}, [selectedTag, isPdf]);
|
||||
|
||||
const showOne = useMemo(() => {
|
||||
return showPages || selectedTag === 'one';
|
||||
}, [showPages, selectedTag]);
|
||||
return (
|
||||
isPdf &&
|
||||
hidePagesChunkMethods
|
||||
.filter((x) => x !== 'one')
|
||||
.every((x) => x !== selectedTag)
|
||||
);
|
||||
}, [selectedTag, isPdf]);
|
||||
|
||||
const showMaxTokenNumber = selectedTag === 'naive';
|
||||
|
||||
const hideDivider = [showPages, showOne, showMaxTokenNumber].every(
|
||||
(x) => x === false,
|
||||
);
|
||||
|
||||
const afterClose = () => {
|
||||
form.resetFields();
|
||||
@ -116,9 +129,7 @@ const ChunkMethodModal: React.FC<IProps> = ({
|
||||
})}
|
||||
</div>
|
||||
</Space>
|
||||
<Divider></Divider>
|
||||
|
||||
{documentExtension === 'pdf' && (
|
||||
{hideDivider || <Divider></Divider>}
|
||||
<Form name="dynamic_form_nest_item" autoComplete="off" form={form}>
|
||||
{showPages && (
|
||||
<>
|
||||
@ -159,8 +170,7 @@ const ChunkMethodModal: React.FC<IProps> = ({
|
||||
if (
|
||||
name === 0 ||
|
||||
!value ||
|
||||
getFieldValue(['pages', name - 1, 'to']) <
|
||||
value
|
||||
getFieldValue(['pages', name - 1, 'to']) < value
|
||||
) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
@ -272,10 +282,8 @@ const ChunkMethodModal: React.FC<IProps> = ({
|
||||
}
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
{selectedTag === 'naive' && <MaxTokenNumber></MaxTokenNumber>}
|
||||
{showMaxTokenNumber && <MaxTokenNumber></MaxTokenNumber>}
|
||||
</Form>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user