diff --git a/src/pages/ImportMonitor.tsx b/src/pages/ImportMonitor.tsx index 4f6f894..85c24da 100644 --- a/src/pages/ImportMonitor.tsx +++ b/src/pages/ImportMonitor.tsx @@ -3,6 +3,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query' import { Table, Tag, Typography, Button, App, Drawer, Space } from 'antd' import { ReloadOutlined, RetweetOutlined, ImportOutlined, EyeOutlined } from '@ant-design/icons' import { api } from '@/services/http-client' +import { importStatusLabels, importStepLabels } from '@/constants/labels' import dayjs from 'dayjs' const { Title, Text } = Typography @@ -31,20 +32,14 @@ export default function ImportMonitorPage() { qc.invalidateQueries({ queryKey: ['admin-imports'] }) } - const statusLabel: Record = { - QUEUED: '排队中', PROCESSING: '处理中', COMPLETED: '已完成', FAILED: '失败', CANCELLED: '已取消', - } const statusColor: Record = { - QUEUED: 'blue', PROCESSING: 'processing', COMPLETED: 'green', FAILED: 'red', CANCELLED: 'default', - } - const stepLabel: Record = { - pending: '待处理', running: '执行中', completed: '已完成', failed: '失败', skipped: '已跳过', + QUEUED: 'blue', processing: 'processing', completed: 'green', failed: 'red', } const columns = [ { title: '名称', dataIndex: 'sourceName', width: 180, ellipsis: true }, { title: '类型', dataIndex: 'sourceType', width: 80, render: (s: string) => (s === 'file' ? '文件' : s === 'url' ? '链接' : s === 'text' ? '文本' : s) }, - { title: '状态', dataIndex: 'status', width: 90, render: (s: string) => {statusLabel[s] || s} }, + { title: '状态', dataIndex: 'status', width: 90, render: (s: string) => {importStatusLabels[s] || s} }, { title: '进度', dataIndex: 'progress', width: 70, render: (v: number) => `${v || 0}%` }, { title: '重试', dataIndex: 'retryCount', width: 60, align: 'center' as const }, { title: '步骤', dataIndex: 'step', width: 100, ellipsis: true }, @@ -63,7 +58,7 @@ export default function ImportMonitorPage() { const stepCols = [ { title: '步骤', dataIndex: 'step', width: 120 }, - { title: '状态', dataIndex: 'status', width: 80, render: (s: string) => {stepLabel[s] || s} }, + { title: '状态', dataIndex: 'status', width: 80, render: (s: string) => {importStepLabels[s] || s} }, { title: '详情', dataIndex: 'detail', ellipsis: true }, { title: '开始', dataIndex: 'startedAt', width: 130, render: (d: string) => d ? dayjs(d).format('HH:mm:ss') : '-' }, { title: '完成', dataIndex: 'completedAt', width: 130, render: (d: string) => d ? dayjs(d).format('HH:mm:ss') : '-' }, @@ -81,7 +76,7 @@ export default function ImportMonitorPage() { {detail && ( <> Job: {detail.job?.id} - 状态: {statusLabel[detail.job?.status] || detail.job?.status} + 状态: {importStatusLabels[detail.job?.status] || detail.job?.status} 进度: {detail.job?.progress || 0}% 重试: {detail.job?.retryCount}/{detail.job?.maxRetries} {detail.job?.errorMessage &&
{detail.job?.errorMessage}
} diff --git a/src/pages/learning/DataPages.tsx b/src/pages/learning/DataPages.tsx index 92aa80c..f00cd25 100644 --- a/src/pages/learning/DataPages.tsx +++ b/src/pages/learning/DataPages.tsx @@ -195,7 +195,7 @@ export function ProgressPage() { { title: '用户', dataIndex: 'userId', key: 'userId', render: (_: any, r: any) => r.userName || r.userId, width: 90, ellipsis: true }, { title: '资料', dataIndex: 'materialId', key: 'materialId', render: (_: any, r: any) => r.materialName || r.materialId, width: 110, ellipsis: true }, { title: '目标类型', dataIndex: 'readingTargetType', key: 'targetType', width: 85, render: (v?: string) => v ? {targetTypeLabels[v] || v} : '-' }, - { title: '知识库', dataIndex: 'knowledgeBaseId', key: 'kbId', width: 75, ellipsis: true, render: (v?: string) => v?.slice(0,8) || '-' }, + { title: '知识库', dataIndex: 'knowledgeBaseId', key: 'kbId', width: 75, ellipsis: true, render: (_: any, r: any) => r.kbName || r.knowledgeBaseId }, { title: 'Session', dataIndex: 'lastClientSessionId', key: 'sessionId', width: 120, ellipsis: true, render: (v?: string) => v?.slice(0,16) || '-' }, { title: '状态', dataIndex: 'status', key: 'status', width: 85, render: (s: string) => {progressStatusLabels[s] || s} }, { title: '进度', dataIndex: 'lastProgress', key: 'progress', width: 65, render: (v: number) => v != null ? `${Math.round(v * 100)}%` : '-' },