mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-10 07:19:02 +08:00
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.
This commit is contained in:
parent
54fca3d1a3
commit
ea3b8a4d64
@ -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<ModelListProps> = ({ providerId }) => {
|
||||
<HStack alignItems="center" justifyContent="space-between" style={{ width: '100%' }}>
|
||||
<HStack alignItems="center" gap={8}>
|
||||
<SettingSubtitle style={{ marginTop: 0 }}>{t('common.models')}</SettingSubtitle>
|
||||
{!isEmpty(models) && <CollapsibleSearchBar onSearch={setSearchText} />}
|
||||
<CollapsibleSearchBar onSearch={setSearchText} />
|
||||
</HStack>
|
||||
<HStack>
|
||||
<Tooltip title={t('button.manage')} mouseLeaveDelay={0}>
|
||||
<Button type="text" onClick={onManageModel} icon={<ListCheck size={16} />} disabled={isHealthChecking} />
|
||||
</Tooltip>
|
||||
<Tooltip title={t('button.add')} mouseLeaveDelay={0}>
|
||||
<Button type="text" onClick={onAddModel} icon={<Plus size={16} />} disabled={isHealthChecking} />
|
||||
</Tooltip>
|
||||
<Tooltip title={t('settings.models.check.button_caption')} mouseLeaveDelay={0}>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={runHealthCheck}
|
||||
icon={<StreamlineGoodHealthAndWellBeing size={16} isActive={isHealthChecking} />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</HStack>
|
||||
{!isEmpty(models) && (
|
||||
<HStack>
|
||||
<Tooltip title={t('button.manage')} mouseLeaveDelay={0}>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={onManageModel}
|
||||
icon={<ListCheck size={16} />}
|
||||
disabled={isHealthChecking}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip title={t('button.add')} mouseLeaveDelay={0}>
|
||||
<Button type="text" onClick={onAddModel} icon={<Plus size={16} />} disabled={isHealthChecking} />
|
||||
</Tooltip>
|
||||
<Tooltip title={t('settings.models.check.button_caption')} mouseLeaveDelay={0}>
|
||||
<Button
|
||||
type="text"
|
||||
onClick={runHealthCheck}
|
||||
icon={<StreamlineGoodHealthAndWellBeing size={16} isActive={isHealthChecking} />}
|
||||
/>
|
||||
</Tooltip>
|
||||
</HStack>
|
||||
)}
|
||||
</HStack>
|
||||
</SettingSubtitle>
|
||||
<Flex gap={12} vertical>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user