import type { FC } from 'react' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import TopKItem from '@/app/components/base/param-item/top-k-item' import ScoreThresholdItem from '@/app/components/base/param-item/score-threshold-item' type RetrievalSettingsProps = { topK: number scoreThreshold: number onChange: (data: { top_k?: number; score_threshold?: number }) => void } const RetrievalSettings: FC = ({ topK, scoreThreshold, onChange }) => { const [scoreThresholdEnabled, setScoreThresholdEnabled] = useState(false) const { t } = useTranslation() return (
onChange({ top_k: v })} enable={true} />
onChange({ score_threshold: v })} enable={scoreThresholdEnabled} hasSwitch={true} onSwitchChange={(_key, v) => setScoreThresholdEnabled(v)} />
) } export default RetrievalSettings