From f4cc4dbd3002879e009fbceca9e845dc228cd0d6 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Sun, 28 Sep 2025 19:32:19 +0800 Subject: [PATCH] Fix: Interoperate with the pipeline rerun and unbindTask interfaces. #9869 (#10346) ### What problem does this PR solve? Fix: Interoperate with the pipeline rerun and unbindTask interfaces. #9869 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../graph-rag-form-fields.tsx | 10 +- .../raptor-form-fields.tsx | 9 +- web/src/interfaces/database/document.ts | 1 + .../components/parse-editer/index.tsx | 168 +++-------------- .../components/parse-editer/json-parser.tsx | 173 ++++++++++++++++++ .../components/parse-editer/object-parser.tsx | 112 ++++++++++++ .../components/time-line/index.tsx | 4 - web/src/pages/dataflow-result/constant.ts | 9 +- web/src/pages/dataflow-result/hooks.ts | 39 ++-- web/src/pages/dataflow-result/index.tsx | 9 +- web/src/pages/dataflow-result/parser.tsx | 118 ++++++------ .../pages/dataset/dataset-setting/index.tsx | 23 ++- .../dataset/generate-button/generate.tsx | 40 +++- .../dataset/dataset/generate-button/hook.ts | 21 ++- web/src/pages/dataset/dataset/hooks.ts | 2 +- web/src/services/knowledge-service.ts | 11 ++ web/src/utils/api.ts | 3 + 17 files changed, 512 insertions(+), 240 deletions(-) create mode 100644 web/src/pages/dataflow-result/components/parse-editer/json-parser.tsx create mode 100644 web/src/pages/dataflow-result/components/parse-editer/object-parser.tsx diff --git a/web/src/components/parse-configuration/graph-rag-form-fields.tsx b/web/src/components/parse-configuration/graph-rag-form-fields.tsx index c9f10e8c5..56e631d4a 100644 --- a/web/src/components/parse-configuration/graph-rag-form-fields.tsx +++ b/web/src/components/parse-configuration/graph-rag-form-fields.tsx @@ -53,12 +53,15 @@ type GraphRagItemsProps = { marginBottom?: boolean; className?: string; data: IGenerateLogButtonProps; + onDelete?: () => void; }; export function UseGraphRagFormField({ data, + onDelete, }: { data: IGenerateLogButtonProps; + onDelete?: () => void; }) { const form = useFormContext(); const { t } = useTranslate('knowledgeConfiguration'); @@ -84,6 +87,7 @@ export function UseGraphRagFormField({ > */} { const { t } = useTranslate('knowledgeConfiguration'); const form = useFormContext(); @@ -131,7 +136,10 @@ const GraphRagItems = ({ return ( - + {useRaptor && ( <> diff --git a/web/src/components/parse-configuration/raptor-form-fields.tsx b/web/src/components/parse-configuration/raptor-form-fields.tsx index a177f2e3b..4571288c7 100644 --- a/web/src/components/parse-configuration/raptor-form-fields.tsx +++ b/web/src/components/parse-configuration/raptor-form-fields.tsx @@ -56,7 +56,13 @@ const Prompt = 'parser_config.raptor.prompt'; // The three types "table", "resume" and "one" do not display this configuration. -const RaptorFormFields = ({ data }: { data: IGenerateLogButtonProps }) => { +const RaptorFormFields = ({ + data, + onDelete, +}: { + data: IGenerateLogButtonProps; + onDelete: () => void; +}) => { const form = useFormContext(); const { t } = useTranslate('knowledgeConfiguration'); const useRaptor = useWatch({ name: UseRaptorField }); @@ -106,6 +112,7 @@ const RaptorFormFields = ({ data }: { data: IGenerateLogButtonProps }) => { ; }; @@ -29,152 +26,47 @@ const FormatPreserveEditor = ({ selectedChunkIds, textMode, }: FormatPreserveEditorProps) => { - const [content, setContent] = useState(initialValue); - // const [isEditing, setIsEditing] = useState(false); - const [activeEditIndex, setActiveEditIndex] = useState( - undefined, - ); console.log('initialValue', initialValue); - useEffect(() => { - setContent(initialValue); - }, [initialValue]); - const handleEdit = (e?: any, index?: number) => { - console.log(e, index, content); - if (content.key === 'json') { - console.log(e, e.target.innerText); - setContent((pre) => ({ - ...pre, - value: pre.value.map((item, i) => { - if (i === index) { - return { - ...item, - [Object.keys(item)[0]]: e.target.innerText, - }; - } - return item; - }), - })); - setActiveEditIndex(index); - } - }; - - const handleChange = (e: any) => { - if (content.key === 'json') { - setContent((pre) => ({ - ...pre, - value: pre.value.map((item, i) => { - if (i === activeEditIndex) { - return { - ...item, - [Object.keys(item)[0]]: e.target.value, - }; - } - return item; - }), - })); - } else { - setContent(e.target.value); - } - }; - const escapeNewlines = (text: string) => { return text.replace(/\n/g, '\\n'); }; const unescapeNewlines = (text: string) => { return text.replace(/\\n/g, '\n'); }; - - const handleSave = () => { - const saveData = { - ...content, - value: content.value?.map((item) => { - return { ...item, text: unescapeNewlines(item.text) }; - }), - }; - onSave(saveData); - setActiveEditIndex(undefined); - }; const handleCheck = (e: CheckedState, id: string | number) => { handleCheckboxClick?.(id, e === 'indeterminate' ? false : e); }; + return (
- {/* {isEditing && content.key === 'json' ? ( -