diff --git a/src/app/settings/llm/OpenAI/index.tsx b/src/app/settings/llm/OpenAI/index.tsx index adb77c5f069a..e60beb94a524 100644 --- a/src/app/settings/llm/OpenAI/index.tsx +++ b/src/app/settings/llm/OpenAI/index.tsx @@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next'; import { ModelProvider } from '@/libs/agent-runtime'; import { useGlobalStore } from '@/store/global'; -import { modelProviderSelectors } from '@/store/global/selectors'; +import { modelConfigSelectors } from '@/store/global/selectors'; import Checker from '../components/Checker'; import CustomModelSelect from '../components/CustomModelList'; @@ -31,7 +31,7 @@ const LLM = memo(() => { const { t } = useTranslation('setting'); const { styles } = useStyles(); - const [useAzure] = useGlobalStore((s) => [modelProviderSelectors.enableAzure(s)]); + const [useAzure] = useGlobalStore((s) => [modelConfigSelectors.enableAzure(s)]); return ( (({ displayName, id: id }) => { const model = useGlobalStore((s) => modelProviderSelectors.modelCardById(id)(s), isEqual); diff --git a/src/app/settings/llm/components/CustomModelList/index.tsx b/src/app/settings/llm/components/CustomModelList/index.tsx index 91af4e4c5792..60ccf1e2c6e4 100644 --- a/src/app/settings/llm/components/CustomModelList/index.tsx +++ b/src/app/settings/llm/components/CustomModelList/index.tsx @@ -3,8 +3,9 @@ import { css, cx } from 'antd-style'; import isEqual from 'fast-deep-equal'; import { memo } from 'react'; +import { filterEnabledModels } from '@/config/modelProviders'; import { useGlobalStore } from '@/store/global'; -import { modelProviderSelectors } from '@/store/global/selectors'; +import { modelConfigSelectors } from '@/store/global/selectors'; import { OptionRender } from './Option'; @@ -23,10 +24,10 @@ interface CustomModelSelectProps { const CustomModelSelect = memo(({ provider, placeholder }) => { const providerCard = useGlobalStore( - (s) => modelProviderSelectors.modelSelectList(s).find((s) => s.id === provider), + (s) => modelConfigSelectors.modelSelectList(s).find((s) => s.id === provider), isEqual, ); - const defaultEnableModel = providerCard?.chatModels.filter((v) => !v.hidden).map((m) => m.id); + const defaultEnableModel = providerCard ? filterEnabledModels(providerCard) : []; return (