Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: eco knowledge retrieval method (#6798)

zxhlyh0a744a73b3cd
diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx
index d71d26bbedc..683617bf252 100644
--- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx
+++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx
@@ -32,6 +32,7 @@ import { RerankingModeEnum } from '@/models/datasets'
import cn from '@/utils/classnames'
import { useSelectedDatasetsMode } from '@/app/components/workflow/nodes/knowledge-retrieval/hooks'
import Switch from '@/app/components/base/switch'
+import { useGetLanguage } from '@/context/i18n'
type Props = {
datasetConfigs: DatasetConfigs
@@ -43,6 +44,11 @@ type Props = {
selectedDatasets?: DataSet[]
}
+const LEGACY_LINK_MAP = {
+ en_US: 'https://docs.dify.ai/guides/knowledge-base/integrate-knowledge-within-application',
+ zh_Hans: 'https://docs.dify.ai/v/zh-hans/guides/knowledge-base/integrate_knowledge_within_application',
+} as Record<string, string>
+
const ConfigContent: FC<Props> = ({
datasetConfigs,
onChange,
@@ -53,6 +59,7 @@ const ConfigContent: FC<Props> = ({
selectedDatasets = [],
}) => {
const { t } = useTranslation()
+ const language = useGetLanguage()
const selectedDatasetsMode = useSelectedDatasetsMode(selectedDatasets)
const type = datasetConfigs.retrieval_model
const setType = (value: RETRIEVE_TYPE) => {
@@ -167,7 +174,21 @@ const ConfigContent: FC<Props> = ({
title={(
<div className='flex items-center'>
{t('appDebug.datasetConfig.retrieveOneWay.title')}
- <TooltipPlus popupContent={<div className='w-[320px]'>{t('dataset.nTo1RetrievalLegacy')}</div>}>
+ <TooltipPlus
+ popupContent={(
+ <div className='w-[320px]'>
+ {t('dataset.nTo1RetrievalLegacy')}
+ <a
+ className='underline'
+ href={LEGACY_LINK_MAP[language]}
+ target='_blank'
+ rel='noopener noreferrer'
+ >
+ ({t('dataset.nTo1RetrievalLegacyLink')})
+ </a>
+ </div>
+ )}
+ >
<div className='ml-1 flex items-center px-[5px] h-[18px] rounded-[5px] border border-text-accent-secondary system-2xs-medium-uppercase text-text-accent-secondary'>legacy</div>
</TooltipPlus>
</div>
diff --git a/web/hooks/use-knowledge.ts b/web/hooks/use-knowledge.ts
index 657acb3f510..400d9722de8 100644
--- a/web/hooks/use-knowledge.ts
+++ b/web/hooks/use-knowledge.ts
@@ -8,7 +8,10 @@ export const useKnowledge = () => {
return t(`dataset.indexingTechnique.${indexingTechnique}`)
}, [t])
- const formatIndexingMethod = useCallback((indexingMethod: string) => {
+ const formatIndexingMethod = useCallback((indexingMethod: string, isEco?: boolean) => {
+ if (isEco)
+ return t('dataset.indexingMethod.invertedIndex')
+
return t(`dataset.indexingMethod.${indexingMethod}`)
}, [t])
@@ -16,7 +19,7 @@ export const useKnowledge = () => {
let result = formatIndexingTechnique(indexingTechnique)
if (indexingMethod)
- result += ` · ${formatIndexingMethod(indexingMethod)}`
+ result += ` · ${formatIndexingMethod(indexingMethod, indexingTechnique === 'economy')}`
return result
}, [formatIndexingTechnique, formatIndexingMethod])
diff --git a/web/i18n/en-US/dataset.ts b/web/i18n/en-US/dataset.ts
index 61ed3225e6e..64fda36c108 100644
--- a/web/i18n/en-US/dataset.ts
+++ b/web/i18n/en-US/dataset.ts
@@ -53,6 +53,7 @@ const translation = {
semantic_search: 'VECTOR',
full_text_search: 'FULL TEXT',
hybrid_search: 'HYBRID',
+ invertedIndex: 'INVERTED',
},
mixtureHighQualityAndEconomicTip: 'The Rerank model is required for mixture of high quality and economical knowledge bases.',
inconsistentEmbeddingModelTip: 'The Rerank model is required if the Embedding models of the selected knowledge bases are inconsistent.',
@@ -67,7 +68,8 @@ const translation = {
semantic: 'Semantic',
keyword: 'Keyword',
},
- nTo1RetrievalLegacy: 'According to the optimization and upgrade of the retrieval strategy, N-to-1 retrieval will be officially deprecated in September. Until then you can still use it normally.',
+ nTo1RetrievalLegacy: 'N-to-1 retrieval will be officially deprecated from September. It is recommended to use the latest Multi-path retrieval to obtain better results. ',
+ nTo1RetrievalLegacyLink: 'Learn more',
}
export default translation
diff --git a/web/i18n/zh-Hans/dataset.ts b/web/i18n/zh-Hans/dataset.ts
index 1750c88ce3e..1dd11c5c332 100644
--- a/web/i18n/zh-Hans/dataset.ts
+++ b/web/i18n/zh-Hans/dataset.ts
@@ -53,6 +53,7 @@ const translation = {
semantic_search: '向量检索',
full_text_search: '全文检索',
hybrid_search: '混合检索',
+ invertedIndex: '倒排索引',
},
mixtureHighQualityAndEconomicTip: '混合使用高质量和经济型知识库需要配置 Rerank 模型。',
inconsistentEmbeddingModelTip: '当所选知识库配置的 Embedding 模型不一致时,需要配置 Rerank 模型。',
@@ -67,7 +68,8 @@ const translation = {
semantic: '语义',
keyword: '关键词',
},
- nTo1RetrievalLegacy: '为了对检索策略进行优化和升级,N 选 1 检索功能将于九月份正式被优化。在此之前,您仍然可以正常使用该功能。',
+ nTo1RetrievalLegacy: '9 月 1 日起我们将不再提供此能力,推荐使用最新的多路召回获得更好的检索效果。',
+ nTo1RetrievalLegacyLink: '了解更多',
}
export default translation