feat: 添加数据任务 mock 数据
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"type-check": "vue-tsc -b --noEmit",
|
"type-check": "vue-tsc -b --noEmit",
|
||||||
"test:data-process-wizard": "node scripts/regression-data-process-wizard.mjs",
|
"test:data-process-wizard": "node scripts/regression-data-process-wizard.mjs",
|
||||||
|
"test:dataset-task-tab": "node scripts/regression-dataset-task-tab.mjs",
|
||||||
"test:model-manage": "node scripts/regression-model-manage.mjs",
|
"test:model-manage": "node scripts/regression-model-manage.mjs",
|
||||||
"test:training-log-layout": "node scripts/regression-training-log-layout.mjs",
|
"test:training-log-layout": "node scripts/regression-training-log-layout.mjs",
|
||||||
"test:page-surface": "node scripts/regression-page-surface.mjs"
|
"test:page-surface": "node scripts/regression-page-surface.mjs"
|
||||||
|
|||||||
42
frontend/scripts/regression-dataset-task-tab.mjs
Normal file
42
frontend/scripts/regression-dataset-task-tab.mjs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import { readFile } from 'node:fs/promises'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
import path from 'node:path'
|
||||||
|
|
||||||
|
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
const typesPath = path.resolve(scriptDir, '../src/types/index.ts')
|
||||||
|
const dataPath = path.resolve(scriptDir, '../src/mock/data.ts')
|
||||||
|
const viewPath = path.resolve(scriptDir, '../src/views/dataset/DatasetListView.vue')
|
||||||
|
|
||||||
|
const [typesSource, dataSource, viewSource] = await Promise.all([
|
||||||
|
readFile(typesPath, 'utf8'),
|
||||||
|
readFile(dataPath, 'utf8'),
|
||||||
|
readFile(viewPath, 'utf8'),
|
||||||
|
])
|
||||||
|
|
||||||
|
assert.match(typesSource, /export type DatasetSource = 'upload' \| 'task'/)
|
||||||
|
assert.match(typesSource, /source\?: DatasetSource/)
|
||||||
|
|
||||||
|
assert.equal((dataSource.match(/source: 'upload'/g) || []).length, 6)
|
||||||
|
assert.equal((dataSource.match(/source: 'task'/g) || []).length, 4)
|
||||||
|
|
||||||
|
for (const name of [
|
||||||
|
'客服对话清洗集',
|
||||||
|
'通用指令构造集',
|
||||||
|
'用户反馈脱敏集',
|
||||||
|
'多轮对话增强集',
|
||||||
|
]) {
|
||||||
|
const datasetLine = dataSource.split('\n').find((line) => line.includes(`name: '${name}'`))
|
||||||
|
assert.ok(datasetLine, `缺少数据任务 Mock:${name}`)
|
||||||
|
assert.match(datasetLine, /source: 'task'/, `${name} 必须标记为数据任务来源`)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.match(viewSource, /const activeTab = ref<DatasetSource>\('upload'\)/)
|
||||||
|
assert.match(
|
||||||
|
viewSource,
|
||||||
|
/if \(activeTab\.value === 'task'\) \{\s*return dataList\.value\.filter\(\(item\) => item\.source === 'task'\)\s*\}/,
|
||||||
|
)
|
||||||
|
assert.match(viewSource, /return dataList\.value\.filter\(\(item\) => item\.source !== 'task'\)/)
|
||||||
|
assert.doesNotMatch(viewSource, /数据任务产生的数据集[\s\S]*?return \[\]/)
|
||||||
|
|
||||||
|
console.log('数据任务 Mock 数据与页签分流回归检查通过')
|
||||||
@@ -99,12 +99,16 @@ export const mockLocalModels = {
|
|||||||
|
|
||||||
// ============ 数据集 ============
|
// ============ 数据集 ============
|
||||||
export const mockDatasets: DatasetItem[] = [
|
export const mockDatasets: DatasetItem[] = [
|
||||||
{ id: 1, name: '金融问答-训练集', type: 'train', storage_type: 'local', size: '128 MB', count: 8560, description: '金融领域问答对', create_time: '2025-12-20T08:00:00Z' },
|
{ id: 1, name: '金融问答-训练集', type: 'train', storage_type: 'local', source: 'upload', size: '128 MB', count: 8560, description: '金融领域问答对', create_time: '2025-12-20T08:00:00Z' },
|
||||||
{ id: 2, name: '法律文书-训练集', type: 'train', storage_type: 'local', size: '256 MB', count: 15230, description: '法律文书数据集', create_time: '2025-12-25T10:30:00Z' },
|
{ id: 2, name: '法律文书-训练集', type: 'train', storage_type: 'local', source: 'upload', size: '256 MB', count: 15230, description: '法律文书数据集', create_time: '2025-12-25T10:30:00Z' },
|
||||||
{ id: 3, name: '客服对话-训练集', type: 'train', storage_type: 'minio', size: '512 MB', count: 24500, description: '客服对话记录', create_time: '2026-01-05T14:20:00Z' },
|
{ id: 3, name: '客服对话-训练集', type: 'train', storage_type: 'minio', source: 'upload', size: '512 MB', count: 24500, description: '客服对话记录', create_time: '2026-01-05T14:20:00Z' },
|
||||||
{ id: 4, name: '金融评测集', type: 'eval', storage_type: 'local', size: '32 MB', count: 1200, description: '金融领域评测', create_time: '2026-01-10T09:15:00Z' },
|
{ id: 4, name: '金融评测集', type: 'eval', storage_type: 'local', source: 'upload', size: '32 MB', count: 1200, description: '金融领域评测', create_time: '2026-01-10T09:15:00Z' },
|
||||||
{ id: 5, name: '通用能力评测', type: 'eval', storage_type: 'local', size: '64 MB', count: 3500, description: '通用能力评测数据集', create_time: '2026-01-12T11:30:00Z' },
|
{ id: 5, name: '通用能力评测', type: 'eval', storage_type: 'local', source: 'upload', size: '64 MB', count: 3500, description: '通用能力评测数据集', create_time: '2026-01-12T11:30:00Z' },
|
||||||
{ id: 6, name: '医疗问答-训练集', type: 'train', storage_type: 'local', size: '180 MB', count: 9800, description: '医疗问答对', create_time: '2026-02-01T15:00:00Z' },
|
{ id: 6, name: '医疗问答-训练集', type: 'train', storage_type: 'local', source: 'upload', size: '180 MB', count: 9800, description: '医疗问答对', create_time: '2026-02-01T15:00:00Z' },
|
||||||
|
{ id: 7, name: '客服对话清洗集', type: 'train', storage_type: 'minio', source: 'task', size: '96 MB', count: 18240, description: '由客服问答数据清洗任务生成', create_time: '2026-07-08T06:28:00Z' },
|
||||||
|
{ id: 8, name: '通用指令构造集', type: 'train', storage_type: 'local', source: 'task', size: '148 MB', count: 12600, description: '由指令微调数据构造任务生成', create_time: '2026-07-09T01:42:00Z' },
|
||||||
|
{ id: 9, name: '用户反馈脱敏集', type: 'test', storage_type: 'minio', source: 'task', size: '72 MB', count: 9340, description: '由敏感信息脱敏任务生成', create_time: '2026-07-09T09:18:00Z' },
|
||||||
|
{ id: 10, name: '多轮对话增强集', type: 'eval', storage_type: 'local', source: 'task', size: '41 MB', count: 2780, description: '由多轮对话拼接任务生成', create_time: '2026-07-10T02:06:00Z' },
|
||||||
]
|
]
|
||||||
|
|
||||||
// ============ 训练任务 ============
|
// ============ 训练任务 ============
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export interface ModelForm {
|
|||||||
// ============ 数据集 ============
|
// ============ 数据集 ============
|
||||||
export type DatasetType = 'train' | 'test' | 'eval' | 'val' | 'other'
|
export type DatasetType = 'train' | 'test' | 'eval' | 'val' | 'other'
|
||||||
export type DatasetStorage = 'local' | 'cloud' | 'minio'
|
export type DatasetStorage = 'local' | 'cloud' | 'minio'
|
||||||
|
export type DatasetSource = 'upload' | 'task'
|
||||||
|
|
||||||
export interface DatasetFile {
|
export interface DatasetFile {
|
||||||
id?: string
|
id?: string
|
||||||
@@ -70,6 +71,7 @@ export interface DatasetItem {
|
|||||||
name: string
|
name: string
|
||||||
type: DatasetType | string
|
type: DatasetType | string
|
||||||
storage_type: DatasetStorage | string
|
storage_type: DatasetStorage | string
|
||||||
|
source?: DatasetSource
|
||||||
size?: string | number
|
size?: string | number
|
||||||
count?: number
|
count?: number
|
||||||
description?: string
|
description?: string
|
||||||
|
|||||||
@@ -5,21 +5,20 @@ import { ElMessage } from 'element-plus'
|
|||||||
import DataTablePage from '@/components/DataTablePage.vue'
|
import DataTablePage from '@/components/DataTablePage.vue'
|
||||||
import { getDatasetList, deleteDataset, downloadDatasetUrl } from '@/api/modules/dataset'
|
import { getDatasetList, deleteDataset, downloadDatasetUrl } from '@/api/modules/dataset'
|
||||||
import { DATASET_TYPE_MAP, STORAGE_MAP } from '@/constants'
|
import { DATASET_TYPE_MAP, STORAGE_MAP } from '@/constants'
|
||||||
import type { DatasetItem } from '@/types'
|
import type { DatasetItem, DatasetSource } from '@/types'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const dataList = ref<DatasetItem[]>([])
|
const dataList = ref<DatasetItem[]>([])
|
||||||
const activeTab = ref('upload')
|
const activeTab = ref<DatasetSource>('upload')
|
||||||
|
|
||||||
const filteredDataList = computed(() => {
|
const filteredDataList = computed(() => {
|
||||||
if (activeTab.value === 'upload') {
|
if (activeTab.value === 'task') {
|
||||||
return dataList.value
|
return dataList.value.filter((item) => item.source === 'task')
|
||||||
} else {
|
|
||||||
// 假设数据任务产生的数据集可以通过某个字段区分,目前 mock 数据没有该字段,所以暂为空
|
|
||||||
return []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dataList.value.filter((item) => item.source !== 'task')
|
||||||
})
|
})
|
||||||
|
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
|
|||||||
Reference in New Issue
Block a user