Files
DB-GPT/web/new-components/common/AppDefaultIcon.tsx
lhwan 3a32344380 feat: web update (#1860)
Co-authored-by: 夏姜 <wenfengjiang.jwf@digital-engine.com>
Co-authored-by: yhjun1026 <460342015@qq.com>
Co-authored-by: aries_ckt <916701291@qq.com>
Co-authored-by: wb-lh513319 <wb-lh513319@alibaba-inc.com>
2024-08-22 11:05:18 +08:00

32 lines
1021 B
TypeScript

import { ColorfulChat, ColorfulDB, ColorfulDashboard, ColorfulData, ColorfulDoc, ColorfulExcel, ColorfulPlugin } from '@/components/icons';
import Icon from '@ant-design/icons';
import React, { useCallback } from 'react';
const AppDefaultIcon: React.FC<{ scene: string; width?: number; height?: number }> = ({ width, height, scene }) => {
const returnComponent = useCallback(() => {
switch (scene) {
case 'chat_knowledge':
return ColorfulDoc;
case 'chat_with_db_execute':
return ColorfulData;
case 'chat_excel':
return ColorfulExcel;
case 'chat_with_db_qa':
case 'chat_dba':
return ColorfulDB;
case 'chat_dashboard':
return ColorfulDashboard;
case 'chat_agent':
return ColorfulPlugin;
case 'chat_normal':
return ColorfulChat;
default:
return;
}
}, [scene]);
return <Icon className={`w-${width || 7} h-${height || 7}`} component={returnComponent()} />;
};
export default AppDefaultIcon;