fix(AssistantPresetCard): update group handling to use isArray for better type safety

This commit is contained in:
kangfenmao 2025-12-11 11:57:16 +08:00
parent 03db02d5f7
commit 880673c4eb

View File

@ -7,6 +7,7 @@ import type { AssistantPreset } from '@renderer/types'
import { getLeadingEmoji } from '@renderer/utils' import { getLeadingEmoji } from '@renderer/utils'
import { Button, Dropdown } from 'antd' import { Button, Dropdown } from 'antd'
import { t } from 'i18next' import { t } from 'i18next'
import { isArray } from 'lodash'
import { ArrowDownAZ, Ellipsis, PlusIcon, SquareArrowOutUpRight } from 'lucide-react' import { ArrowDownAZ, Ellipsis, PlusIcon, SquareArrowOutUpRight } from 'lucide-react'
import { type FC, memo, useCallback, useEffect, useRef, useState } from 'react' import { type FC, memo, useCallback, useEffect, useRef, useState } from 'react'
import styled from 'styled-components' import styled from 'styled-components'
@ -142,7 +143,7 @@ const AssistantPresetCard: FC<Props> = ({ preset, onClick, activegroup, getLocal
{getLocalizedGroupName('我的')} {getLocalizedGroupName('我的')}
</CustomTag> </CustomTag>
)} )}
{!!preset.group?.length && {isArray(preset.group) &&
preset.group.map((group) => ( preset.group.map((group) => (
<CustomTag key={group} color="#A0A0A0" size={11}> <CustomTag key={group} color="#A0A0A0" size={11}>
{getLocalizedGroupName(group)} {getLocalizedGroupName(group)}