You've already forked DataMate
fix: fix the Data Evaluation Detail page (#154)
* fix: the Data Evaluation Detail Page should show the model used * fix: fix the time format displayed * fix: fix the Data Evaluation Detail page
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// TypeScript
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Button, Form, Input, Select, message, Modal, Row, Col, Table, Space } from 'antd';
|
||||
import { EyeOutlined } from '@ant-design/icons';
|
||||
@@ -9,6 +8,7 @@ import { ModelI } from "@/pages/SettingsPage/ModelAccess.tsx";
|
||||
import { createEvaluationTaskUsingPost } from "@/pages/DataEvaluation/evaluation.api.ts";
|
||||
import { queryPromptTemplatesUsingGet } from "@/pages/DataEvaluation/evaluation.api.ts";
|
||||
import PreviewPromptModal from "@/pages/DataEvaluation/Create/PreviewPrompt.tsx";
|
||||
import { EVAL_METHODS, TASK_TYPES } from "@/pages/DataEvaluation/evaluation.const.tsx";
|
||||
|
||||
interface Dataset {
|
||||
id: string;
|
||||
@@ -35,15 +35,6 @@ interface CreateTaskModalProps {
|
||||
onSuccess: () => void;
|
||||
}
|
||||
|
||||
const TASK_TYPES = [
|
||||
{ label: 'QA评估', value: 'QA' },
|
||||
{ label: 'COT评估', value: 'COT' },
|
||||
];
|
||||
|
||||
const EVAL_METHODS = [
|
||||
{ label: '模型自动评估', value: 'AUTO' },
|
||||
];
|
||||
|
||||
const DEFAULT_EVAL_METHOD = 'AUTO';
|
||||
const DEFAULT_TASK_TYPE = 'QA';
|
||||
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
import { useState } from 'react';
|
||||
import { Descriptions, Empty, DescriptionsProps, Table, Button, message } from 'antd';
|
||||
import { CheckCircle, XCircle, Clock as ClockIcon } from 'lucide-react';
|
||||
import { Descriptions, Empty, DescriptionsProps, Table, Button } from 'antd';
|
||||
import { EyeOutlined } from '@ant-design/icons';
|
||||
import { EvaluationStatus } from '../../evaluation.model';
|
||||
import PreviewPromptModal from "@/pages/DataEvaluation/Create/PreviewPrompt.tsx";
|
||||
|
||||
const statusMap = {
|
||||
[EvaluationStatus.PENDING]: { color: 'blue', text: '待处理', icon: <ClockIcon className="mr-1" size={14} /> },
|
||||
[EvaluationStatus.RUNNING]: { color: 'processing', text: '进行中', icon: <ClockIcon className="mr-1" size={14} /> },
|
||||
[EvaluationStatus.COMPLETED]: { color: 'success', text: '已完成', icon: <CheckCircle className="mr-1" size={14} /> },
|
||||
[EvaluationStatus.FAILED]: { color: 'error', text: '失败', icon: <XCircle className="mr-1" size={14} /> },
|
||||
[EvaluationStatus.PAUSED]: { color: 'warning', text: '已暂停', icon: <ClockIcon className="mr-1" size={14} /> },
|
||||
};
|
||||
import { formatDateTime } from "@/utils/unit.ts";
|
||||
import { evalTaskStatusMap, getEvalMethod, getEvalType, getSource } from "@/pages/DataEvaluation/evaluation.const.tsx";
|
||||
|
||||
const Overview = ({ task }) => {
|
||||
const [previewVisible, setPreviewVisible] = useState(false);
|
||||
@@ -23,8 +15,6 @@ const Overview = ({ task }) => {
|
||||
setPreviewVisible(true);
|
||||
};
|
||||
|
||||
const statusInfo = statusMap[task.status] || { color: 'default', text: '未知状态' };
|
||||
|
||||
// 基本信息
|
||||
const items: DescriptionsProps["items"] = [
|
||||
{
|
||||
@@ -37,10 +27,30 @@ const Overview = ({ task }) => {
|
||||
label: "名称",
|
||||
children: task.name,
|
||||
},
|
||||
{
|
||||
key: "evalType",
|
||||
label: "评估类型",
|
||||
children: getEvalType(task.taskType),
|
||||
},
|
||||
{
|
||||
key: "evalMethod",
|
||||
label: "评估方式",
|
||||
children: getEvalMethod(task.evalMethod),
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
label: "状态",
|
||||
children: statusInfo.text || "未知",
|
||||
children: evalTaskStatusMap[task.status]?.label || "未知",
|
||||
},
|
||||
{
|
||||
key: "source",
|
||||
label: "评估数据",
|
||||
children: getSource(task.sourceType) + task.sourceName,
|
||||
},
|
||||
{
|
||||
key: "evalConfig.modelName",
|
||||
label: "模型",
|
||||
children: task.evalConfig?.modelName || task.evalConfig?.modelId,
|
||||
},
|
||||
{
|
||||
key: "createdBy",
|
||||
@@ -50,12 +60,12 @@ const Overview = ({ task }) => {
|
||||
{
|
||||
key: "createdAt",
|
||||
label: "创建时间",
|
||||
children: task.createdAt,
|
||||
children: formatDateTime(task.createdAt),
|
||||
},
|
||||
{
|
||||
key: "updatedAt",
|
||||
label: "更新时间",
|
||||
children: task.updatedAt,
|
||||
children: formatDateTime(task.updatedAt),
|
||||
},
|
||||
{
|
||||
key: "description",
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
import { formatDate } from "@/utils/unit";
|
||||
import { formatDateTime } from "@/utils/unit";
|
||||
import { BarChart3 } from "lucide-react";
|
||||
import { EvaluationStatus, EvaluationTask } from "@/pages/DataEvaluation/evaluation.model.ts";
|
||||
|
||||
export const TASK_TYPES = [
|
||||
{ label: 'QA评估', value: 'QA' },
|
||||
{ label: 'COT评估', value: 'COT' },
|
||||
];
|
||||
|
||||
export const EVAL_METHODS = [
|
||||
{ label: '模型自动评估', value: 'AUTO' },
|
||||
];
|
||||
|
||||
export const getEvalType = (type: string) => {
|
||||
return TASK_TYPES.find((item) => item.value === type)?.label;
|
||||
};
|
||||
|
||||
export const getEvalMethod = (type: string) => {
|
||||
return EVAL_METHODS.find((item) => item.value === type)?.label;
|
||||
};
|
||||
|
||||
export const getSource = (type: string) => {
|
||||
switch (type) {
|
||||
case "DATASET":
|
||||
return "数据集 - ";
|
||||
case "SYNTHESIS":
|
||||
return "合成任务 - ";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
|
||||
export const evalTaskStatusMap: Record<
|
||||
string,
|
||||
{
|
||||
@@ -41,8 +69,8 @@ export function mapEvaluationTask(task: Partial<EvaluationTask>): EvaluationTask
|
||||
return {
|
||||
...task,
|
||||
status: evalTaskStatusMap[task.status || EvaluationStatus.PENDING],
|
||||
createdAt: formatDate(task.createdAt),
|
||||
updatedAt: formatDate(task.updatedAt),
|
||||
createdAt: formatDateTime(task.createdAt),
|
||||
updatedAt: formatDateTime(task.updatedAt),
|
||||
description: task.description,
|
||||
icon: <BarChart3 />,
|
||||
iconColor: task.ratio_method === "DATASET" ? "bg-blue-100" : "bg-green-100",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { formatDate } from "@/utils/unit";
|
||||
import { formatDateTime } from "@/utils/unit";
|
||||
import { RatioTaskItem, RatioStatus } from "./ratio.model";
|
||||
import { BarChart3, Calendar, Database } from "lucide-react";
|
||||
import { Link } from "react-router";
|
||||
@@ -43,8 +43,8 @@ export function mapRatioTask(task: Partial<RatioTaskItem>): RatioTaskItem {
|
||||
return {
|
||||
...task,
|
||||
status: ratioTaskStatusMap[task.status || RatioStatus.PENDING],
|
||||
createdAt: formatDate(task.created_at),
|
||||
updatedAt: formatDate(task.updated_at),
|
||||
createdAt: formatDateTime(task.created_at),
|
||||
updatedAt: formatDateTime(task.updated_at),
|
||||
description: task.description,
|
||||
icon: <BarChart3 />,
|
||||
iconColor: task.ratio_method === "DATASET" ? "bg-blue-100" : "bg-green-100",
|
||||
|
||||
Reference in New Issue
Block a user