mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-28 06:17:14 +00:00
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>
83 lines
2.3 KiB
TypeScript
83 lines
2.3 KiB
TypeScript
import { IModelData } from '@/types/model';
|
||
import { MODEL_ICON_MAP } from '@/utils';
|
||
import moment from 'moment';
|
||
import GptCard from '../common/gpt-card';
|
||
|
||
interface Props {
|
||
info: IModelData;
|
||
}
|
||
|
||
function ModelCard({ info }: Props) {
|
||
// const { t } = useTranslation();
|
||
// const [loading, setLoading] = useState<boolean>(false);
|
||
|
||
// TODO:unused function
|
||
// async function stopTheModel(info: IModelData) {
|
||
// if (loading) {
|
||
// return;
|
||
// }
|
||
// setLoading(true);
|
||
// const [, res] = await apiInterceptors(
|
||
// stopModel({
|
||
// host: info.host,
|
||
// port: info.port,
|
||
// model: info.model_name,
|
||
// worker_type: info.model_type,
|
||
// params: {},
|
||
// }),
|
||
// );
|
||
// setLoading(false);
|
||
// if (res === true) {
|
||
// message.success(t('stop_model_success'));
|
||
// }
|
||
// }
|
||
|
||
return (
|
||
<GptCard
|
||
className='w-96'
|
||
title={info.model_name}
|
||
tags={[
|
||
{
|
||
text: info.healthy ? 'Healthy' : 'Unhealthy',
|
||
color: info.healthy ? 'green' : 'red',
|
||
border: true,
|
||
},
|
||
info.model_type,
|
||
]}
|
||
icon={MODEL_ICON_MAP[info.model_name]?.icon || '/models/huggingface.svg'}
|
||
// operations={[
|
||
// {
|
||
// children: (
|
||
// <div>
|
||
// <PauseCircleOutlined className="mr-2" />
|
||
// <span className="text-sm">Stop Model</span>
|
||
// </div>
|
||
// ),
|
||
// onClick: () => {
|
||
// stopTheModel(info);
|
||
// },
|
||
// },
|
||
// ]}
|
||
>
|
||
<div className='flex flex-col gap-1 px-4 pb-4 text-xs'>
|
||
<div className='flex overflow-hidden'>
|
||
<p className='w-28 text-gray-500 mr-2'>Host:</p>
|
||
<p className='flex-1 text-ellipsis'>{info.host}</p>
|
||
</div>
|
||
<div className='flex overflow-hidden'>
|
||
<p className='w-28 text-gray-500 mr-2'>Manage Host:</p>
|
||
<p className='flex-1 text-ellipsis'>
|
||
{info.manager_host}:{info.manager_port}
|
||
</p>
|
||
</div>
|
||
<div className='flex overflow-hidden'>
|
||
<p className='w-28 text-gray-500 mr-2'>Last Heart Beat:</p>
|
||
<p className='flex-1 text-ellipsis'>{moment(info.last_heartbeat).format('YYYY-MM-DD')}</p>
|
||
</div>
|
||
</div>
|
||
</GptCard>
|
||
);
|
||
}
|
||
|
||
export default ModelCard;
|