From ed6c9625e8c0b3edfaae86f0e8de88fc415f5d94 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Fri, 27 Dec 2024 14:20:28 +0800 Subject: [PATCH] fix scope features --- .../plugin-detail-panel/model-selector/index.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx index a0917d93fa..ce8b70776a 100644 --- a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx @@ -55,7 +55,18 @@ const ModelParameterModal: FC = ({ const { isAPIKeySet } = useProviderContext() const [open, setOpen] = useState(false) const scopeArray = scope.split('&') - const scopeFeatures = scopeArray.slice(1) || [] + const scopeFeatures = useMemo(() => { + if (scopeArray.includes('all')) + return [] + return scopeArray.filter(item => ![ + ModelTypeEnum.textGeneration, + ModelTypeEnum.textEmbedding, + ModelTypeEnum.rerank, + ModelTypeEnum.moderation, + ModelTypeEnum.speech2text, + ModelTypeEnum.tts, + ].includes(item as ModelTypeEnum)) + }, [scopeArray]) const { data: textGenerationList } = useModelList(ModelTypeEnum.textGeneration) const { data: textEmbeddingList } = useModelList(ModelTypeEnum.textEmbedding)