mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-16 12:55:54 +08:00
Fix: Due to the reference to tailwindcss, the height attribute setting of the image is invalid, resulting in an uneven model list #5339 (#5340)
### What problem does this PR solve? Fix: Due to the reference to tailwindcss, the height attribute setting of the image is invalid, resulting in an uneven model list #5339 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
955801db2e
commit
f789463982
@ -1,4 +1,5 @@
|
|||||||
import { IconMap } from '@/constants/setting';
|
import { IconMap } from '@/constants/setting';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
import Icon, { UserOutlined } from '@ant-design/icons';
|
import Icon, { UserOutlined } from '@ant-design/icons';
|
||||||
import { IconComponentProps } from '@ant-design/icons/lib/components/Icon';
|
import { IconComponentProps } from '@ant-design/icons/lib/components/Icon';
|
||||||
import { Avatar } from 'antd';
|
import { Avatar } from 'antd';
|
||||||
@ -25,14 +26,21 @@ interface IProps extends IconComponentProps {
|
|||||||
name: string;
|
name: string;
|
||||||
width: string | number;
|
width: string | number;
|
||||||
height?: string | number;
|
height?: string | number;
|
||||||
|
imgClass?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SvgIcon = ({ name, width, height, ...restProps }: IProps) => {
|
const SvgIcon = ({ name, width, height, imgClass, ...restProps }: IProps) => {
|
||||||
const ListItem = routeList.find((item) => item.name === name);
|
const ListItem = routeList.find((item) => item.name === name);
|
||||||
return (
|
return (
|
||||||
<Icon
|
<Icon
|
||||||
component={() => (
|
component={() => (
|
||||||
<img src={ListItem?.value} alt="" width={width} height={height} />
|
<img
|
||||||
|
src={ListItem?.value}
|
||||||
|
alt=""
|
||||||
|
width={width}
|
||||||
|
height={height}
|
||||||
|
className={cn(imgClass, 'max-w-full')}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{...(restProps as any)}
|
{...(restProps as any)}
|
||||||
/>
|
/>
|
||||||
@ -44,16 +52,23 @@ export const LlmIcon = ({
|
|||||||
height = 48,
|
height = 48,
|
||||||
width = 48,
|
width = 48,
|
||||||
size = 'large',
|
size = 'large',
|
||||||
|
imgClass,
|
||||||
}: {
|
}: {
|
||||||
name: string;
|
name: string;
|
||||||
height?: number;
|
height?: number;
|
||||||
width?: number;
|
width?: number;
|
||||||
size?: AvatarSize;
|
size?: AvatarSize;
|
||||||
|
imgClass?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const icon = IconMap[name as keyof typeof IconMap];
|
const icon = IconMap[name as keyof typeof IconMap];
|
||||||
|
|
||||||
return icon ? (
|
return icon ? (
|
||||||
<SvgIcon name={`llm/${icon}`} width={width} height={height}></SvgIcon>
|
<SvgIcon
|
||||||
|
name={`llm/${icon}`}
|
||||||
|
width={width}
|
||||||
|
height={height}
|
||||||
|
imgClass={imgClass}
|
||||||
|
></SvgIcon>
|
||||||
) : (
|
) : (
|
||||||
<Avatar shape="square" size={size} icon={<UserOutlined />} />
|
<Avatar shape="square" size={size} icon={<UserOutlined />} />
|
||||||
);
|
);
|
||||||
|
@ -50,14 +50,14 @@ export const IconMap = {
|
|||||||
NVIDIA: 'nvidia',
|
NVIDIA: 'nvidia',
|
||||||
'LM-Studio': 'lm-studio',
|
'LM-Studio': 'lm-studio',
|
||||||
'OpenAI-API-Compatible': 'openai-api',
|
'OpenAI-API-Compatible': 'openai-api',
|
||||||
cohere: 'cohere',
|
Cohere: 'cohere',
|
||||||
LeptonAI: 'lepton-ai',
|
LeptonAI: 'lepton-ai',
|
||||||
TogetherAI: 'together-ai',
|
TogetherAI: 'together-ai',
|
||||||
PerfXCloud: 'perfx-cloud',
|
PerfXCloud: 'perfx-cloud',
|
||||||
Upstage: 'upstage',
|
Upstage: 'upstage',
|
||||||
'novita.ai': 'novita-ai',
|
'novita.ai': 'novita-ai',
|
||||||
SILICONFLOW: 'siliconflow',
|
SILICONFLOW: 'siliconflow',
|
||||||
'PPIO': 'ppio',
|
PPIO: 'ppio',
|
||||||
'01.AI': 'yi',
|
'01.AI': 'yi',
|
||||||
Replicate: 'replicate',
|
Replicate: 'replicate',
|
||||||
'Tencent Hunyuan': 'hunyuan',
|
'Tencent Hunyuan': 'hunyuan',
|
||||||
|
@ -330,7 +330,7 @@ const UserSettingModel = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Flex vertical gap={'middle'}>
|
<Flex vertical gap={'middle'}>
|
||||||
<LlmIcon name={item.name} />
|
<LlmIcon name={item.name} imgClass="h-12 w-auto" />
|
||||||
<Flex vertical gap={'middle'}>
|
<Flex vertical gap={'middle'}>
|
||||||
<b>
|
<b>
|
||||||
<Text ellipsis={{ tooltip: item.name }}>{item.name}</Text>
|
<Text ellipsis={{ tooltip: item.name }}>{item.name}</Text>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user