DB-GPT/web/new-components/chat/content/RobotIcon.tsx
Dreammy23 471689ba20
feat(web): Unified frontend code style (#1923)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
Co-authored-by: 谨欣 <echo.cmy@antgroup.com>
Co-authored-by: 严志勇 <yanzhiyong@tiansuixiansheng.com>
Co-authored-by: yanzhiyong <932374019@qq.com>
2024-08-30 14:03:06 +08:00

31 lines
920 B
TypeScript

import { RobotOutlined } from '@ant-design/icons';
import { useSearchParams } from 'next/navigation';
import React, { memo } from 'react';
import AppDefaultIcon from '../../common/AppDefaultIcon';
import ModelIcon from './ModelIcon';
const RobotIcon: React.FC<{ model: string }> = ({ model }) => {
const searchParams = useSearchParams();
const scene = searchParams?.get('scene') ?? '';
if (scene === 'chat_agent') {
return (
<div className='flex items-center justify-center w-8 h-8 rounded-full bg-white dark:bg-[rgba(255,255,255,0.16)]'>
<AppDefaultIcon scene={scene} />
</div>
);
}
if (!model) {
return (
<div className='flex items-center justify-center w-8 h-8 rounded-full bg-white dark:bg-[rgba(255,255,255,0.16)]'>
<RobotOutlined />
</div>
);
}
return <ModelIcon width={32} height={32} model={model} />;
};
export default memo(RobotIcon);