mirror of https://github.com/langgenius/dify.git
refactor(retrieval-method): update retrieval method from invertedIndex to keywordSearch across components
This commit is contained in:
parent
f82f06bdd0
commit
42935997aa
|
|
@ -24,7 +24,7 @@ const EconomicalRetrievalMethodConfig: FC<Props> = ({
|
|||
|
||||
return (
|
||||
<OptionCard
|
||||
id={RETRIEVE_METHOD.invertedIndex}
|
||||
id={RETRIEVE_METHOD.keywordSearch}
|
||||
disabled={disabled}
|
||||
icon={<VectorSearch className='size-4' />}
|
||||
iconActiveColor='text-util-colors-purple-purple-600'
|
||||
|
|
@ -37,7 +37,7 @@ const EconomicalRetrievalMethodConfig: FC<Props> = ({
|
|||
className='gap-x-2'
|
||||
>
|
||||
<RetrievalParamConfig
|
||||
type={RETRIEVE_METHOD.invertedIndex}
|
||||
type={RETRIEVE_METHOD.keywordSearch}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const RetrievalParamConfig: FC<Props> = ({
|
|||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const canToggleRerankModalEnable = type !== RETRIEVE_METHOD.hybrid
|
||||
const isEconomical = type === RETRIEVE_METHOD.invertedIndex
|
||||
const isEconomical = type === RETRIEVE_METHOD.keywordSearch
|
||||
const isHybridSearch = type === RETRIEVE_METHOD.hybrid
|
||||
const {
|
||||
modelList: rerankModelList,
|
||||
|
|
@ -61,7 +61,6 @@ const RetrievalParamConfig: FC<Props> = ({
|
|||
...value,
|
||||
reranking_enable: enable,
|
||||
})
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [currentModel, onChange, value])
|
||||
|
||||
const rerankModel = useMemo(() => {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ const TextAreaWithButton = ({
|
|||
setLoading(false)
|
||||
}
|
||||
|
||||
const retrievalMethod = isEconomy ? RETRIEVE_METHOD.invertedIndex : retrievalConfig.search_method
|
||||
const retrievalMethod = isEconomy ? RETRIEVE_METHOD.keywordSearch : retrievalConfig.search_method
|
||||
const icon = <Image className='size-3.5 text-util-colors-purple-purple-600' src={getIcon(retrievalMethod)} alt='' />
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export const useRetrievalSetting = (indexMethod?: IndexMethodEnum) => {
|
|||
}, [t])
|
||||
const InvertedIndexOption: Option = useMemo(() => {
|
||||
return {
|
||||
id: RetrievalSearchMethodEnum.invertedIndex,
|
||||
id: RetrievalSearchMethodEnum.keywordSearch,
|
||||
icon: HybridSearch as any,
|
||||
title: t('dataset.retrieval.invertedIndex.title'),
|
||||
description: t('dataset.retrieval.invertedIndex.description'),
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ const SearchMethodOption = ({
|
|||
isScoreThresholdEnabled={isScoreThresholdEnabled}
|
||||
onScoreThresholdEnabledChange={onScoreThresholdEnabledChange}
|
||||
readonly={readonly}
|
||||
hiddenScoreThreshold={searchMethod === RetrievalSearchMethodEnum.invertedIndex}
|
||||
hiddenScoreThreshold={searchMethod === RetrievalSearchMethodEnum.keywordSearch}
|
||||
/>
|
||||
</div>
|
||||
</OptionCard>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export const useConfig = (id: string) => {
|
|||
indexing_technique: (chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) ? IndexMethodEnum.QUALIFIED : indexing_technique,
|
||||
retrieval_model: {
|
||||
...retrieval_model,
|
||||
search_method: ((chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) && !isHighQualitySearchMethod(search_method)) ? RetrievalSearchMethodEnum.semantic : search_method,
|
||||
search_method: ((chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) && !isHighQualitySearchMethod(search_method)) ? RetrievalSearchMethodEnum.keywordSearch : search_method,
|
||||
},
|
||||
index_chunk_variable_selector: chunkStructure === chunk_structure ? index_chunk_variable_selector : [],
|
||||
})
|
||||
|
|
@ -62,7 +62,7 @@ export const useConfig = (id: string) => {
|
|||
draft.indexing_technique = indexMethod
|
||||
|
||||
if (indexMethod === IndexMethodEnum.ECONOMICAL)
|
||||
draft.retrieval_model.search_method = RetrievalSearchMethodEnum.invertedIndex
|
||||
draft.retrieval_model.search_method = RetrievalSearchMethodEnum.keywordSearch
|
||||
else if (indexMethod === IndexMethodEnum.QUALIFIED)
|
||||
draft.retrieval_model.search_method = RetrievalSearchMethodEnum.semantic
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ export const useSettingsDisplay = () => {
|
|||
[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'),
|
||||
[RetrievalSearchMethodEnum.keywordSearch]: t('dataset.retrieval.invertedIndex.title'),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue