mirror of
https://github.com/langgenius/dify.git
synced 2026-05-15 04:00:46 -04:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: jyong <718720800@qq.com> Co-authored-by: Yansong Zhang <916125788@qq.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: hj24 <mambahj24@gmail.com> Co-authored-by: hj24 <huangjian@dify.ai> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Co-authored-by: CodingOnStar <hanxujiang@dify.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Ayush Baluni <73417844+aayushbaluni@users.noreply.github.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com> Co-authored-by: jimcody1995 <jjimcody@gmail.com> Co-authored-by: James <63717587+jamesrayammons@users.noreply.github.com> Co-authored-by: Yunlu Wen <yunlu.wen@dify.ai> Co-authored-by: Stephen Zhou <hi@hyoban.cc> Co-authored-by: Coding On Star <447357187@qq.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jerryzai <jerryzh8710@protonmail.com> Co-authored-by: NVIDIAN <speedy.hpc@hotmail.com> Co-authored-by: ai-hpc <ai-hpc@users.noreply.github.com> Co-authored-by: Asuka Minato <i@asukaminato.eu.org> Co-authored-by: Junghwan <70629228+shaun0927@users.noreply.github.com> Co-authored-by: HeYinKazune <70251095+HeYin-OS@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: Jingyi <jingyi.qi@dify.ai> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: sxxtony <166789813+sxxtony@users.noreply.github.com>
64 lines
2.3 KiB
TypeScript
64 lines
2.3 KiB
TypeScript
'use client'
|
|
import type { FC } from 'react'
|
|
import type { RetrievalConfig } from '@/types/app'
|
|
import * as React from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import RadioCard from '@/app/components/base/radio-card'
|
|
import { RETRIEVE_METHOD } from '@/types/app'
|
|
import { retrievalIcon } from '../../create/icons'
|
|
|
|
type Props = {
|
|
value: RetrievalConfig
|
|
}
|
|
|
|
export const getIcon = (type: RETRIEVE_METHOD) => {
|
|
return ({
|
|
[RETRIEVE_METHOD.semantic]: retrievalIcon.vector,
|
|
[RETRIEVE_METHOD.fullText]: retrievalIcon.fullText,
|
|
[RETRIEVE_METHOD.hybrid]: retrievalIcon.hybrid,
|
|
[RETRIEVE_METHOD.invertedIndex]: retrievalIcon.vector,
|
|
[RETRIEVE_METHOD.keywordSearch]: retrievalIcon.vector,
|
|
})[type] || retrievalIcon.vector
|
|
}
|
|
|
|
const EconomicalRetrievalMethodConfig: FC<Props> = ({
|
|
// type,
|
|
value,
|
|
}) => {
|
|
const { t } = useTranslation()
|
|
const type = value.search_method
|
|
const icon = <img className="size-3.5 text-util-colors-purple-purple-600" src={getIcon(type)} alt="" />
|
|
return (
|
|
<div className="space-y-2">
|
|
<RadioCard
|
|
icon={icon}
|
|
title={t(`retrieval.${type}.title`, { ns: 'dataset' })}
|
|
description={t(`retrieval.${type}.description`, { ns: 'dataset' })}
|
|
noRadio
|
|
chosenConfigWrapClassName="pb-3!"
|
|
chosenConfig={(
|
|
<div className="flex flex-wrap text-xs leading-[18px] font-normal">
|
|
{value.reranking_model.reranking_model_name && (
|
|
<div className="mr-8 flex space-x-1">
|
|
<div className="text-gray-500">{t('modelProvider.rerankModel.key', { ns: 'common' })}</div>
|
|
<div className="font-medium text-gray-800">{value.reranking_model.reranking_model_name}</div>
|
|
</div>
|
|
)}
|
|
|
|
<div className="mr-8 flex space-x-1">
|
|
<div className="text-gray-500">{t('datasetConfig.top_k', { ns: 'appDebug' })}</div>
|
|
<div className="font-medium text-gray-800">{value.top_k}</div>
|
|
</div>
|
|
|
|
<div className="mr-8 flex space-x-1">
|
|
<div className="text-gray-500">{t('datasetConfig.score_threshold', { ns: 'appDebug' })}</div>
|
|
<div className="font-medium text-gray-800">{value.score_threshold}</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
export default React.memo(EconomicalRetrievalMethodConfig)
|