From af0d00e5e9f09eae38a575c3871f2c0814e7f602 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Fri, 27 Mar 2026 18:00:48 +0800 Subject: [PATCH] refactor(web): make description optional and remove default values for bot, pipeline, and knowledge base - Remove .min(1) validation on description field, replace with .optional().default('') - Remove pre-filled default description text from all three create forms - Remove required asterisk (*) marker from description labels - No backend changes needed: Bot/Pipeline DB accepts empty string, KB DB allows null --- .../app/home/bots/components/bot-form/BotForm.tsx | 11 +++-------- .../home/knowledge/components/kb-form/KBForm.tsx | 11 +++-------- .../pipeline-form/PipelineFormComponent.tsx | 13 +++---------- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/web/src/app/home/bots/components/bot-form/BotForm.tsx b/web/src/app/home/bots/components/bot-form/BotForm.tsx index 36e4bcf9..71198cbc 100644 --- a/web/src/app/home/bots/components/bot-form/BotForm.tsx +++ b/web/src/app/home/bots/components/bot-form/BotForm.tsx @@ -53,9 +53,7 @@ import { CustomApiError } from '@/app/infra/entities/common'; const getFormSchema = (t: (key: string) => string) => z.object({ name: z.string().min(1, { message: t('bots.botNameRequired') }), - description: z - .string() - .min(1, { message: t('bots.botDescriptionRequired') }), + description: z.string().optional().default(''), adapter: z.string().min(1, { message: t('bots.adapterRequired') }), adapter_config: z.record(z.string(), z.any()), enable: z.boolean().optional(), @@ -80,7 +78,7 @@ export default function BotForm({ resolver: zodResolver(formSchema), defaultValues: { name: '', - description: t('bots.defaultDescription'), + description: '', adapter: '', adapter_config: {}, enable: true, @@ -427,10 +425,7 @@ export default function BotForm({ name="description" render={({ field }) => ( - - {t('bots.botDescription')} - * - + {t('bots.botDescription')} diff --git a/web/src/app/home/knowledge/components/kb-form/KBForm.tsx b/web/src/app/home/knowledge/components/kb-form/KBForm.tsx index e53a18f9..4eee2a64 100644 --- a/web/src/app/home/knowledge/components/kb-form/KBForm.tsx +++ b/web/src/app/home/knowledge/components/kb-form/KBForm.tsx @@ -46,9 +46,7 @@ import { UUID } from 'uuidjs'; const getFormSchema = (t: (key: string) => string) => z.object({ name: z.string().min(1, { message: t('knowledge.kbNameRequired') }), - description: z - .string() - .min(1, { message: t('knowledge.kbDescriptionRequired') }), + description: z.string().optional().default(''), emoji: z.string().optional(), ragEngineId: z .string() @@ -115,7 +113,7 @@ export default function KBForm({ resolver: zodResolver(formSchema), defaultValues: { name: '', - description: t('knowledge.defaultDescription'), + description: '', emoji: '📚', ragEngineId: '', }, @@ -373,10 +371,7 @@ export default function KBForm({ name="description" render={({ field }) => ( - - {t('knowledge.kbDescription')} - * - + {t('knowledge.kbDescription')} diff --git a/web/src/app/home/pipelines/components/pipeline-form/PipelineFormComponent.tsx b/web/src/app/home/pipelines/components/pipeline-form/PipelineFormComponent.tsx index cfe50f0f..aea3e205 100644 --- a/web/src/app/home/pipelines/components/pipeline-form/PipelineFormComponent.tsx +++ b/web/src/app/home/pipelines/components/pipeline-form/PipelineFormComponent.tsx @@ -80,9 +80,7 @@ export default function PipelineFormComponent({ ? z.object({ basic: z.object({ name: z.string().min(1, { message: t('pipelines.nameRequired') }), - description: z - .string() - .min(1, { message: t('pipelines.descriptionRequired') }), + description: z.string().optional().default(''), emoji: z.string().optional(), }), ai: z.record(z.string(), z.any()), @@ -93,9 +91,7 @@ export default function PipelineFormComponent({ : z.object({ basic: z.object({ name: z.string().min(1, { message: t('pipelines.nameRequired') }), - description: z - .string() - .min(1, { message: t('pipelines.descriptionRequired') }), + description: z.string().optional().default(''), emoji: z.string().optional(), }), ai: z.record(z.string(), z.any()).optional(), @@ -563,10 +559,7 @@ export default function PipelineFormComponent({ name="basic.description" render={({ field }) => ( - - {t('common.description')} - * - + {t('common.description')}