fix: handle undefined in mode label render
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 9s

This commit is contained in:
wangdl 2026-06-19 12:51:24 +08:00
parent a30bfcf087
commit 14bc16ea01
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ export default function LearningData() {
{ title: 'ID', dataIndex: 'id', width: 100, ellipsis: true },
{ title: '用户', dataIndex: 'userId', width: 100, ellipsis: true, render: (_: any, r: any) => r.userName || r.userId },
{ title: '知识库', dataIndex: 'knowledgeBaseId', width: 100, ellipsis: true, render: (_: any, r: any) => r.kbName || r.knowledgeBaseId },
{ title: '模式', dataIndex: 'mode', width: 80, render: (v: string) => sessionModeLabels[v] || v || '-' },
{ title: '模式', dataIndex: 'mode', width: 80, render: (v: string) => sessionModeLabels[v] || v },
{ title: '状态', dataIndex: 'status', width: 80, render: (s: string) => <Tag color={statusColors[s] || 'default'}>{sessionStatusLabels[s] || s}</Tag> },
{ title: '时长(分)', dataIndex: 'durationSeconds', width: 80, render: (s: number) => s ? Math.round(s / 60) : '-' },
{ title: '开始时间', dataIndex: 'startedAt', width: 120, render: (d: string) => d ? new Date(d).toLocaleString() : '-' },

View File

@ -122,7 +122,7 @@ export function SessionPage() {
{ 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: 90, ellipsis: true },
{ title: '类型', dataIndex: 'targetType', key: 'targetType', width: 80, render: (v?: string) => v ? <Tag>{targetTypeLabels[v] || v}</Tag> : '-' },
{ title: '模式', dataIndex: 'mode', key: 'mode', width: 70, render: (v?: string) => sessionModeLabels[v] || v || '-' },
{ title: '模式', dataIndex: 'mode', key: 'mode', width: 70, render: (v?: string) => (v ? sessionModeLabels[v] || v : '-') },
{ title: 'KB', dataIndex: 'knowledgeBaseId', key: 'kbId', width: 80, ellipsis: true, render: (_: any, r: any) => r.kbName || r.knowledgeBaseId },
{ title: '状态', dataIndex: 'status', key: 'status', width: 90,
render: (s: string) => <Tag color={s === 'active' ? 'green' : s === 'interrupted' ? 'red' : s === 'completed' ? 'blue' : 'orange'}>{sessionStatusLabels[s] || s}</Tag> },