瀏覽代碼

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)
tags/v0.19.1
balibabu 4 月之前
父節點
當前提交
d6adcc2d50
沒有連結到貢獻者的電子郵件帳戶。

+ 3
- 19
web/src/components/chunk-method-dialog/hooks.ts 查看文件

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([
[ [
return parserList.filter((x) => values?.some((y) => y === x.value)); 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 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) =>
); );
}, [parserList, documentExtension]); }, [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']; const hideAutoKeywords = ['qa', 'table', 'resume', 'knowledge_graph', 'tag'];

+ 1
- 6
web/src/components/chunk-method-dialog/index.tsx 查看文件

}: IProps) { }: IProps) {
const { t } = useTranslation(); const { t } = useTranslation();


const { parserList } = useFetchParserListOnMount(
documentId,
parserId,
documentExtension,
// form,
);
const { parserList } = useFetchParserListOnMount(documentExtension);


const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration(); const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();



+ 2
- 2
web/src/components/ui/select.tsx 查看文件

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…
取消
儲存