From 9e19ed4e67acd42ff87497f624ecd550d0c4a628 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Tue, 10 Jun 2025 10:16:13 +0800 Subject: [PATCH] knowledge base node checklisst --- .../workflow/nodes/knowledge-base/default.ts | 35 +++++++++++++++---- web/i18n/en-US/workflow.ts | 3 ++ web/i18n/zh-Hans/workflow.ts | 3 ++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/nodes/knowledge-base/default.ts b/web/app/components/workflow/nodes/knowledge-base/default.ts index 29d37c66d2..a7132df364 100644 --- a/web/app/components/workflow/nodes/knowledge-base/default.ts +++ b/web/app/components/workflow/nodes/knowledge-base/default.ts @@ -18,16 +18,37 @@ const nodeDefault: NodeDefault = { score_threshold: 0.5, }, }, - checkValid(payload) { - const { chunk_structure } = payload - let errorMessage = '' + checkValid(payload, t) { + const { + chunk_structure, + indexing_technique, + retrieval_model, + } = payload - if (!chunk_structure) - errorMessage = 'Chunk structure is required.' + if (!chunk_structure) { + return { + isValid: false, + errorMessage: t('workflow.nodes.knowledgeBase.chunkIsRequired'), + } + } + + if (!indexing_technique) { + return { + isValid: false, + errorMessage: t('workflow.nodes.knowledgeBase.indexMethodIsRequired'), + } + } + + if (!retrieval_model || !retrieval_model.search_method) { + return { + isValid: false, + errorMessage: t('workflow.nodes.knowledgeBase.retrievalSettingIsRequired'), + } + } return { - isValid: !errorMessage, - errorMessage, + isValid: true, + errorMessage: '', } }, } diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index 82ea1a9bff..2196761575 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -894,6 +894,9 @@ const translation = { chooseChunkStructure: 'Choose a chunk structure', changeChunkStructure: 'Change Chunk Structure', aboutRetrieval: 'about retrieval method.', + chunkIsRequired: 'Chunk structure is required', + indexMethodIsRequired: 'Index method is required', + retrievalSettingIsRequired: 'Retrieval setting is required', }, }, tracing: { diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 003d7f651d..2571a866b9 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -895,6 +895,9 @@ const translation = { chooseChunkStructure: '选择分段结构', changeChunkStructure: '更改分段结构', aboutRetrieval: '关于知识检索。', + chunkIsRequired: '分段结构是必需的', + indexMethodIsRequired: '索引方法是必需的', + retrievalSettingIsRequired: '检索设置是必需的', }, }, tracing: {