diff --git a/web/app/components/header/account-setting/model-provider-page/hooks.ts b/web/app/components/header/account-setting/model-provider-page/hooks.ts index 7d1d2b6877..ab3e3e5593 100644 --- a/web/app/components/header/account-setting/model-provider-page/hooks.ts +++ b/web/app/components/header/account-setting/model-provider-page/hooks.ts @@ -264,6 +264,7 @@ export const useMarketplace = (providers: ModelProvider[], searchText: string) = query: searchText, category: PluginType.model, exclude, + type: 'plugin', }) } else { @@ -271,6 +272,7 @@ export const useMarketplace = (providers: ModelProvider[], searchText: string) = category: PluginType.model, condition: getMarketplaceListCondition(PluginType.model), exclude, + type: 'plugin', }) resetPlugins() } diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx index 0d4cae9e89..06253aed7b 100644 --- a/web/app/components/plugins/card/index.tsx +++ b/web/app/components/plugins/card/index.tsx @@ -44,7 +44,7 @@ const Card = ({ const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale const { categoriesMap } = useCategories() const { type, category, name, org, label, brief, icon, verified } = payload - const cornerMark = type !== 'plugin' ? type : categoriesMap[category]?.label + const cornerMark = type !== 'plugin' ? categoriesMap.bundle?.label : categoriesMap[category]?.label const getLocalizedText = (obj: Record | undefined) => obj?.[locale] || obj?.['en-US'] || obj?.en_US || '' diff --git a/web/app/components/plugins/marketplace/context.tsx b/web/app/components/plugins/marketplace/context.tsx index 57e3dae420..1579ab620d 100644 --- a/web/app/components/plugins/marketplace/context.tsx +++ b/web/app/components/plugins/marketplace/context.tsx @@ -30,7 +30,10 @@ import { useMarketplaceCollectionsAndPlugins, useMarketplacePlugins, } from './hooks' -import { getMarketplaceListCondition } from './utils' +import { + getMarketplaceListCondition, + getMarketplaceListFilterType, +} from './utils' import { useInstalledPluginList } from '@/service/use-plugins' export type MarketplaceContextValue = { @@ -60,7 +63,7 @@ export const MarketplaceContext = createContext({ handleSearchPluginTextChange: () => {}, filterPluginTags: [], handleFilterPluginTagsChange: () => {}, - activePluginType: PLUGIN_TYPE_SEARCH_MAP.all, + activePluginType: 'all', handleActivePluginTypeChange: () => {}, plugins: undefined, resetPlugins: () => {}, @@ -131,6 +134,7 @@ export const MarketplaceContextProvider = ({ tags: hasValidTags ? tagsFromSearchParams : [], sortBy: sortRef.current.sortBy, sortOrder: sortRef.current.sortOrder, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) history.pushState({}, '', `/${searchParams?.language ? `?language=${searchParams?.language}` : ''}`) } @@ -138,6 +142,7 @@ export const MarketplaceContextProvider = ({ if (shouldExclude && isSuccess) { queryMarketplaceCollectionsAndPlugins({ exclude, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) } } @@ -153,6 +158,7 @@ export const MarketplaceContextProvider = ({ category: activePluginTypeRef.current === PLUGIN_TYPE_SEARCH_MAP.all ? undefined : activePluginTypeRef.current, condition: getMarketplaceListCondition(activePluginTypeRef.current), exclude, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) resetPlugins() @@ -178,6 +184,7 @@ export const MarketplaceContextProvider = ({ category: activePluginTypeRef.current === PLUGIN_TYPE_SEARCH_MAP.all ? undefined : activePluginTypeRef.current, condition: getMarketplaceListCondition(activePluginTypeRef.current), exclude, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) resetPlugins() @@ -191,6 +198,7 @@ export const MarketplaceContextProvider = ({ sortBy: sortRef.current.sortBy, sortOrder: sortRef.current.sortOrder, exclude, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) }, [queryPlugins, resetPlugins, queryMarketplaceCollectionsAndPlugins, exclude]) @@ -203,6 +211,7 @@ export const MarketplaceContextProvider = ({ category: type === PLUGIN_TYPE_SEARCH_MAP.all ? undefined : type, condition: getMarketplaceListCondition(type), exclude, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) resetPlugins() @@ -216,6 +225,7 @@ export const MarketplaceContextProvider = ({ sortBy: sortRef.current.sortBy, sortOrder: sortRef.current.sortOrder, exclude, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) }, [queryPlugins, resetPlugins, queryMarketplaceCollectionsAndPlugins, exclude]) @@ -230,6 +240,7 @@ export const MarketplaceContextProvider = ({ sortBy: sortRef.current.sortBy, sortOrder: sortRef.current.sortOrder, exclude, + type: getMarketplaceListFilterType(activePluginTypeRef.current), }) }, [queryPlugins, exclude]) diff --git a/web/app/components/plugins/marketplace/hooks.ts b/web/app/components/plugins/marketplace/hooks.ts index f7527fb0f6..f58bb9bacd 100644 --- a/web/app/components/plugins/marketplace/hooks.ts +++ b/web/app/components/plugins/marketplace/hooks.ts @@ -13,8 +13,8 @@ import type { PluginsSearchParams, } from './types' import { + getFormattedPlugin, getMarketplaceCollectionsAndPlugins, - getPluginIconInMarketplace, } from './utils' import i18n from '@/i18n/i18next-config' import { @@ -64,10 +64,9 @@ export const useMarketplacePlugins = () => { }) return { - plugins: data?.data?.plugins.map(plugin => ({ - ...plugin, - icon: getPluginIconInMarketplace(plugin), - })), + plugins: data?.data?.plugins.map((plugin) => { + return getFormattedPlugin(plugin) + }), resetPlugins: reset, queryPlugins, queryPluginsWithDebounced, diff --git a/web/app/components/plugins/marketplace/list/card-wrapper.tsx b/web/app/components/plugins/marketplace/list/card-wrapper.tsx index 9899fe657e..502a920212 100644 --- a/web/app/components/plugins/marketplace/list/card-wrapper.tsx +++ b/web/app/components/plugins/marketplace/list/card-wrapper.tsx @@ -1,9 +1,9 @@ 'use client' import { RiArrowRightUpLine } from '@remixicon/react' +import { getPluginLinkInMarketplace } from '../utils' import Card from '@/app/components/plugins/card' import CardMoreInfo from '@/app/components/plugins/card/card-more-info' import type { Plugin } from '@/app/components/plugins/types' -import { MARKETPLACE_URL_PREFIX } from '@/config' import Button from '@/app/components/base/button' import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks' import InstallFromMarketplace from '@/app/components/plugins/install-plugin/install-from-marketplace' @@ -55,7 +55,7 @@ const CardWrapper = ({ > {t('plugin.detailPanel.operation.install')} - +