diff --git a/web/app/components/workflow/block-selector/blocks.tsx b/web/app/components/workflow/block-selector/blocks.tsx index 64622d7de0..e6e733a141 100644 --- a/web/app/components/workflow/block-selector/blocks.tsx +++ b/web/app/components/workflow/block-selector/blocks.tsx @@ -3,6 +3,7 @@ import { useCallback, useMemo, } from 'react' +import { useStoreApi } from 'reactflow' import { useTranslation } from 'react-i18next' import { groupBy } from 'lodash-es' import BlockIcon from '../block-icon' @@ -26,6 +27,7 @@ const Blocks = ({ blocks, }: BlocksProps) => { const { t } = useTranslation() + const store = useStoreApi() const groups = useMemo(() => { return BLOCK_CLASSIFICATIONS.reduce((acc, classification) => { @@ -43,6 +45,14 @@ const Blocks = ({ const renderGroup = useCallback((classification: string) => { const list = groups[classification].sort((a, b) => a.metaData.sort - b.metaData.sort) + const { getNodes } = store.getState() + const nodes = getNodes() + const hasKnowledgeBaseNode = nodes.some(node => node.data.type === BlockEnum.KnowledgeBase) + const filteredList = list.filter((block) => { + if (hasKnowledgeBaseNode) + return block.metaData.type !== BlockEnum.KnowledgeBase + return true + }) return (
{ - classification !== '-' && !!list.length && ( + classification !== '-' && !!filteredList.length && (
{t(`workflow.tabs.${classification}`)}
) } { - list.map(block => ( + filteredList.map(block => ( ) - }, [groups, onSelect, t]) + }, [groups, onSelect, t, store]) return (
diff --git a/web/app/components/workflow/block-selector/main.tsx b/web/app/components/workflow/block-selector/main.tsx index 38cb8bdb63..f05994159f 100644 --- a/web/app/components/workflow/block-selector/main.tsx +++ b/web/app/components/workflow/block-selector/main.tsx @@ -105,6 +105,9 @@ const NodeSelector: FC = ({ if (activeTab === TabsEnum.Tools) return t('workflow.tabs.searchTool') + + if (activeTab === TabsEnum.Sources) + return t('workflow.tabs.searchDataSource') return '' }, [activeTab, t]) diff --git a/web/app/components/workflow/block-selector/utils.ts b/web/app/components/workflow/block-selector/utils.ts index 0ebefa2e01..eb6d6727b0 100644 --- a/web/app/components/workflow/block-selector/utils.ts +++ b/web/app/components/workflow/block-selector/utils.ts @@ -4,7 +4,7 @@ import type { DataSourceItem } from './types' export const transformDataSourceToTool = (dataSourceItem: DataSourceItem) => { return { - id: dataSourceItem.plugin_unique_identifier, + id: dataSourceItem.plugin_id, name: dataSourceItem.declaration.identity.name, author: dataSourceItem.declaration.identity.author, description: dataSourceItem.declaration.identity.description, diff --git a/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx b/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx index 71a7753f7b..ca0f007e4f 100644 --- a/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx @@ -94,7 +94,7 @@ const IndexMethod = ({
- Number of Keywords + {t('datasetSettings.form.numberOfKeywords')}
{ + const { t } = useTranslation() + + return { + [IndexMethodEnum.QUALIFIED]: t('datasetCreation.stepTwo.qualified'), + [IndexMethodEnum.ECONOMICAL]: t('datasetSettings.form.indexMethodEconomy'), + [RetrievalSearchMethodEnum.semantic]: t('dataset.retrieval.semantic_search.title'), + [RetrievalSearchMethodEnum.fullText]: t('dataset.retrieval.full_text_search.title'), + [RetrievalSearchMethodEnum.hybrid]: t('dataset.retrieval.hybrid_search.title'), + [RetrievalSearchMethodEnum.invertedIndex]: t('dataset.retrieval.invertedIndex.title'), + } +} diff --git a/web/app/components/workflow/nodes/knowledge-base/node.tsx b/web/app/components/workflow/nodes/knowledge-base/node.tsx index 854f104c03..c40acf0680 100644 --- a/web/app/components/workflow/nodes/knowledge-base/node.tsx +++ b/web/app/components/workflow/nodes/knowledge-base/node.tsx @@ -2,19 +2,22 @@ import type { FC } from 'react' import { memo } from 'react' import { useTranslation } from 'react-i18next' import type { KnowledgeBaseNodeType } from './types' +import { useSettingsDisplay } from './hooks/use-settings-display' import type { NodeProps } from '@/app/components/workflow/types' const Node: FC> = ({ data }) => { const { t } = useTranslation() + const settingsDisplay = useSettingsDisplay() + return (
{t('datasetCreation.stepTwo.indexMode')}
-
{data.indexing_technique}
+
{settingsDisplay[data.indexing_technique]}
{t('datasetSettings.form.retrievalSetting.title')}
-
{data.retrieval_model.search_method}
+
{(settingsDisplay as Record)[data.retrieval_model.search_method]}
) diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index 6bb4ba07fe..e67a48c9f8 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -231,6 +231,7 @@ const translation = { 'noResult': 'No match found', 'agent': 'Agent Strategy', 'sources': 'Sources', + 'searchDataSource': 'Search Data Source', }, blocks: { 'start': 'Start', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 34d5d91cd6..c40c49613c 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -232,6 +232,7 @@ const translation = { 'noResult': '未找到匹配项', 'agent': 'Agent 策略', 'sources': '数据源', + 'searchDataSource': '搜索数据源', }, blocks: { 'start': '开始',