companyIcons.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import React from 'react';
  2. // 公司图标映射(使用 public 文件夹中的静态资源)
  3. const companyIconMap: Record<string, string> = {
  4. 'DeepSeek': '/icons/DeepSeek.svg',
  5. 'Moonshot': '/icons/moonshotai_new.png',
  6. 'Moonshot AI': '/icons/moonshotai_new.png',
  7. '通义': '/icons/Tongyi.svg',
  8. 'Tongyi': '/icons/Tongyi.svg',
  9. 'Alibaba': '/icons/Tongyi.svg', // 阿里巴巴对应通义图标
  10. '智谱': '/icons/zhipu.svg',
  11. 'Zhipu': '/icons/zhipu.svg',
  12. '智谱AI': '/icons/zhipu.svg',
  13. 'THUDM': '/icons/zhipu.svg', // 清华大学对应智谱图标
  14. };
  15. // 公司图标组件
  16. interface CompanyIconProps {
  17. company: string;
  18. className?: string;
  19. }
  20. export const CompanyIcon: React.FC<CompanyIconProps> = ({ company, className = 'w-6 h-6' }) => {
  21. const iconSrc = companyIconMap[company];
  22. if (!iconSrc) {
  23. return null;
  24. }
  25. return (
  26. <img
  27. src={iconSrc}
  28. alt={company}
  29. className={className}
  30. style={{ objectFit: 'contain' }}
  31. />
  32. );
  33. };
  34. // 获取公司图标路径
  35. export const getCompanyIcon = (company: string): string | null => {
  36. return companyIconMap[company] || null;
  37. };
  38. // 导出公司图标映射
  39. export { companyIconMap };