fix: skip built-in parser validation when pipeline mode is selected (#18158)

This commit is contained in:
chanx
2026-08-12 15:41:15 +08:00
committed by GitHub
parent 051b296e7f
commit efa1c6c48a
2 changed files with 10 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ import { useCallback } from 'react';
const hideAutoKeywords = ['qa', 'table', 'resume', 'knowledge_graph', 'tag'];
export const useShowAutoKeywords = () => {
const showAutoKeywords = useCallback((selectedTag: string) => {
const showAutoKeywords = useCallback((selectedTag: string | undefined) => {
return hideAutoKeywords.every((x) => selectedTag !== x);
}, []);

View File

@@ -116,12 +116,7 @@ export function ChunkMethodDialog({
const FormSchema = z
.object({
parseType: z.nativeEnum(ParseType),
parser_id: z
.string()
.min(1, {
message: t('common.pleaseSelect'),
})
.trim(),
parser_id: z.string().trim().optional(),
pipeline_id: z.string().optional(),
parser_config: z.object({
task_page_size: z.coerce.number().optional(),
@@ -186,6 +181,13 @@ export function ChunkMethodDialog({
}),
})
.superRefine((data, ctx) => {
if (data.parseType === ParseType.BuiltIn && !data.parser_id) {
ctx.addIssue({
path: ['parser_id'],
message: t('common.pleaseSelect'),
code: 'custom',
});
}
if (data.parseType === ParseType.Pipeline && !data.pipeline_id) {
ctx.addIssue({
path: ['pipeline_id'],
@@ -251,6 +253,7 @@ export function ChunkMethodDialog({
);
const nextData = {
...data,
parser_id: data.parser_id || '',
parser_config: {
...parserConfig,
image_table_context_window: imageTableContextWindow,