From ea3b8a4d641be59741d5ddd1f8783edc8f329191 Mon Sep 17 00:00:00 2001 From: Jason Young <44939412+farion1231@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:28:27 +0800 Subject: [PATCH] fix: ensure add button is always visible for empty model providers (#8374) * fix: ensure add button is always visible for empty model providers - Move add button outside of isEmpty(models) condition to fix regression - Keep manage and health check buttons conditional (only show when models exist) - Fixes issue where users cannot add first model to custom providers - Maintains clean UI by hiding management features when no content exists Resolves the UX blocker introduced in commit 2b0c46bf where all buttons were hidden for empty providers, preventing users from adding initial models. * fix: remove isEmpty check to always show model management buttons Remove isEmpty(models) conditions for manage, search, and health check buttons to ensure all functionality is available even with empty model lists. --- .../src/components/ModelList/ModelList.tsx | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/renderer/src/components/ModelList/ModelList.tsx b/src/renderer/src/components/ModelList/ModelList.tsx index cb146d3d4c..fa629c0222 100644 --- a/src/renderer/src/components/ModelList/ModelList.tsx +++ b/src/renderer/src/components/ModelList/ModelList.tsx @@ -13,7 +13,7 @@ import { useAppDispatch } from '@renderer/store' import { setModel } from '@renderer/store/assistants' import { Model } from '@renderer/types' import { Button, Flex, Tooltip } from 'antd' -import { groupBy, isEmpty, sortBy, toPairs } from 'lodash' +import { groupBy, sortBy, toPairs } from 'lodash' import { ListCheck, Plus } from 'lucide-react' import React, { memo, startTransition, useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -110,30 +110,23 @@ const ModelList: React.FC = ({ providerId }) => { {t('common.models')} - {!isEmpty(models) && } + + + + +