From dfdc4872da11eb161ab8b0fcd69ba4c807fd3f6e Mon Sep 17 00:00:00 2001 From: CodingOnStar Date: Mon, 26 Jan 2026 17:57:23 +0800 Subject: [PATCH] feat: enhance quota panel with installed providers mapping - Added a new map for installed providers to track custom configurations. - Updated icon click handling to check for installed status instead of provider type. - Adjusted tooltip logic to reflect the installation status of providers. --- .../provider-added-card/quota-panel.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx index 9eb5aa79e0..560e76d9bb 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx @@ -61,6 +61,10 @@ const QuotaPanel: FC = ({ const providerMap = useMemo(() => new Map( providers.map(p => [p.provider, p.preferred_provider_type]), ), [providers]) + const installedProvidersMap = useMemo(() => new Map( + providers.map(p => [p.provider, p.custom_configuration]), + ), [providers]) + console.warn('installedProvidersMap', installedProvidersMap) const { formatTime } = useTimestamp() const { plugins: allPlugins, @@ -73,8 +77,8 @@ const QuotaPanel: FC = ({ const selectedPluginIdRef = useRef(null) const handleIconClick = useCallback((key: ModelProviderQuotaGetPaid) => { - const providerType = providerMap.get(key) - if (!providerType && allPlugins) { + const isInstalled = installedProvidersMap.get(key) + if (!isInstalled && allPlugins) { const pluginId = providerKeyToPluginId[key] const plugin = allPlugins.find(p => p.plugin_id === pluginId) if (plugin) { @@ -83,7 +87,7 @@ const QuotaPanel: FC = ({ showInstallFromMarketplace() } } - }, [allPlugins, providerMap, showInstallFromMarketplace]) + }, [allPlugins, installedProvidersMap, showInstallFromMarketplace]) useEffect(() => { if (isShowInstallModal && selectedPluginIdRef.current) { @@ -131,13 +135,14 @@ const QuotaPanel: FC = ({
{allProviders.filter(({ key }) => trial_models.includes(key)).map(({ key, Icon }) => { const providerType = providerMap.get(key) + const isInstalled = installedProvidersMap.get(key) const usingQuota = providerType === PreferredProviderTypeEnum.system const getTooltipKey = () => { - if (usingQuota) - return 'modelProvider.card.modelSupported' - if (providerType === PreferredProviderTypeEnum.custom) + if (!isInstalled) + return 'modelProvider.card.modelNotSupported' + if (isInstalled && providerType === PreferredProviderTypeEnum.custom) return 'modelProvider.card.modelAPI' - return 'modelProvider.card.modelNotSupported' + return 'modelProvider.card.modelSupported' } return (