mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Vector similarity weight is displayed incorrectly #965 feat: add rerank models to the project #724 #162 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
57
web/src/components/rerank.tsx
Normal file
57
web/src/components/rerank.tsx
Normal file
@ -0,0 +1,57 @@
|
||||
import { LlmModelType } from '@/constants/knowledge';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useSelectLlmOptionsByModelType } from '@/hooks/llmHooks';
|
||||
import { Form, Select, Slider } from 'antd';
|
||||
|
||||
type FieldType = {
|
||||
rerank_id?: string;
|
||||
top_k?: number;
|
||||
};
|
||||
|
||||
export const RerankItem = () => {
|
||||
const { t } = useTranslate('knowledgeDetails');
|
||||
const allOptions = useSelectLlmOptionsByModelType();
|
||||
|
||||
return (
|
||||
<Form.Item
|
||||
label={t('rerankModel')}
|
||||
name={'rerank_id'}
|
||||
tooltip={t('rerankTip')}
|
||||
>
|
||||
<Select
|
||||
options={allOptions[LlmModelType.Rerank]}
|
||||
allowClear
|
||||
placeholder={t('rerankPlaceholder')}
|
||||
/>
|
||||
</Form.Item>
|
||||
);
|
||||
};
|
||||
|
||||
const Rerank = () => {
|
||||
const { t } = useTranslate('knowledgeDetails');
|
||||
|
||||
return (
|
||||
<>
|
||||
<RerankItem></RerankItem>
|
||||
<Form.Item noStyle dependencies={['rerank_id']}>
|
||||
{({ getFieldValue }) => {
|
||||
const rerankId = getFieldValue('rerank_id');
|
||||
return (
|
||||
rerankId && (
|
||||
<Form.Item<FieldType>
|
||||
label={t('topK')}
|
||||
name={'top_k'}
|
||||
initialValue={1024}
|
||||
tooltip={t('topKTip')}
|
||||
>
|
||||
<Slider max={2048} min={1} />
|
||||
</Form.Item>
|
||||
)
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Rerank;
|
||||
@ -26,7 +26,7 @@ const SimilaritySlider = ({ isTooltipShown = false }: IProps) => {
|
||||
<Form.Item<FieldType>
|
||||
label={t('vectorSimilarityWeight')}
|
||||
name={'vector_similarity_weight'}
|
||||
initialValue={0.3}
|
||||
initialValue={1 - 0.3}
|
||||
tooltip={isTooltipShown && t('vectorSimilarityWeightTip')}
|
||||
>
|
||||
<Slider max={1} step={0.01} />
|
||||
|
||||
Reference in New Issue
Block a user