Files
FastGPT/packages/web/components/common/Avatar/index.tsx
Archer 3ba9c21828 4.8.9 test fix (#2291)
* perf: read file icon

* perf:icon

* fix: i18n

* perf: hide pro api

* perf: upload expired time

* perf: upload file frequency limit

* perf: upload file ux

* perf: input file tip

* perf: qa custom chunk size

* feat: dataset openapi

* fix: auth dataset list

* fix: openapi doc

* perf: zero temperature change to 0.01

* perf: read file prompt

* perf: read file prompt

* perf: free plan tip

* feat: cron job usage
2024-08-08 10:07:24 +08:00

31 lines
787 B
TypeScript

import React from 'react';
import { Box, Flex, Image } from '@chakra-ui/react';
import type { ImageProps } from '@chakra-ui/react';
import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
import MyIcon from '../Icon';
import { iconPaths } from '../Icon/constants';
const Avatar = ({ w = '30px', src, ...props }: ImageProps) => {
// @ts-ignore
const isIcon = !!iconPaths[src as any];
return isIcon ? (
<Box display={'inline-flex'} {...props}>
<MyIcon name={src as any} w={w} borderRadius={props.borderRadius} />
</Box>
) : (
<Image
fallbackSrc={LOGO_ICON}
fallbackStrategy={'onError'}
objectFit={'contain'}
alt=""
w={w}
h={w}
src={src || LOGO_ICON}
{...props}
/>
);
};
export default Avatar;