Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Fixed the issue where the initial value of the slice method was not displayed in the dialog box #3221 (#8354)

balibabud6adcc2d5092
diff --git a/web/src/components/chunk-method-dialog/hooks.ts b/web/src/components/chunk-method-dialog/hooks.ts
index 3e00161d69..b53088577d 100644
--- a/web/src/components/chunk-method-dialog/hooks.ts
+++ b/web/src/components/chunk-method-dialog/hooks.ts
@@ -1,5 +1,5 @@
import { useSelectParserList } from '@/hooks/user-setting-hooks';
-import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useCallback, useMemo } from 'react';
const ParserListMap = new Map([
[
@@ -80,15 +80,8 @@ const getParserList = (
return parserList.filter((x) => values?.some((y) => y === x.value));
};
-export const useFetchParserListOnMount = (
- documentId: string,
- parserId: string,
- documentExtension: string,
- // form: FormInstance,
-) => {
- const [selectedTag, setSelectedTag] = useState('');
+export const useFetchParserListOnMount = (documentExtension: string) => {
const parserList = useSelectParserList();
- // const handleChunkMethodSelectChange = useHandleChunkMethodSelectChange(form); // TODO
const nextParserList = useMemo(() => {
const key = [...ParserListMap.keys()].find((x) =>
@@ -105,16 +98,7 @@ export const useFetchParserListOnMount = (
);
}, [parserList, documentExtension]);
- useEffect(() => {
- setSelectedTag(parserId);
- }, [parserId, documentId]);
-
- const handleChange = (tag: string) => {
- // handleChunkMethodSelectChange(tag);
- setSelectedTag(tag);
- };
-
- return { parserList: nextParserList, handleChange, selectedTag };
+ return { parserList: nextParserList };
};
const hideAutoKeywords = ['qa', 'table', 'resume', 'knowledge_graph', 'tag'];
diff --git a/web/src/components/chunk-method-dialog/index.tsx b/web/src/components/chunk-method-dialog/index.tsx
index 4822914432..404ffb223d 100644
--- a/web/src/components/chunk-method-dialog/index.tsx
+++ b/web/src/components/chunk-method-dialog/index.tsx
@@ -88,12 +88,7 @@ export function ChunkMethodDialog({
}: IProps) {
const { t } = useTranslation();
- const { parserList } = useFetchParserListOnMount(
- documentId,
- parserId,
- documentExtension,
- // form,
- );
+ const { parserList } = useFetchParserListOnMount(documentExtension);
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
diff --git a/web/src/components/ui/select.tsx b/web/src/components/ui/select.tsx
index 9010c896fd..39d9926960 100644
--- a/web/src/components/ui/select.tsx
+++ b/web/src/components/ui/select.tsx
@@ -224,14 +224,14 @@ export const RAGFlowSelect = forwardRef<
allowClear,
placeholder,
contentProps = {},
- defaultValue,
+ // defaultValue,
triggerClassName,
onlyShowSelectedIcon = false,
},
ref,
) {
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
? FormControlComponent