RobotIcon.tsx 920 B

123456789101112131415161718192021222324252627282930
  1. import { RobotOutlined } from '@ant-design/icons';
  2. import { useSearchParams } from 'next/navigation';
  3. import React, { memo } from 'react';
  4. import AppDefaultIcon from '../../common/AppDefaultIcon';
  5. import ModelIcon from './ModelIcon';
  6. const RobotIcon: React.FC<{ model: string }> = ({ model }) => {
  7. const searchParams = useSearchParams();
  8. const scene = searchParams?.get('scene') ?? '';
  9. if (scene === 'chat_agent') {
  10. return (
  11. <div className='flex items-center justify-center w-8 h-8 rounded-full bg-white dark:bg-[rgba(255,255,255,0.16)]'>
  12. <AppDefaultIcon scene={scene} />
  13. </div>
  14. );
  15. }
  16. if (!model) {
  17. return (
  18. <div className='flex items-center justify-center w-8 h-8 rounded-full bg-white dark:bg-[rgba(255,255,255,0.16)]'>
  19. <RobotOutlined />
  20. </div>
  21. );
  22. }
  23. return <ModelIcon width={32} height={32} model={model} />;
  24. };
  25. export default memo(RobotIcon);