RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: On the dataset configuration page of the Go version, no error message appears when saving if mandatory fields are left blank. (#18970)
balibabuc9bb776a4e06
diff --git a/web/src/components/document-pipeline-dialog/index.tsx b/web/src/components/document-pipeline-dialog/index.tsxindex 921c742eb3..86357e032f 100644--- a/web/src/components/document-pipeline-dialog/index.tsx+++ b/web/src/components/document-pipeline-dialog/index.tsx@@ -31,6 +31,7 @@ import { ParseType } from '@/constants/knowledge';import { IModalProps } from '@/interfaces/common';import { IChangeParserRequestBody } from '@/interfaces/request/document';import { useCallback } from 'react';+import { FieldErrors, useFormState } from 'react-hook-form';import { useTranslation } from 'react-i18next';import {IDocumentPipelineDialogProps,@@ -76,6 +77,22 @@ export function DocumentPipelineDialog({[buildSubmitData, hideModal, onOk],);+ const onInvalid = useCallback(+ (errors: FieldErrors) => {+ // Surface the first failing operator tab so its field errors are visible.+ const firstOperatorId = Object.keys(errors?.parser_config ?? {})[0];+ if (firstOperatorId) {+ setActiveTab(firstOperatorId);+ }+ },+ [setActiveTab],+ );++ const { errors } = useFormState({+ control: form.control,+ name: 'parser_config',+ });+return (<Dialog open onOpenChange={hideModal}><DialogContent className="max-w-[50vw] text-text-primary">@@ -85,7 +102,7 @@ export function DocumentPipelineDialog({<Form {...form}><form- onSubmit={form.handleSubmit(onSubmit)}+ onSubmit={form.handleSubmit(onSubmit, onInvalid)}className="space-y-6 max-h-[70vh] overflow-auto -mx-6 px-10 py-5"id={FormId}>@@ -104,6 +121,11 @@ export function DocumentPipelineDialog({value={activeTab}onValueChange={setActiveTab}onOperatorValuesChange={handleOperatorValuesChange}+ operatorFormErrors={+ errors.parser_config as+ | Record<string, FieldErrors | undefined>+ | undefined+ }/>)}</form>diff --git a/web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts b/web/src/components/document-pipeline-dialog/use-document-pipeline-form.tsindex b1641e0706..abe9fff455 100644--- a/web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts+++ b/web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts@@ -31,6 +31,7 @@ import { useCallback, useEffect, useMemo } from 'react';import { useForm, useWatch } from 'react-hook-form';import { useTranslation } from 'react-i18next';import { z } from 'zod';+import { addParserConfigIssues } from '../pipeline-operator-tabs/parser-config-validation';export interface IDocumentPipelineDialogProps {parserId: string;@@ -102,6 +103,7 @@ export function useDocumentPipelineForm({code: 'custom',});}+ addParserConfigIssues(data.parser_config, ctx, t);}),[t],);diff --git a/web/src/components/pipeline-operator-tabs/index.tsx b/web/src/components/pipeline-operator-tabs/index.tsxindex cf7108bee8..895b36dbe7 100644--- a/web/src/components/pipeline-operator-tabs/index.tsx+++ b/web/src/components/pipeline-operator-tabs/index.tsx@@ -17,6 +17,7 @@import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';import { RAGFlowNodeType } from '@/interfaces/database/agent';import { memo, useCallback } from 'react';+import { FieldErrors } from 'react-hook-form';import PipelineOperatorForm from './pipeline-operator-form';type PipelineOperatorTabsProps = {@@ -24,6 +25,9 @@ type PipelineOperatorTabsProps = {value: string;onValueChange: (value: string) => void;onOperatorValuesChange: (operatorId: string, values: any) => void;+ // Validation errors from the outer form's parser_config, keyed by+ // operatorId; each entry is mirrored onto the operator form's fields.+ operatorFormErrors?: Record<string, FieldErrors | undefined>;};const PipelineOperatorTabs = ({@@ -31,6 +35,7 @@ const PipelineOperatorTabs = ({value,onValueChange,onOperatorValuesChange,+ operatorFormErrors,}: PipelineOperatorTabsProps) => {const getOperatorId = useCallback((node: RAGFlowNodeType) => {return (@@ -71,6 +76,7 @@ const PipelineOperatorTabs = ({<PipelineOperatorFormnode={node}onValuesChange={handleValuesChange(node)}+ externalErrors={operatorFormErrors?.[getOperatorId(node)]}/></TabsContent>);diff --git a/web/src/components/pipeline-operator-tabs/parser-config-validation.ts b/web/src/components/pipeline-operator-tabs/parser-config-validation.tsnew file mode 100644index 0000000000..59ca040bae--- /dev/null+++ b/web/src/components/pipeline-operator-tabs/parser-config-validation.ts@@ -0,0 +1,122 @@+/*+ * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { Operator } from '@/constants/agent';+import {+ initialCompilationValues,+ initialGoExtractorValues,+ initialParserValues,+ initialTitleChunkerValues,+ initialTokenChunkerValues,+ initialTokenizerValues,+} from '@/pages/agent/constant/pipeline';+import { buildCompilationFormSchema } from '@/pages/agent/form/compilation-form';+import { FormSchema as ExtractorFormSchema } from '@/pages/agent/form/extractor-form';+import { FormSchema as ParserFormSchema } from '@/pages/agent/form/parser-form';+import { FormSchema as TitleChunkerFormSchema } from '@/pages/agent/form/title-chunker-form';+import { FormSchema as TokenChunkerFormSchema } from '@/pages/agent/form/token-chunker-form';+import { FormSchema as TokenizerFormSchema } from '@/pages/agent/form/tokenizer-form';+import { getOperatorType } from '@/utils/pipeline-operator';+import type { TFunction } from 'i18next';+import { z } from 'zod';++// The pipeline operator tabs (and therefore this validation) only render for+// the Go backend — the Python backend edits the parser config through the+// legacy chunk-method dialog — so only the Go form schemas are mapped here.+function getOperatorFormSchema(operatorType: Operator, t: TFunction) {+ switch (operatorType) {+ case Operator.Parser:+ return ParserFormSchema;+ case Operator.TokenChunker:+ return TokenChunkerFormSchema;+ case Operator.TitleChunker:+ return TitleChunkerFormSchema;+ case Operator.Extractor:+ return ExtractorFormSchema;+ case Operator.Compiler:+ return buildCompilationFormSchema(t);+ case Operator.Tokenizer:+ return TokenizerFormSchema;+ default:+ return undefined;+ }+}++function getOperatorInitialValues(operatorType: Operator) {+ switch (operatorType) {+ case Operator.Parser:+ return initialParserValues;+ case Operator.TokenChunker:+ return initialTokenChunkerValues;+ case Operator.TitleChunker:+ return initialTitleChunkerValues;+ case Operator.Extractor:+ return initialGoExtractorValues;+ case Operator.Compiler:+ return initialCompilationValues;+ case Operator.Tokenizer:+ return initialTokenizerValues;+ default:+ return {};+ }+}++/**+ * Validates every operator config in parser_config against the owning+ * operator form's schema, so the required rules defined by the operator+ * forms also hold when the forms are submitted from an outer form (document+ * pipeline dialog, dataset setting page) whose resolver is the only one that+ * runs on submit.+ *+ * Entries may come from a saved config (never rendered in a tab) or straight+ * from an operator form, so the operator defaults are merged in first:+ * untouched tabs validate against their defaults instead of false-positive+ * missing fields, while edited tabs carry complete form values that override+ * the defaults and get genuinely validated.+ */+export function addParserConfigIssues(+ parserConfig: Record<string, any> | undefined,+ ctx: z.RefinementCtx,+ t: TFunction,+) {+ if (!parserConfig) {+ return;+ }++ for (const [operatorId, config] of Object.entries(parserConfig)) {+ const operatorType = getOperatorType(operatorId);+ const schema = getOperatorFormSchema(operatorType, t);+ if (!schema) {+ continue;+ }++ const result = schema.safeParse({+ ...getOperatorInitialValues(operatorType),+ ...(config ?? {}),+ });+ if (result.success) {+ continue;+ }++ for (const issue of result.error.issues) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ['parser_config', operatorId, ...issue.path],+ message: issue.message,+ });+ }+ }+}diff --git a/web/src/components/pipeline-operator-tabs/pipeline-operator-form.tsx b/web/src/components/pipeline-operator-tabs/pipeline-operator-form.tsxindex d76e125ded..4c76a44ca7 100644--- a/web/src/components/pipeline-operator-tabs/pipeline-operator-form.tsx+++ b/web/src/components/pipeline-operator-tabs/pipeline-operator-form.tsx@@ -24,15 +24,18 @@ import TokenChunkerForm from '@/pages/agent/form/token-chunker-form';import TokenizerForm from '@/pages/agent/form/tokenizer-form';import { getOperatorType } from '@/utils/pipeline-operator';import { memo, useCallback } from 'react';+import { FieldErrors } from 'react-hook-form';type PipelineOperatorFormProps = {node: RAGFlowNodeType;onValuesChange?: (values: any) => void;+ externalErrors?: FieldErrors;};const PipelineOperatorForm = ({node,onValuesChange,+ externalErrors,}: PipelineOperatorFormProps) => {const operatorType = getOperatorType((node.data as Record<string, any>)?.operatorId || node.data?.label || '',@@ -52,6 +55,7 @@ const PipelineOperatorForm = ({node={node}onValuesChange={handleValuesChange}hideOutputs+ externalErrors={externalErrors}/>);case Operator.TokenChunker:@@ -60,6 +64,7 @@ const PipelineOperatorForm = ({node={node}onValuesChange={handleValuesChange}hideOutputs+ externalErrors={externalErrors}/>);case Operator.TitleChunker:@@ -68,6 +73,7 @@ const PipelineOperatorForm = ({node={node}onValuesChange={handleValuesChange}hideOutputs+ externalErrors={externalErrors}/>);case Operator.Extractor:@@ -76,6 +82,7 @@ const PipelineOperatorForm = ({node={node}onValuesChange={handleValuesChange}hideOutputs+ externalErrors={externalErrors}/>);case Operator.Compiler:@@ -84,6 +91,7 @@ const PipelineOperatorForm = ({node={node}onValuesChange={handleValuesChange}hideOutputs+ externalErrors={externalErrors}/>);case Operator.Tokenizer:@@ -92,6 +100,7 @@ const PipelineOperatorForm = ({node={node}onValuesChange={handleValuesChange}hideOutputs+ externalErrors={externalErrors}/>);default:diff --git a/web/src/components/pipeline-operator-tabs/use-sync-external-form-errors.ts b/web/src/components/pipeline-operator-tabs/use-sync-external-form-errors.tsnew file mode 100644index 0000000000..6733ae9ca8--- /dev/null+++ b/web/src/components/pipeline-operator-tabs/use-sync-external-form-errors.ts@@ -0,0 +1,75 @@+/*+ * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { useEffect, useRef } from 'react';+import { FieldErrors, UseFormReturn } from 'react-hook-form';++type FlattenedError = {+ path: string;+ message: string;+};++/**+ * Flattens a react-hook-form errors tree into dot-separated field paths,+ * e.g. { setups: { 0: { fields: { message } } } } → 'setups.0.fields'.+ */+function flattenFieldErrors(+ errors: FieldErrors | undefined,+ parentPath = '',+): FlattenedError[] {+ if (!errors || typeof errors !== 'object') {+ return [];+ }++ return Object.entries(errors).flatMap(([key, value]) => {+ if (!value || typeof value !== 'object') {+ return [];+ }+ const path = parentPath ? `${parentPath}.${key}` : key;+ if ('message' in value && typeof value.message === 'string') {+ return [{ path, message: value.message }];+ }+ return flattenFieldErrors(value as FieldErrors, path);+ });+}++/**+ * Mirrors validation errors produced by an outer form (whose schema validates+ * parser_config on submit) onto the matching fields of an operator form, so+ * the messages render on the fields via FormMessage. Errors whose outer+ * issue is gone are cleared; errors for fixed fields are also cleared by the+ * operator form's own resolver, which validates the same schema on change.+ */+export function useSyncExternalFormErrors(+ form: UseFormReturn<any>,+ externalErrors?: FieldErrors,+) {+ const previousPathsRef = useRef<string[]>([]);++ useEffect(() => {+ const entries = flattenFieldErrors(externalErrors);+ const nextPaths = entries.map((x) => x.path);++ previousPathsRef.current+ .filter((path) => !nextPaths.includes(path))+ .forEach((path) => form.clearErrors(path));+ entries.forEach(({ path, message }) => {+ form.setError(path, { message });+ });++ previousPathsRef.current = nextPaths;+ }, [form, externalErrors]);+}diff --git a/web/src/pages/agent/form/compilation-form/index.tsx b/web/src/pages/agent/form/compilation-form/index.tsxindex 5f54b5289d..b5fdbce082 100644--- a/web/src/pages/agent/form/compilation-form/index.tsx+++ b/web/src/pages/agent/form/compilation-form/index.tsx@@ -1,10 +1,12 @@import { CompilationTemplateFormField } from '@/components/compilation-template-form-field';import { LargeModelFormField } from '@/components/large-model-form-field';import { SelectWithSearch } from '@/components/originui/select-with-search';+import { useSyncExternalFormErrors } from '@/components/pipeline-operator-tabs/use-sync-external-form-errors';import { RAGFlowFormItem } from '@/components/ragflow-form';import { Form } from '@/components/ui/form';import { useIsGoBackend } from '@/utils/backend-variant';import { zodResolver } from '@hookform/resolvers/zod';+import type { TFunction } from 'i18next';import { memo } from 'react';import { useForm } from 'react-hook-form';import { useTranslation } from 'react-i18next';@@ -19,17 +21,19 @@ import { buildOutputList } from '../../utils/build-output-list';import { FormWrapper } from '../components/form-wrapper';import { Output } from '../components/output';-function useFormSchema() {- const { t } = useTranslation();- const FormSchema = z.object({+export function buildCompilationFormSchema(t: TFunction) {+ return z.object({compilation_template_group_id: z.string().min(1, t('knowledgeConfiguration.compilationTemplateRequired')),llm_id: z.string().optional(),mode: z.enum(['entity', 'topic']),});+}- return FormSchema;+function useFormSchema() {+ const { t } = useTranslation();+ return buildCompilationFormSchema(t);}export type CompilationFormSchemaType = z.infer<@@ -42,6 +46,7 @@ const CompilationForm = ({node,onValuesChange,hideOutputs,+ externalErrors,}: INextOperatorForm) => {const defaultValues = useFormValues(initialCompilationValues, node);const ownerTenantId = useOwnerTenantId();@@ -55,6 +60,8 @@ const CompilationForm = ({mode: 'onChange',});+ useSyncExternalFormErrors(form, externalErrors);+useWatchFormChange(node?.id, form);useFormChangeCallback(form, onValuesChange);@@ -77,8 +84,14 @@ const CompilationForm = ({value={field.value}onChange={field.onChange}options={[- { label: t('knowledgeCompilation.entityMode'), value: 'entity' },- { label: t('knowledgeCompilation.topicMode'), value: 'topic' },+ {+ label: t('knowledgeCompilation.entityMode'),+ value: 'entity',+ },+ {+ label: t('knowledgeCompilation.topicMode'),+ value: 'topic',+ },]}/>)}diff --git a/web/src/pages/agent/form/extractor-form/go-form.tsx b/web/src/pages/agent/form/extractor-form/go-form.tsxindex c677b3925c..32366f4c32 100644--- a/web/src/pages/agent/form/extractor-form/go-form.tsx+++ b/web/src/pages/agent/form/extractor-form/go-form.tsx@@ -21,6 +21,7 @@ import {import { Collapse } from '@/components/collapse';import { LargeModelFormField } from '@/components/large-model-form-field';import { LlmSettingSchema } from '@/components/llm-setting-items/next';+import { useSyncExternalFormErrors } from '@/components/pipeline-operator-tabs/use-sync-external-form-errors';import { RAGFlowFormItem } from '@/components/ragflow-form';import { SliderInputFormField } from '@/components/slider-input-form-field';import { AsyncTreeSelect } from '@/components/ui/async-tree-select';@@ -92,6 +93,8 @@ export const FormSchema = z.object({}).optional(),...LlmSettingSchema,+ // No required mark on the model field — an LLM is optional for extraction.+ llm_id: z.string().optional(),});export type ExtractorFormSchemaType = z.infer<typeof FormSchema>;@@ -191,6 +194,7 @@ const GoExtractorForm = ({node,onValuesChange,hideOutputs,+ externalErrors,}: INextOperatorForm) => {const defaultValues = useNormalizedExtractorFormValues(node);const { t } = useTranslation();@@ -198,8 +202,11 @@ const GoExtractorForm = ({const form = useForm<ExtractorFormSchemaType>({defaultValues,resolver: zodResolver(FormSchema),+ mode: 'onChange',});+ useSyncExternalFormErrors(form, externalErrors);+useWatchFormChange(node?.id, form);useFormChangeCallback(form, onValuesChange);diff --git a/web/src/pages/agent/form/extractor-form/use-switch-prompt.ts b/web/src/pages/agent/form/extractor-form/use-switch-prompt.tsindex 00a90706a4..d950af2460 100644--- a/web/src/pages/agent/form/extractor-form/use-switch-prompt.ts+++ b/web/src/pages/agent/form/extractor-form/use-switch-prompt.ts@@ -29,7 +29,10 @@ export function useSwitchPrompt(form: SwitchPromptForm) {form.setValue(field,Object.hasOwn(pythonCanvasTopN, value)- ? prompt.replace(/\{\{\s*topn\s*\}\}/g, String(pythonCanvasTopN[value]))+ ? prompt.replace(+ /\{\{\s*topn\s*\}\}/g,+ String(pythonCanvasTopN[value]),+ ): prompt,{shouldDirty: true,diff --git a/web/src/pages/agent/form/parser-form/index.tsx b/web/src/pages/agent/form/parser-form/index.tsxindex 0107aca88d..6db355f7cb 100644--- a/web/src/pages/agent/form/parser-form/index.tsx+++ b/web/src/pages/agent/form/parser-form/index.tsx@@ -2,6 +2,7 @@ import {SelectWithSearch,SelectWithSearchFlagOptionType,} from '@/components/originui/select-with-search';+import { useSyncExternalFormErrors } from '@/components/pipeline-operator-tabs/use-sync-external-form-errors';import { RAGFlowFormItem } from '@/components/ragflow-form';import { BlockButton, Button } from '@/components/ui/button';import { Form } from '@/components/ui/form';@@ -70,48 +71,69 @@ type ParserItemProps = {fileFormatOptions: SelectWithSearchFlagOptionType[];};+const SetupSchema = z+ .object({+ fileFormat: z.string().nullish(),+ // preprocess: z.array(z.string()).optional(),+ output_format: z.string().optional(),+ parse_method: z.string().optional(),+ lang: z.string().optional(),+ fields: z.array(z.string()).optional(),+ vlm: z.object({ llm_id: z.string().optional() }).optional(),+ flatten_media_to_text: z.boolean().optional(),+ system_prompt: z.string().optional(),+ table_result_type: z.string().optional(),+ markdown_image_response_type: z.string().optional(),+ enable_multi_column: z.boolean().optional(),+ remove_toc: z.boolean().optional(),+ remove_header_footer: z.boolean().optional(),+ pages: z+ .array(+ z+ .object({+ // Keep these checks on the fields themselves: an object-level+ // `superRefine` is skipped whenever the base shape fails to+ // parse, so one missing sibling would silently swallow the+ // other field's error.+ from: z.coerce+ .number()+ .int(i18n.t('knowledgeDetails.pageRangeFromInvalid'))+ .min(1, i18n.t('knowledgeDetails.pageRangeFromInvalid')),+ to: z.coerce+ .number()+ .int(i18n.t('knowledgeDetails.pageRangeToInvalid'))+ .min(1, i18n.t('knowledgeDetails.pageRangeToInvalid')),+ })+ .refine(({ from, to }) => to >= from, {+ path: ['to'],+ message: i18n.t('knowledgeDetails.pageRangeToInvalid'),+ }),+ )+ .optional(),+ })+ .superRefine((values, ctx) => {+ if (values.fileFormat === FileType.Email && !values.fields?.length) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ['fields'],+ message: 'Fields is required',+ });+ }+ if (+ (values.fileFormat === FileType.Video ||+ values.fileFormat === FileType.Audio) &&+ !values.vlm?.llm_id+ ) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ path: ['vlm', 'llm_id'],+ message: 'Model is required',+ });+ }+ });+export const FormSchema = z.object({- setups: z.array(- z.object({- fileFormat: z.string().nullish(),- // preprocess: z.array(z.string()).optional(),- output_format: z.string().optional(),- parse_method: z.string().optional(),- lang: z.string().optional(),- fields: z.array(z.string()).optional(),- vlm: z.object({ llm_id: z.string().optional() }).optional(),- flatten_media_to_text: z.boolean().optional(),- system_prompt: z.string().optional(),- table_result_type: z.string().optional(),- markdown_image_response_type: z.string().optional(),- enable_multi_column: z.boolean().optional(),- remove_toc: z.boolean().optional(),- remove_header_footer: z.boolean().optional(),- pages: z- .array(- z- .object({- // Keep these checks on the fields themselves: an object-level- // `superRefine` is skipped whenever the base shape fails to- // parse, so one missing sibling would silently swallow the- // other field's error.- from: z.coerce- .number()- .int(i18n.t('knowledgeDetails.pageRangeFromInvalid'))- .min(1, i18n.t('knowledgeDetails.pageRangeFromInvalid')),- to: z.coerce- .number()- .int(i18n.t('knowledgeDetails.pageRangeToInvalid'))- .min(1, i18n.t('knowledgeDetails.pageRangeToInvalid')),- })- .refine(({ from, to }) => to >= from, {- path: ['to'],- message: i18n.t('knowledgeDetails.pageRangeToInvalid'),- }),- )- .optional(),- }),- ),+ setups: z.array(SetupSchema),});export type ParserFormSchemaType = z.infer<typeof FormSchema>;@@ -213,6 +235,7 @@ const ParserForm = ({node,onValuesChange,hideOutputs,+ externalErrors,}: INextOperatorForm) => {const { t } = useTranslation();const defaultValues = useFormValues(initialParserValues, node);@@ -226,6 +249,8 @@ const ParserForm = ({shouldUnregister: true,});+ useSyncExternalFormErrors(form, externalErrors);+const name = 'setups';const { fields, remove, append } = useFieldArray({name,diff --git a/web/src/pages/agent/form/parser-form/ppt-form-fields.tsx b/web/src/pages/agent/form/parser-form/ppt-form-fields.tsxindex 5e856ce029..22c35e8bbf 100644--- a/web/src/pages/agent/form/parser-form/ppt-form-fields.tsx+++ b/web/src/pages/agent/form/parser-form/ppt-form-fields.tsx@@ -53,7 +53,10 @@ export function PptFormFields({ prefix }: CommonProps) {// On a file-type switch the field remounts and react-hook-form re-seeds it// from the node's saved form data, so it can hold another file type's// static parse method (e.g. ocr) — reset it to DeepDOC in that case too.- if (isEmpty(current) || isForeignParseMethod(FileType.PowerPoint, current)) {+ if (+ isEmpty(current) ||+ isForeignParseMethod(FileType.PowerPoint, current)+ ) {form.setValue(parseMethodName, ParseDocumentType.DeepDOC, {shouldValidate: true,shouldDirty: true,diff --git a/web/src/pages/agent/form/parser-form/spreadsheet-form-fields.tsx b/web/src/pages/agent/form/parser-form/spreadsheet-form-fields.tsxindex bdf2f99ee4..0e28ba2490 100644--- a/web/src/pages/agent/form/parser-form/spreadsheet-form-fields.tsx+++ b/web/src/pages/agent/form/parser-form/spreadsheet-form-fields.tsx@@ -65,7 +65,10 @@ export function SpreadsheetFormFields({ prefix }: CommonProps) {// On a file-type switch the field remounts and react-hook-form re-seeds it// from the node's saved form data, so it can hold another file type's// static parse method (e.g. ocr) — reset it to DeepDOC in that case too.- if (isEmpty(current) || isForeignParseMethod(FileType.Spreadsheet, current)) {+ if (+ isEmpty(current) ||+ isForeignParseMethod(FileType.Spreadsheet, current)+ ) {form.setValue(parseMethodName, ParseDocumentType.DeepDOC, {shouldValidate: true,shouldDirty: true,diff --git a/web/src/pages/agent/form/parser-form/utils.test.ts b/web/src/pages/agent/form/parser-form/utils.test.tsindex dee24bfa66..8ee78f28ae 100644--- a/web/src/pages/agent/form/parser-form/utils.test.ts+++ b/web/src/pages/agent/form/parser-form/utils.test.ts@@ -9,7 +9,9 @@ describe('parser-form utils', () => {});it('returns DeepDOC for pdf/spreadsheet/powerpoint', () => {- expect(getInitialParseMethod(FileType.PDF)).toBe(ParseDocumentType.DeepDOC);+ expect(getInitialParseMethod(FileType.PDF)).toBe(+ ParseDocumentType.DeepDOC,+ );expect(getInitialParseMethod(FileType.Spreadsheet)).toBe(ParseDocumentType.DeepDOC,);@@ -26,19 +28,21 @@ describe('parser-form utils', () => {describe('isForeignParseMethod', () => {it('treats a static method from another file type as foreign', () => {// The bug: switching pdf -> image left DeepDOC in parse_method- expect(isForeignParseMethod(FileType.Image, ParseDocumentType.DeepDOC)).toBe(+ expect(+ isForeignParseMethod(FileType.Image, ParseDocumentType.DeepDOC),+ ).toBe(true);+ expect(isForeignParseMethod(FileType.PDF, ImageParseMethod.OCR)).toBe(true,);- expect(isForeignParseMethod(FileType.PDF, ImageParseMethod.OCR)).toBe(true);});it('accepts the file type’s own initial method', () => {expect(isForeignParseMethod(FileType.Image, ImageParseMethod.OCR)).toBe(false,);- expect(isForeignParseMethod(FileType.PDF, ParseDocumentType.DeepDOC)).toBe(- false,- );+ expect(+ isForeignParseMethod(FileType.PDF, ParseDocumentType.DeepDOC),+ ).toBe(false);});it('never treats an LLM model id as foreign', () => {diff --git a/web/src/pages/agent/form/title-chunker-form/hook.ts b/web/src/pages/agent/form/title-chunker-form/hook.tsindex e94d5eaa46..f1becfade5 100644--- a/web/src/pages/agent/form/title-chunker-form/hook.ts+++ b/web/src/pages/agent/form/title-chunker-form/hook.ts@@ -123,7 +123,11 @@ function transformApiResponseToForm(}let chunk_token_cap = apiData.chunk_token_cap;- if (chunk_token_cap === undefined || chunk_token_cap === null || chunk_token_cap === '') {+ if (+ chunk_token_cap === undefined ||+ chunk_token_cap === null ||+ chunk_token_cap === ''+ ) {chunk_token_cap = 512;} else {chunk_token_cap = Number(chunk_token_cap);diff --git a/web/src/pages/agent/form/title-chunker-form/index.tsx b/web/src/pages/agent/form/title-chunker-form/index.tsxindex e8691dfd65..a37d1b6516 100644--- a/web/src/pages/agent/form/title-chunker-form/index.tsx+++ b/web/src/pages/agent/form/title-chunker-form/index.tsx@@ -1,5 +1,6 @@import { FormFieldType, RenderField } from '@/components/dynamic-form';import { SelectWithSearch } from '@/components/originui/select-with-search';+import { useSyncExternalFormErrors } from '@/components/pipeline-operator-tabs/use-sync-external-form-errors';import { RAGFlowFormItem } from '@/components/ragflow-form';import { SliderInputFormField } from '@/components/slider-input-form-field';import { BlockButton, Button } from '@/components/ui/button';@@ -64,12 +65,7 @@ export const FormSchema = z.object({root_chunk_as_heading: z.boolean().optional(),hierarchyRules: rulesSchema,groupRules: rulesSchema,- chunk_token_cap: z- .number()- .int()- .min(128)- .max(8000)- .optional(),+ chunk_token_cap: z.coerce.number().int().min(128).max(8000).optional(),});export enum TitleChunkerRulesField {@@ -232,6 +228,7 @@ const TitleChunkerForm = ({node,onValuesChange,hideOutputs,+ externalErrors,}: INextOperatorForm) => {const { t } = useTranslation();const initialValues = useFormValues(initialTitleChunkerValues, node);@@ -241,6 +238,8 @@ const TitleChunkerForm = ({resolver: zodResolver(FormSchema),mode: 'onChange',});++ useSyncExternalFormErrors(form, externalErrors);const [showAllTip, setShowAllTip] = useState(true);const method = useWatch({ name: 'method', control: form.control });diff --git a/web/src/pages/agent/form/token-chunker-form/index.tsx b/web/src/pages/agent/form/token-chunker-form/index.tsxindex 7cc935fc26..90edfe48b6 100644--- a/web/src/pages/agent/form/token-chunker-form/index.tsx+++ b/web/src/pages/agent/form/token-chunker-form/index.tsx@@ -1,5 +1,6 @@import { DelimiterInput } from '@/components/delimiter-form-field';import { FormFieldType, RenderField } from '@/components/dynamic-form';+import { useSyncExternalFormErrors } from '@/components/pipeline-operator-tabs/use-sync-external-form-errors';import { RAGFlowFormItem } from '@/components/ragflow-form';import { SliderInputFormField } from '@/components/slider-input-form-field';import { BlockButton, Button } from '@/components/ui/button';@@ -47,6 +48,7 @@ const TokenChunkerForm = ({node,onValuesChange,hideOutputs,+ externalErrors,}: INextOperatorForm) => {const defaultValues = useFormValues(initialTokenChunkerValues, node);const { t } = useTranslation();@@ -66,8 +68,11 @@ const TokenChunkerForm = ({const form = useForm<TokenChunkerFormSchemaType>({defaultValues: formDefaultValues,resolver: zodResolver(FormSchema),+ mode: 'onChange',});+ useSyncExternalFormErrors(form, externalErrors);+const delimiterMode = form.watch('delimiter_mode');const name = 'delimiters';diff --git a/web/src/pages/agent/form/tokenizer-form/index.tsx b/web/src/pages/agent/form/tokenizer-form/index.tsxindex a4cdcfdddb..95b0b4ce4c 100644--- a/web/src/pages/agent/form/tokenizer-form/index.tsx+++ b/web/src/pages/agent/form/tokenizer-form/index.tsx@@ -1,4 +1,5 @@import { SelectWithSearch } from '@/components/originui/select-with-search';+import { useSyncExternalFormErrors } from '@/components/pipeline-operator-tabs/use-sync-external-form-errors';import { RAGFlowFormItem } from '@/components/ragflow-form';import { SliderInputFormField } from '@/components/slider-input-form-field';import { Form } from '@/components/ui/form';@@ -36,6 +37,7 @@ const TokenizerForm = ({node,onValuesChange,hideOutputs,+ externalErrors,}: INextOperatorForm) => {const { t } = useTranslation();const defaultValues = useFormValues(initialTokenizerValues, node);@@ -57,6 +59,8 @@ const TokenizerForm = ({mode: 'onChange',});+ useSyncExternalFormErrors(form, externalErrors);+useWatchFormChange(node?.id, form);useFormChangeCallback(form, onValuesChange);diff --git a/web/src/pages/agent/interface.ts b/web/src/pages/agent/interface.tsindex 4e7a7de67c..e29c2801fb 100644--- a/web/src/pages/agent/interface.ts+++ b/web/src/pages/agent/interface.ts@@ -1,5 +1,6 @@import { FormInstance } from '@/interfaces/antd-compat';import { RAGFlowNodeType } from '@/interfaces/database/agent';+import { FieldErrors } from 'react-hook-form';export interface IOperatorForm {onValuesChange?(changedValues: any, values: any): void;@@ -13,6 +14,9 @@ export interface INextOperatorForm {nodeId?: string;onValuesChange?(values: any): void;hideOutputs?: boolean;+ // Validation errors produced for this operator by an outer form's schema+ // (parser_config.<operatorId>), mirrored onto the fields of this form.+ externalErrors?: FieldErrors;}export interface IGenerateParameter {diff --git a/web/src/pages/dataset/setting/go/form-schema.ts b/web/src/pages/dataset/setting/go/form-schema.tsindex 341d228e81..c11de02c93 100644--- a/web/src/pages/dataset/setting/go/form-schema.ts+++ b/web/src/pages/dataset/setting/go/form-schema.ts@@ -1,3 +1,4 @@+import { addParserConfigIssues } from '@/components/pipeline-operator-tabs/parser-config-validation';import { DESCRIPTION_MAX_LENGTH } from '@/constants/common';import { ParseType } from '@/constants/knowledge';import { t } from 'i18next';@@ -47,4 +48,5 @@ export const formSchema = zcode: 'custom',});}+ addParserConfigIssues(data.parser_config, ctx, t);});diff --git a/web/src/pages/dataset/setting/go/index.tsx b/web/src/pages/dataset/setting/go/index.tsxindex 2859a94757..e24fb99b7f 100644--- a/web/src/pages/dataset/setting/go/index.tsx+++ b/web/src/pages/dataset/setting/go/index.tsx@@ -21,7 +21,7 @@ import {} from '@/hooks/use-pipeline-operator';import { zodResolver } from '@hookform/resolvers/zod';import { useCallback, useEffect, useState } from 'react';-import { useForm, useWatch } from 'react-hook-form';+import { FieldErrors, useForm, useFormState, useWatch } from 'react-hook-form';import { useTranslation } from 'react-i18next';import { z } from 'zod';import ChunkMethodLearnMore from '../python/chunk-method-learn-more';@@ -143,6 +143,22 @@ export default function DatasetSetting() {[handleSave],);+ const onInvalid = useCallback(+ (errors: FieldErrors) => {+ // Surface the first failing operator tab so its field errors are visible.+ const firstOperatorId = Object.keys(errors?.parser_config ?? {})[0];+ if (firstOperatorId) {+ setActiveTab(firstOperatorId);+ }+ },+ [setActiveTab],+ );++ const { errors } = useFormState({+ control: form.control,+ name: 'parser_config',+ });+const { handleLinkOrEditSubmit, unbindFunc, handleAutoParse } =useConnectorHandlers(form, sourceDataState, setSourceDataState);@@ -181,7 +197,7 @@ export default function DatasetSetting() {<CardContent className="p-0 flex-1 h-0 flex divide-x-0.5"><Form {...form}><form- onSubmit={form.handleSubmit(handleSubmit)}+ onSubmit={form.handleSubmit(handleSubmit, onInvalid)}className="flex flex-col"><div className="flex-1 h-0 w-[768px] px-5 pt-5 overflow-y-auto scrollbar-auto">@@ -213,6 +229,11 @@ export default function DatasetSetting() {value={activeTab}onValueChange={setActiveTab}onOperatorValuesChange={handleOperatorValuesChange}+ operatorFormErrors={+ errors.parser_config as+ | Record<string, FieldErrors | undefined>+ | undefined+ }/>)}