From 7bc920846e50c9997b5a9584d194d376fa7df341 Mon Sep 17 00:00:00 2001 From: opoet Date: Tue, 24 Dec 2024 21:52:04 +0800 Subject: [PATCH] fix: fix the disabled status of service provider configuration --- .../[slug]/features/ProviderConfig.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/app/(main)/discover/(detail)/provider/[slug]/features/ProviderConfig.tsx b/src/app/(main)/discover/(detail)/provider/[slug]/features/ProviderConfig.tsx index 21df86c01343..4d71eab7b63a 100644 --- a/src/app/(main)/discover/(detail)/provider/[slug]/features/ProviderConfig.tsx +++ b/src/app/(main)/discover/(detail)/provider/[slug]/features/ProviderConfig.tsx @@ -1,16 +1,17 @@ 'use client'; import { Icon } from '@lobehub/ui'; -import { Button, Dropdown } from 'antd'; +import { Button, ButtonProps, Dropdown } from 'antd'; import { createStyles } from 'antd-style'; import { ChevronDownIcon, SquareArrowOutUpRight } from 'lucide-react'; import Link from 'next/link'; -import { memo } from 'react'; +import React, { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { FlexboxProps } from 'react-layout-kit'; import { useOpenSettings } from '@/hooks/useInterceptingRoutes'; import { SettingsTabs } from '@/store/global/initialState'; +import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; import { DiscoverProviderItem } from '@/types/discover'; const useStyles = createStyles(({ css }) => ({ @@ -30,6 +31,7 @@ const ProviderConfig = memo(({ data }) => { const { styles } = useStyles(); const { t } = useTranslation('discover'); const openSettings = useOpenSettings(SettingsTabs.LLM); + const { showLLM } = useServerConfigStore(featureFlagsSelectors); const icon = ; @@ -56,13 +58,23 @@ const ProviderConfig = memo(({ data }) => { if (!items || items?.length === 0) return ( - ); return ( { + const [leftButton, rightButton] = buttons as React.ReactElement[]; + return [{ ...leftButton, props: { ...leftButton.props, disabled: !showLLM } }, rightButton]; + }} className={styles.button} icon={} menu={{ items }}