forked from infiniflow/ragflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add rerank models to the project infiniflow#724 infiniflow#162
- Loading branch information
Showing
12 changed files
with
123 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters