Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: The operator field of the compiler operator is a required field. (#18212)

balibabu75bb42c166bc
diff --git a/web/src/components/compilation-template-form-field.tsx b/web/src/components/compilation-template-form-field.tsx
index 56dedad75e..63fe75cf64 100644
--- a/web/src/components/compilation-template-form-field.tsx
+++ b/web/src/components/compilation-template-form-field.tsx
@@ -43,6 +43,7 @@ export function CompilationTemplateFormField({
}}
className="pb-4"
horizontal={horizontal}
+ required
>
{(field) => (
<SelectWithSearch
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index 464620e1d5..c55be3aa52 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -963,6 +963,7 @@ Paragraphs:
randomSeedMessage: 'Random seed is required',
entityTypes: 'Entity types',
compilationTemplate: 'Operator',
+ compilationTemplateRequired: 'Please select an operator',
createTemplate: 'Create template',
scopeFile: 'File',
vietnamese: 'Vietnamese',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 52c9dfa877..895c525ae4 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -192,7 +192,8 @@ export default {
'无效的 Skills:未找到 SKILL.md 文件。请确保 Skills 文件目录包含有效的 SKILL.md 文件。',
invalid_frontmatter:
'无效的 Skills:SKILL.md 必须包含有效的 frontmatter(以 --- 开头和结尾)。',
- missing_name: '无效的 Skills:SKILL.md frontmatter 必须包含 "name" 字段。',
+ missing_name:
+ '无效的 Skills:SKILL.md frontmatter 必须包含 "name" 字段。',
invalid_name_format:
'无效的 Skills:"name" 必须是小写且 URL 安全的(仅字母、数字、连字符)。',
invalid_version:
@@ -873,6 +874,7 @@ export default {
maxClusterTip: '最多可创建的聚类数。',
entityTypes: 'Entity 类型',
compilationTemplate: '算子',
+ compilationTemplateRequired: '请选择算子',
createTemplate: '创建模板',
scopeFile: '文件',
pageRank: '页面排名',
@@ -1114,7 +1116,8 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 R
regenerate: '重新生成',
read: '朗读内容',
tts: '文本转语音',
- ttsTip: '是否用语音转换播放语音,请先在设置里面选择 TTS(语音转换模型)。',
+ ttsTip:
+ '是否用语音转换播放语音,请先在设置里面选择 TTS(语音转换模型)。',
relatedQuestion: '相关问题',
answerTitle: '智能回答',
multiTurn: '多轮对话优化',
@@ -1600,7 +1603,8 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 R
globalRules: '全局规则',
globalRulesPlaceholder: '请输入全局编译规则',
plan: 'Plan',
- planTip: '关闭:每个 Entity 或 Concept 对应一个 Wiki 页面。开启:让 LLM 决定将某些 Entity/Concept 组合到单个 Wiki 页面。',
+ planTip:
+ '关闭:每个 Entity 或 Concept 对应一个 Wiki 页面。开启:让 LLM 决定将某些 Entity/Concept 组合到单个 Wiki 页面。',
raptorTreeSettings: 'RAPTOR 树设置',
summarizationPrompt: '摘要提示词',
maxToken: '最大 token 数',
diff --git a/web/src/pages/agent/form/compilation-form/index.tsx b/web/src/pages/agent/form/compilation-form/index.tsx
index 5b1dd00558..74e1ac1c94 100644
--- a/web/src/pages/agent/form/compilation-form/index.tsx
+++ b/web/src/pages/agent/form/compilation-form/index.tsx
@@ -6,6 +6,7 @@ import { useTranslate } from '@/hooks/common-hooks';
import { zodResolver } from '@hookform/resolvers/zod';
import { memo } from 'react';
import { useForm } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
import { z } from 'zod';
import { initialCompilationValues } from '../../constant/pipeline';
import { useOwnerTenantId } from '../../context';
@@ -17,13 +18,23 @@ import { buildOutputList } from '../../utils/build-output-list';
import { FormWrapper } from '../components/form-wrapper';
import { Output } from '../components/output';
-export const FormSchema = z.object({
- compilation_template_group_id: z.string().optional(),
- llm_id: z.string().optional(),
- plan: z.boolean(),
-});
+function useFormSchema() {
+ const { t } = useTranslation();
-export type CompilationFormSchemaType = z.infer<typeof FormSchema>;
+ const FormSchema = z.object({
+ compilation_template_group_id: z
+ .string()
+ .min(1, t('knowledgeConfiguration.compilationTemplateRequired')),
+ llm_id: z.string().optional(),
+ plan: z.boolean(),
+ });
+
+ return FormSchema;
+}
+
+export type CompilationFormSchemaType = z.infer<
+ ReturnType<typeof useFormSchema>
+>;
const outputList = buildOutputList(initialCompilationValues.outputs);
@@ -35,6 +46,7 @@ const CompilationForm = ({
const defaultValues = useFormValues(initialCompilationValues, node);
const ownerTenantId = useOwnerTenantId();
const { t } = useTranslate('setting');
+ const FormSchema = useFormSchema();
const form = useForm<CompilationFormSchemaType>({
defaultValues,