'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import type { RetrievalConfig } from '@/types/app' import { RETRIEVE_METHOD } from '@/types/app' import RadioCard from '@/app/components/base/radio-card' import { HighPriority } from '@/app/components/base/icons/src/vender/solid/arrows' import { PatternRecognition, Semantic } from '@/app/components/base/icons/src/vender/solid/development' import { FileSearch02 } from '@/app/components/base/icons/src/vender/solid/files' type Props = { value: RetrievalConfig } export const getIcon = (type: RETRIEVE_METHOD) => { return ({ [RETRIEVE_METHOD.semantic]: Semantic, [RETRIEVE_METHOD.fullText]: FileSearch02, [RETRIEVE_METHOD.hybrid]: PatternRecognition, [RETRIEVE_METHOD.invertedIndex]: HighPriority, })[type] || FileSearch02 } const EconomicalRetrievalMethodConfig: FC = ({ // type, value, }) => { const { t } = useTranslation() const type = value.search_method const Icon = getIcon(type) return (
} title={t(`dataset.retrieval.${type}.title`)} description={t(`dataset.retrieval.${type}.description`)} noRadio chosenConfigWrapClassName='!pb-3' chosenConfig={
{value.reranking_model.reranking_model_name && (
{t('common.modelProvider.rerankModel.key')}
{value.reranking_model.reranking_model_name}
)}
{t('appDebug.datasetConfig.top_k')}
{value.top_k}
{t('appDebug.datasetConfig.score_threshold')}
{value.score_threshold}
} />
) } export default React.memo(EconomicalRetrievalMethodConfig)