dify/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx
Stephen Zhou 6d0e36479b
refactor(i18n): use JSON with flattened key and namespace (#30114)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-29 14:52:32 +08:00

48 lines
1.4 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 { VectorSearch } from '@/app/components/base/icons/src/vender/knowledge'
import { RETRIEVE_METHOD } from '@/types/app'
import { EffectColor } from '../../settings/chunk-structure/types'
import OptionCard from '../../settings/option-card'
import RetrievalParamConfig from '../retrieval-param-config'
type Props = {
disabled?: boolean
value: RetrievalConfig
onChange: (value: RetrievalConfig) => void
}
const EconomicalRetrievalMethodConfig: FC<Props> = ({
disabled = false,
value,
onChange,
}) => {
const { t } = useTranslation()
return (
<OptionCard
id={RETRIEVE_METHOD.keywordSearch}
disabled={disabled}
icon={<VectorSearch className="size-4" />}
iconActiveColor="text-util-colors-purple-purple-600"
title={t('retrieval.keyword_search.title', { ns: 'dataset' })}
description={t('retrieval.keyword_search.description', { ns: 'dataset' })}
isActive
effectColor={EffectColor.purple}
showEffectColor
showChildren
className="gap-x-2"
>
<RetrievalParamConfig
type={RETRIEVE_METHOD.keywordSearch}
value={value}
onChange={onChange}
/>
</OptionCard>
)
}
export default React.memo(EconomicalRetrievalMethodConfig)