Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: add xinference rerank model (#1619)

zxhlyhbb98f5756a06
diff --git a/web/app/components/app/chat/more-info/index.tsx b/web/app/components/app/chat/more-info/index.tsx
index 83cc5be7c8c..ff4f99e517c 100644
--- a/web/app/components/app/chat/more-info/index.tsx
+++ b/web/app/components/app/chat/more-info/index.tsx
@@ -14,10 +14,10 @@ export type IMoreInfoProps = {
const MoreInfo: FC<IMoreInfoProps> = ({ more, isQuestion, className }) => {
const { t } = useTranslation()
return (<div className={`mt-1 w-full text-xs text-gray-400 ${isQuestion ? 'mr-2 text-right ' : 'pl-2 text-left float-right'} ${className}`}>
- <span>{`${t('appLog.detail.timeConsuming')} ${more.latency}${t('appLog.detail.second')}`}</span>
- <span>{`${t('appLog.detail.tokenCost')} ${formatNumber(more.tokens)}`}</span>
- <span>· </span>
- <span>{more.time} </span>
+ <span className='mr-2'>{`${t('appLog.detail.timeConsuming')} ${more.latency}${t('appLog.detail.second')}`}</span>
+ <span className='mr-2'>{`${t('appLog.detail.tokenCost')} ${formatNumber(more.tokens)}`}</span>
+ <span className='mr-2'>·</span>
+ <span>{more.time}</span>
</div>)
}
export default React.memo(MoreInfo)
diff --git a/web/app/components/header/account-setting/model-page/configs/xinference.tsx b/web/app/components/header/account-setting/model-page/configs/xinference.tsx
index e093e76068d..d4eecf6bdf5 100644
--- a/web/app/components/header/account-setting/model-page/configs/xinference.tsx
+++ b/web/app/components/header/account-setting/model-page/configs/xinference.tsx
@@ -80,6 +80,13 @@ const config: ProviderConfig = {
'zh-Hans': 'Embeddings',
},
},
+ {
+ key: 'reranking',
+ label: {
+ 'en': 'Rerank',
+ 'zh-Hans': 'Rerank',
+ },
+ },
],
},
{
diff --git a/web/app/components/header/account-setting/model-page/model-modal/Form.tsx b/web/app/components/header/account-setting/model-page/model-modal/Form.tsx
index af6110b3299..c1bcb6286c6 100644
--- a/web/app/components/header/account-setting/model-page/model-modal/Form.tsx
+++ b/web/app/components/header/account-setting/model-page/model-modal/Form.tsx
@@ -150,10 +150,11 @@ const Form: FC<FormProps> = ({
if (field.type === 'radio') {
const options = typeof field.options === 'function' ? field.options(value) : field.options
+
return (
<div key={field.key} className='py-3'>
<div className={nameClassName}>{field.label[locale]}</div>
- <div className='grid grid-cols-2 gap-3'>
+ <div className={`grid grid-cols-${options?.length} gap-3`}>
{
options?.map(option => (
<div