mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 23:16:58 +08:00
### What problem does this PR solve? fix: Added dataset generation logging functionality #9869 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
89 lines
2.4 KiB
TypeScript
89 lines
2.4 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const formSchema = z.object({
|
|
name: z.string().min(1, {
|
|
message: 'Username must be at least 2 characters.',
|
|
}),
|
|
description: z.string().min(2, {
|
|
message: 'Username must be at least 2 characters.',
|
|
}),
|
|
// avatar: z.instanceof(File),
|
|
avatar: z.any().nullish(),
|
|
permission: z.string().optional(),
|
|
parser_id: z.string(),
|
|
embd_id: z.string(),
|
|
parser_config: z
|
|
.object({
|
|
layout_recognize: z.string(),
|
|
chunk_token_num: z.number(),
|
|
delimiter: z.string(),
|
|
auto_keywords: z.number().optional(),
|
|
auto_questions: z.number().optional(),
|
|
html4excel: z.boolean(),
|
|
tag_kb_ids: z.array(z.string()).nullish(),
|
|
topn_tags: z.number().optional(),
|
|
raptor: z
|
|
.object({
|
|
use_raptor: z.boolean().optional(),
|
|
prompt: z.string().optional(),
|
|
max_token: z.number().optional(),
|
|
threshold: z.number().optional(),
|
|
max_cluster: z.number().optional(),
|
|
random_seed: z.number().optional(),
|
|
})
|
|
.refine(
|
|
(data) => {
|
|
if (data.use_raptor && !data.prompt) {
|
|
return false;
|
|
}
|
|
return true;
|
|
},
|
|
{
|
|
message: 'Prompt is required',
|
|
path: ['prompt'],
|
|
},
|
|
),
|
|
graphrag: z
|
|
.object({
|
|
use_graphrag: z.boolean().optional(),
|
|
entity_types: z.array(z.string()).optional(),
|
|
method: z.string().optional(),
|
|
resolution: z.boolean().optional(),
|
|
community: z.boolean().optional(),
|
|
})
|
|
.refine(
|
|
(data) => {
|
|
if (
|
|
data.use_graphrag &&
|
|
(!data.entity_types || data.entity_types.length === 0)
|
|
) {
|
|
return false;
|
|
}
|
|
return true;
|
|
},
|
|
{
|
|
message: 'Please enter Entity types',
|
|
path: ['entity_types'],
|
|
},
|
|
),
|
|
})
|
|
.optional(),
|
|
pagerank: z.number(),
|
|
// icon: z.array(z.instanceof(File)),
|
|
});
|
|
|
|
export const pipelineFormSchema = z.object({
|
|
data_flow: z.array(z.string()).optional(),
|
|
set_default: z.boolean().optional(),
|
|
file_filter: z.string().optional(),
|
|
});
|
|
|
|
export const linkPiplineFormSchema = pipelineFormSchema.pick({
|
|
data_flow: true,
|
|
file_filter: true,
|
|
});
|
|
export const editPiplineFormSchema = pipelineFormSchema.pick({
|
|
set_default: true,
|
|
file_filter: true,
|
|
});
|