|
@@ -3,6 +3,9 @@ import Pagination, { type Props as PaginationProps } from '@/app/components/base
|
|
|
import type { FC } from 'react'
|
|
|
import Button from '@/app/components/base/button'
|
|
|
import cn from '@/utils/classnames'
|
|
|
+import { useTranslation } from 'react-i18next'
|
|
|
+import useTimestamp from '@/hooks/use-timestamp'
|
|
|
+import { downloadLogFile } from '@/service/common'
|
|
|
|
|
|
type PageListProps = {
|
|
|
list: []
|
|
@@ -15,12 +18,27 @@ const LogPageList: FC<PageListProps> = ({
|
|
|
pagination,
|
|
|
onUpdate,
|
|
|
}) => {
|
|
|
+ const { t } = useTranslation()
|
|
|
+ const { formatTime } = useTimestamp()
|
|
|
+ const statusMap = new Map([
|
|
|
+ ['CREATED', '创建'],
|
|
|
+ ['TRAINING', '训练中'],
|
|
|
+ ['COMPLETED', '完成'],
|
|
|
+ ])
|
|
|
+ const handleDownload = async (item: any) => {
|
|
|
+ await downloadLogFile({
|
|
|
+ url: `/intentions/train_tasks/download/${item.id}`,
|
|
|
+ fileName: item.name,
|
|
|
+ })
|
|
|
+ }
|
|
|
return (
|
|
|
<div className='relative flex h-full w-full flex-col'>
|
|
|
<div className='relative grow overflow-x-auto'>
|
|
|
<table className={'mt-3 w-full min-w-[700px] max-w-full border-collapse border-0 text-sm'}>
|
|
|
<thead className="h-8 border-b border-divider-subtle text-xs font-medium uppercase leading-8 text-text-tertiary">
|
|
|
<tr>
|
|
|
+ <td>训练任务</td>
|
|
|
+ <td>训练状态</td>
|
|
|
<td>训练语料数据集版本</td>
|
|
|
<td>训练时间</td>
|
|
|
<td>训练模型结果版本</td>
|
|
@@ -33,11 +51,16 @@ const LogPageList: FC<PageListProps> = ({
|
|
|
key={item.id}
|
|
|
className={'h-8 border-b border-divider-subtle hover:bg-background-default-hover'}
|
|
|
>
|
|
|
- <td>{item.version}</td>
|
|
|
- <td>{item.time}</td>
|
|
|
- <td>{item.version}</td>
|
|
|
+ <td>{item.name}</td>
|
|
|
+ <td>{statusMap.get(item.status)}</td>
|
|
|
+ <td>{item.dataset_info.version}</td>
|
|
|
+ <td>{formatTime(item.created_at, t('datasetHitTesting.dateTimeFormat') as string)}</td>
|
|
|
+ <td>{item.model_info.version}</td>
|
|
|
<td className="flex justify-center gap-2">
|
|
|
- <Button variant='ghost-accent' size='small' className={cn('shrink-0')}>
|
|
|
+ <Button variant='ghost-accent' size='small' className={cn('shrink-0')} onClick={(e) => {
|
|
|
+ e.stopPropagation()
|
|
|
+ handleDownload(item)
|
|
|
+ }}>
|
|
|
下载
|
|
|
</Button>
|
|
|
</td>
|