AppDefaultIcon.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import {
  2. ColorfulChat,
  3. ColorfulDB,
  4. ColorfulDashboard,
  5. ColorfulData,
  6. ColorfulDoc,
  7. ColorfulExcel,
  8. ColorfulPlugin,
  9. } from '@/components/icons';
  10. import Icon from '@ant-design/icons';
  11. import React, { useCallback } from 'react';
  12. const AppDefaultIcon: React.FC<{ scene: string; width?: number; height?: number }> = ({ width, height, scene }) => {
  13. const returnComponent = useCallback(() => {
  14. switch (scene) {
  15. case 'chat_knowledge':
  16. return ColorfulDoc;
  17. case 'chat_with_db_execute':
  18. return ColorfulData;
  19. case 'chat_excel':
  20. return ColorfulExcel;
  21. case 'chat_with_db_qa':
  22. case 'chat_dba':
  23. return ColorfulDB;
  24. case 'chat_dashboard':
  25. return ColorfulDashboard;
  26. case 'chat_agent':
  27. return ColorfulPlugin;
  28. case 'chat_normal':
  29. return ColorfulChat;
  30. default:
  31. return;
  32. }
  33. }, [scene]);
  34. return <Icon className={`w-${width || 7} h-${height || 7}`} component={returnComponent()} />;
  35. };
  36. export default AppDefaultIcon;