refactor(retrieval-method): update retrieval method from invertedIndex to keywordSearch across components

This commit is contained in:
twwu 2025-08-21 16:29:23 +08:00
parent f82f06bdd0
commit 42935997aa
7 changed files with 9 additions and 10 deletions

View File

@ -24,7 +24,7 @@ const EconomicalRetrievalMethodConfig: FC<Props> = ({
return ( return (
<OptionCard <OptionCard
id={RETRIEVE_METHOD.invertedIndex} id={RETRIEVE_METHOD.keywordSearch}
disabled={disabled} disabled={disabled}
icon={<VectorSearch className='size-4' />} icon={<VectorSearch className='size-4' />}
iconActiveColor='text-util-colors-purple-purple-600' iconActiveColor='text-util-colors-purple-purple-600'
@ -37,7 +37,7 @@ const EconomicalRetrievalMethodConfig: FC<Props> = ({
className='gap-x-2' className='gap-x-2'
> >
<RetrievalParamConfig <RetrievalParamConfig
type={RETRIEVE_METHOD.invertedIndex} type={RETRIEVE_METHOD.keywordSearch}
value={value} value={value}
onChange={onChange} onChange={onChange}
/> />

View File

@ -38,7 +38,7 @@ const RetrievalParamConfig: FC<Props> = ({
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const canToggleRerankModalEnable = type !== RETRIEVE_METHOD.hybrid 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 isHybridSearch = type === RETRIEVE_METHOD.hybrid
const { const {
modelList: rerankModelList, modelList: rerankModelList,
@ -61,7 +61,6 @@ const RetrievalParamConfig: FC<Props> = ({
...value, ...value,
reranking_enable: enable, reranking_enable: enable,
}) })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentModel, onChange, value]) }, [currentModel, onChange, value])
const rerankModel = useMemo(() => { const rerankModel = useMemo(() => {

View File

@ -103,7 +103,7 @@ const TextAreaWithButton = ({
setLoading(false) 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='' /> const icon = <Image className='size-3.5 text-util-colors-purple-purple-600' src={getIcon(retrievalMethod)} alt='' />
return ( return (
<> <>

View File

@ -46,7 +46,7 @@ export const useRetrievalSetting = (indexMethod?: IndexMethodEnum) => {
}, [t]) }, [t])
const InvertedIndexOption: Option = useMemo(() => { const InvertedIndexOption: Option = useMemo(() => {
return { return {
id: RetrievalSearchMethodEnum.invertedIndex, id: RetrievalSearchMethodEnum.keywordSearch,
icon: HybridSearch as any, icon: HybridSearch as any,
title: t('dataset.retrieval.invertedIndex.title'), title: t('dataset.retrieval.invertedIndex.title'),
description: t('dataset.retrieval.invertedIndex.description'), description: t('dataset.retrieval.invertedIndex.description'),

View File

@ -194,7 +194,7 @@ const SearchMethodOption = ({
isScoreThresholdEnabled={isScoreThresholdEnabled} isScoreThresholdEnabled={isScoreThresholdEnabled}
onScoreThresholdEnabledChange={onScoreThresholdEnabledChange} onScoreThresholdEnabledChange={onScoreThresholdEnabledChange}
readonly={readonly} readonly={readonly}
hiddenScoreThreshold={searchMethod === RetrievalSearchMethodEnum.invertedIndex} hiddenScoreThreshold={searchMethod === RetrievalSearchMethodEnum.keywordSearch}
/> />
</div> </div>
</OptionCard> </OptionCard>

View File

@ -49,7 +49,7 @@ export const useConfig = (id: string) => {
indexing_technique: (chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) ? IndexMethodEnum.QUALIFIED : indexing_technique, indexing_technique: (chunkStructure === ChunkStructureEnum.parent_child || chunkStructure === ChunkStructureEnum.question_answer) ? IndexMethodEnum.QUALIFIED : indexing_technique,
retrieval_model: { retrieval_model: {
...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 : [], index_chunk_variable_selector: chunkStructure === chunk_structure ? index_chunk_variable_selector : [],
}) })
@ -62,7 +62,7 @@ export const useConfig = (id: string) => {
draft.indexing_technique = indexMethod draft.indexing_technique = indexMethod
if (indexMethod === IndexMethodEnum.ECONOMICAL) if (indexMethod === IndexMethodEnum.ECONOMICAL)
draft.retrieval_model.search_method = RetrievalSearchMethodEnum.invertedIndex draft.retrieval_model.search_method = RetrievalSearchMethodEnum.keywordSearch
else if (indexMethod === IndexMethodEnum.QUALIFIED) else if (indexMethod === IndexMethodEnum.QUALIFIED)
draft.retrieval_model.search_method = RetrievalSearchMethodEnum.semantic draft.retrieval_model.search_method = RetrievalSearchMethodEnum.semantic
})) }))

View File

@ -13,6 +13,6 @@ export const useSettingsDisplay = () => {
[RetrievalSearchMethodEnum.semantic]: t('dataset.retrieval.semantic_search.title'), [RetrievalSearchMethodEnum.semantic]: t('dataset.retrieval.semantic_search.title'),
[RetrievalSearchMethodEnum.fullText]: t('dataset.retrieval.full_text_search.title'), [RetrievalSearchMethodEnum.fullText]: t('dataset.retrieval.full_text_search.title'),
[RetrievalSearchMethodEnum.hybrid]: t('dataset.retrieval.hybrid_search.title'), [RetrievalSearchMethodEnum.hybrid]: t('dataset.retrieval.hybrid_search.title'),
[RetrievalSearchMethodEnum.invertedIndex]: t('dataset.retrieval.invertedIndex.title'), [RetrievalSearchMethodEnum.keywordSearch]: t('dataset.retrieval.invertedIndex.title'),
} }
} }