mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
fix: marketplace list
This commit is contained in:
@ -285,3 +285,25 @@ export const useMarketplace = (providers: ModelProvider[], searchText: string) =
|
||||
plugins: plugins?.filter(plugin => plugin.type !== 'bundle'),
|
||||
}
|
||||
}
|
||||
|
||||
export const useMarketplaceAllPlugins = () => {
|
||||
const {
|
||||
plugins,
|
||||
queryPlugins,
|
||||
isLoading,
|
||||
} = useMarketplacePlugins()
|
||||
|
||||
useEffect(() => {
|
||||
queryPlugins({
|
||||
query: '',
|
||||
category: PluginType.model,
|
||||
type: 'plugin',
|
||||
pageSize: 1000,
|
||||
})
|
||||
}, [queryPlugins])
|
||||
|
||||
return {
|
||||
plugins: plugins?.filter(plugin => plugin.type !== 'bundle'),
|
||||
isLoading,
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ import {
|
||||
import {
|
||||
useDefaultModel,
|
||||
useMarketplace,
|
||||
useMarketplaceAllPlugins,
|
||||
useUpdateModelList,
|
||||
useUpdateModelProviders,
|
||||
} from './hooks'
|
||||
@ -128,6 +129,10 @@ const ModelProviderPage = ({ searchText }: Props) => {
|
||||
marketplaceCollectionPluginsMap,
|
||||
isLoading: isPluginsLoading,
|
||||
} = useMarketplace(providers, searchText)
|
||||
const {
|
||||
plugins: allPlugins,
|
||||
isLoading: isAllPluginsLoading,
|
||||
} = useMarketplaceAllPlugins()
|
||||
|
||||
const cardRender = useCallback((plugin: Plugin) => {
|
||||
if (plugin.type === 'bundle')
|
||||
@ -206,12 +211,12 @@ const ModelProviderPage = ({ searchText }: Props) => {
|
||||
<div className='flex items-center mb-2 pt-2'>
|
||||
<span className='pr-1 text-text-tertiary system-sm-regular'>{t('common.modelProvider.discoverMore')}</span>
|
||||
<Link target="_blank" href={`${MARKETPLACE_URL_PREFIX}`} className='inline-flex items-center system-sm-medium text-text-accent'>
|
||||
Dify Marketplace
|
||||
{t('plugin.marketplace.difyMarketplace')}
|
||||
<RiArrowRightUpLine className='w-4 h-4' />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
{!collapse && isPluginsLoading && <Loading type='area' />}
|
||||
{!collapse && (isPluginsLoading || isAllPluginsLoading) && <Loading type='area' />}
|
||||
{
|
||||
!isPluginsLoading && (
|
||||
<List
|
||||
@ -225,6 +230,19 @@ const ModelProviderPage = ({ searchText }: Props) => {
|
||||
/>
|
||||
)
|
||||
}
|
||||
{
|
||||
!isAllPluginsLoading && (
|
||||
<List
|
||||
marketplaceCollections={[]}
|
||||
marketplaceCollectionPluginsMap={{}}
|
||||
plugins={allPlugins}
|
||||
showInstallButton
|
||||
locale={locale}
|
||||
cardContainerClassName='grid grid-cols-2 gap-2'
|
||||
cardRender={cardRender}
|
||||
/>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user