mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-13 08:34:17 +00:00
Fix: Fixed the issue where the initial value of the slice method was not displayed in the dialog box #3221 (#8354)
### What problem does this PR solve? Fix: Fixed the issue where the initial value of the slice method was not displayed in the dialog box #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
1b022116d5
commit
d6adcc2d50
@ -1,5 +1,5 @@
|
|||||||
import { useSelectParserList } from '@/hooks/user-setting-hooks';
|
import { useSelectParserList } from '@/hooks/user-setting-hooks';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
const ParserListMap = new Map([
|
const ParserListMap = new Map([
|
||||||
[
|
[
|
||||||
@ -80,15 +80,8 @@ const getParserList = (
|
|||||||
return parserList.filter((x) => values?.some((y) => y === x.value));
|
return parserList.filter((x) => values?.some((y) => y === x.value));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useFetchParserListOnMount = (
|
export const useFetchParserListOnMount = (documentExtension: string) => {
|
||||||
documentId: string,
|
|
||||||
parserId: string,
|
|
||||||
documentExtension: string,
|
|
||||||
// form: FormInstance,
|
|
||||||
) => {
|
|
||||||
const [selectedTag, setSelectedTag] = useState('');
|
|
||||||
const parserList = useSelectParserList();
|
const parserList = useSelectParserList();
|
||||||
// const handleChunkMethodSelectChange = useHandleChunkMethodSelectChange(form); // TODO
|
|
||||||
|
|
||||||
const nextParserList = useMemo(() => {
|
const nextParserList = useMemo(() => {
|
||||||
const key = [...ParserListMap.keys()].find((x) =>
|
const key = [...ParserListMap.keys()].find((x) =>
|
||||||
@ -105,16 +98,7 @@ export const useFetchParserListOnMount = (
|
|||||||
);
|
);
|
||||||
}, [parserList, documentExtension]);
|
}, [parserList, documentExtension]);
|
||||||
|
|
||||||
useEffect(() => {
|
return { parserList: nextParserList };
|
||||||
setSelectedTag(parserId);
|
|
||||||
}, [parserId, documentId]);
|
|
||||||
|
|
||||||
const handleChange = (tag: string) => {
|
|
||||||
// handleChunkMethodSelectChange(tag);
|
|
||||||
setSelectedTag(tag);
|
|
||||||
};
|
|
||||||
|
|
||||||
return { parserList: nextParserList, handleChange, selectedTag };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const hideAutoKeywords = ['qa', 'table', 'resume', 'knowledge_graph', 'tag'];
|
const hideAutoKeywords = ['qa', 'table', 'resume', 'knowledge_graph', 'tag'];
|
||||||
|
|||||||
@ -88,12 +88,7 @@ export function ChunkMethodDialog({
|
|||||||
}: IProps) {
|
}: IProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { parserList } = useFetchParserListOnMount(
|
const { parserList } = useFetchParserListOnMount(documentExtension);
|
||||||
documentId,
|
|
||||||
parserId,
|
|
||||||
documentExtension,
|
|
||||||
// form,
|
|
||||||
);
|
|
||||||
|
|
||||||
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
|
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
|
||||||
|
|
||||||
|
|||||||
@ -224,14 +224,14 @@ export const RAGFlowSelect = forwardRef<
|
|||||||
allowClear,
|
allowClear,
|
||||||
placeholder,
|
placeholder,
|
||||||
contentProps = {},
|
contentProps = {},
|
||||||
defaultValue,
|
// defaultValue,
|
||||||
triggerClassName,
|
triggerClassName,
|
||||||
onlyShowSelectedIcon = false,
|
onlyShowSelectedIcon = false,
|
||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
) {
|
) {
|
||||||
const [key, setKey] = React.useState(+new Date());
|
const [key, setKey] = React.useState(+new Date());
|
||||||
const [value, setValue] = React.useState<string | undefined>(defaultValue);
|
const [value, setValue] = React.useState<string | undefined>(initialValue);
|
||||||
|
|
||||||
const FormControlWidget = FormControlComponent
|
const FormControlWidget = FormControlComponent
|
||||||
? FormControlComponent
|
? FormControlComponent
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user