Compare commits
9 Commits
aea0d51b44
...
cd354f52e6
| Author | SHA1 | Date | |
|---|---|---|---|
| cd354f52e6 | |||
|
|
acbd6d91b3 | ||
|
|
762d48d090 | ||
|
|
42f2efb449 | ||
|
|
8c1a0d785c | ||
|
|
66eac77c96 | ||
|
|
d8ba048c6d | ||
|
|
c9ddc3b652 | ||
|
|
0917206191 |
@@ -41,15 +41,20 @@ assert.match(viewSource, /onBeforeRouteLeave\(async \(\) =>/, '路由离开确
|
|||||||
assert.doesNotMatch(viewSource, /window\.confirm|ElMessageBox/, '创建页仍在使用系统或 Element Plus 确认框')
|
assert.doesNotMatch(viewSource, /window\.confirm|ElMessageBox/, '创建页仍在使用系统或 Element Plus 确认框')
|
||||||
|
|
||||||
assert.match(viewSource, /const WIZARD_STEPS = \[/, '向导步骤尚未改为固定常量')
|
assert.match(viewSource, /const WIZARD_STEPS = \[/, '向导步骤尚未改为固定常量')
|
||||||
for (const title of ['创建任务', '上传文件', '数据预览', '开始生成', '结果编辑与保存']) {
|
for (const title of ['创建任务', '大模型选择', '上传文件', '数据预览', '开始生成', '结果编辑与保存']) {
|
||||||
assert.ok(viewSource.includes(`title: '${title}'`), `缺少固定步骤:${title}`)
|
assert.ok(viewSource.includes(`title: '${title}'`), `缺少固定步骤:${title}`)
|
||||||
}
|
}
|
||||||
assert.match(
|
assert.match(
|
||||||
viewSource,
|
viewSource,
|
||||||
/\{ id: 'create',[\s\S]*?\{ id: 'upload',[\s\S]*?\{ id: 'preview',[\s\S]*?\{ id: 'generate',[\s\S]*?\{ id: 'results'/,
|
/\{ id: 'create',[\s\S]*?\{ id: 'model',[\s\S]*?\{ id: 'upload',[\s\S]*?\{ id: 'preview',[\s\S]*?\{ id: 'generate',[\s\S]*?\{ id: 'results'/,
|
||||||
'五步向导顺序必须为创建任务、上传文件、数据预览、开始生成、结果编辑与保存',
|
'六步向导顺序必须为创建任务、大模型选择、上传文件、数据预览、开始生成、结果编辑与保存',
|
||||||
)
|
)
|
||||||
assert.doesNotMatch(viewSource, /steps\s*=\s*computed|all\.filter/, '步骤仍根据处理类型动态增减')
|
assert.doesNotMatch(viewSource, /steps\s*=\s*computed|all\.filter/, '步骤仍根据处理类型动态增减')
|
||||||
|
assert.match(
|
||||||
|
viewStyleSource,
|
||||||
|
/@media \(max-width: 1100px\)[\s\S]*?\.step-title\s*\{[\s\S]*?display:\s*none[\s\S]*?\.step-item\.is-active \.step-title\s*\{[\s\S]*?display:\s*block/,
|
||||||
|
'六步向导在中等宽度下没有收起非当前步骤标题',
|
||||||
|
)
|
||||||
assert.match(draftSource, /localStorage\.setItem\(DATA_PROCESS_DRAFT_STORAGE_KEY/, '草稿没有持久化')
|
assert.match(draftSource, /localStorage\.setItem\(DATA_PROCESS_DRAFT_STORAGE_KEY/, '草稿没有持久化')
|
||||||
assert.match(draftSource, /localStorage\.getItem\(DATA_PROCESS_DRAFT_STORAGE_KEY\)/, '草稿没有恢复读取')
|
assert.match(draftSource, /localStorage\.getItem\(DATA_PROCESS_DRAFT_STORAGE_KEY\)/, '草稿没有恢复读取')
|
||||||
assert.match(viewSource, /restoreDraft\(\)/, '页面没有恢复草稿')
|
assert.match(viewSource, /restoreDraft\(\)/, '页面没有恢复草稿')
|
||||||
@@ -57,6 +62,7 @@ assert.ok(viewSource.split('\n').length < 800, 'DataProcessCreateView 拆分后
|
|||||||
|
|
||||||
const expectedComponents = [
|
const expectedComponents = [
|
||||||
'TaskSetupStep.vue',
|
'TaskSetupStep.vue',
|
||||||
|
'ModelSelectionStep.vue',
|
||||||
'SourceUploadStep.vue',
|
'SourceUploadStep.vue',
|
||||||
'PreviewCompareStep.vue',
|
'PreviewCompareStep.vue',
|
||||||
'GenerationStep.vue',
|
'GenerationStep.vue',
|
||||||
@@ -82,7 +88,7 @@ for (const field of ['sourceStart', 'sourceEnd', 'originalContent', 'editedConte
|
|||||||
assert.ok(typesSource.includes(field), `PreviewItem 缺少字段:${field}`)
|
assert.ok(typesSource.includes(field), `PreviewItem 缺少字段:${field}`)
|
||||||
}
|
}
|
||||||
assert.match(typesSource, /sourceFileId/, 'PreviewItem 缺少来源文件标识')
|
assert.match(typesSource, /sourceFileId/, 'PreviewItem 缺少来源文件标识')
|
||||||
assert.match(typesSource, /export type StepId = 'create' \| 'upload' \| 'preview' \| 'generate' \| 'results'/, '步骤类型缺少独立上传步骤')
|
assert.match(typesSource, /export type StepId = 'create' \| 'model' \| 'upload' \| 'preview' \| 'generate' \| 'results'/, '步骤类型缺少独立大模型选择步骤')
|
||||||
assert.match(modelSource, /export function buildPreviewItems/, '缺少切片来源映射生成函数')
|
assert.match(modelSource, /export function buildPreviewItems/, '缺少切片来源映射生成函数')
|
||||||
assert.match(modelSource, /export function sourceLines/, '缺少源文件行偏移生成函数')
|
assert.match(modelSource, /export function sourceLines/, '缺少源文件行偏移生成函数')
|
||||||
assert.match(modelSource, /sourceFileId/, '切片生成没有写入来源文件标识')
|
assert.match(modelSource, /sourceFileId/, '切片生成没有写入来源文件标识')
|
||||||
@@ -102,10 +108,10 @@ for (const marker of [
|
|||||||
'preview-editor',
|
'preview-editor',
|
||||||
'scrollIntoView',
|
'scrollIntoView',
|
||||||
]) {
|
]) {
|
||||||
assert.ok(previewSource.includes(marker), `第三步缺少结构或行为:${marker}`)
|
assert.ok(previewSource.includes(marker), `第四步缺少结构或行为:${marker}`)
|
||||||
}
|
}
|
||||||
assert.match(previewSource, /sourceStart/, '第三步未使用来源起始偏移')
|
assert.match(previewSource, /sourceStart/, '第四步未使用来源起始偏移')
|
||||||
assert.match(previewSource, /sourceEnd/, '第三步未使用来源结束偏移')
|
assert.match(previewSource, /sourceEnd/, '第四步未使用来源结束偏移')
|
||||||
assert.match(previewSource, /filterable/, '文件选择器必须可搜索')
|
assert.match(previewSource, /filterable/, '文件选择器必须可搜索')
|
||||||
assert.match(previewSource, /当前文件/, '预览缺少当前文件切换器')
|
assert.match(previewSource, /当前文件/, '预览缺少当前文件切换器')
|
||||||
assert.doesNotMatch(previewSource, /located-badge|sync-label|已定位到/, '源文件栏不应显示冗余定位提示')
|
assert.doesNotMatch(previewSource, /located-badge|sync-label|已定位到/, '源文件栏不应显示冗余定位提示')
|
||||||
@@ -130,13 +136,14 @@ assert.match(previewSource, />保存修改<\/el-button>/, '编辑器缺少保存
|
|||||||
assert.match(previewSource, /\.editor-actions\s*\{[\s\S]*?justify-content:\s*flex-end/, '取消和保存按钮必须在编辑器右侧对齐')
|
assert.match(previewSource, /\.editor-actions\s*\{[\s\S]*?justify-content:\s*flex-end/, '取消和保存按钮必须在编辑器右侧对齐')
|
||||||
assert.doesNotMatch(previewSource, /item-token|item-status|modifiedOnly|仅看已修改/, '切片列表不应再显示 Token 或修改状态')
|
assert.doesNotMatch(previewSource, /item-token|item-status|modifiedOnly|仅看已修改/, '切片列表不应再显示 Token 或修改状态')
|
||||||
assert.match(previewSource, /\.preview-editor\s*\{[\s\S]*?flex:\s*1 1 auto[\s\S]*?overflow-y:\s*auto/, '编辑模式必须占据右侧剩余区域并可滚动')
|
assert.match(previewSource, /\.preview-editor\s*\{[\s\S]*?flex:\s*1 1 auto[\s\S]*?overflow-y:\s*auto/, '编辑模式必须占据右侧剩余区域并可滚动')
|
||||||
assert.match(previewSource, /@media \(max-width: 900px\)/, '第三步缺少窄屏上下布局')
|
assert.match(previewSource, /@media \(max-width: 900px\)/, '第四步缺少窄屏上下布局')
|
||||||
|
|
||||||
const taskSetupPath = path.join(createDir, 'TaskSetupStep.vue')
|
const taskSetupPath = path.join(createDir, 'TaskSetupStep.vue')
|
||||||
const structuredOptionsPath = path.join(createDir, 'StructuredOptionsPanel.vue')
|
const structuredOptionsPath = path.join(createDir, 'StructuredOptionsPanel.vue')
|
||||||
const unstructuredOptionsPath = path.join(createDir, 'UnstructuredOptionsPanel.vue')
|
const unstructuredOptionsPath = path.join(createDir, 'UnstructuredOptionsPanel.vue')
|
||||||
const datasetSplitEditorPath = path.join(createDir, 'DatasetSplitEditor.vue')
|
const datasetSplitEditorPath = path.join(createDir, 'DatasetSplitEditor.vue')
|
||||||
const generationOptionsPath = path.join(createDir, 'GenerationOptionsPanel.vue')
|
const generationOptionsPath = path.join(createDir, 'GenerationOptionsPanel.vue')
|
||||||
|
const modelSelectionPath = path.join(createDir, 'ModelSelectionStep.vue')
|
||||||
const sourceUploadPath = path.join(createDir, 'SourceUploadStep.vue')
|
const sourceUploadPath = path.join(createDir, 'SourceUploadStep.vue')
|
||||||
const [
|
const [
|
||||||
taskSetupSource,
|
taskSetupSource,
|
||||||
@@ -144,6 +151,7 @@ const [
|
|||||||
unstructuredOptionsSource,
|
unstructuredOptionsSource,
|
||||||
datasetSplitEditorSource,
|
datasetSplitEditorSource,
|
||||||
generationControlSource,
|
generationControlSource,
|
||||||
|
modelSelectionSource,
|
||||||
sourceUploadSource,
|
sourceUploadSource,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
readFile(taskSetupPath, 'utf8'),
|
readFile(taskSetupPath, 'utf8'),
|
||||||
@@ -151,6 +159,7 @@ const [
|
|||||||
readFile(unstructuredOptionsPath, 'utf8'),
|
readFile(unstructuredOptionsPath, 'utf8'),
|
||||||
readFile(datasetSplitEditorPath, 'utf8'),
|
readFile(datasetSplitEditorPath, 'utf8'),
|
||||||
readFile(generationOptionsPath, 'utf8'),
|
readFile(generationOptionsPath, 'utf8'),
|
||||||
|
readFile(modelSelectionPath, 'utf8'),
|
||||||
readFile(sourceUploadPath, 'utf8'),
|
readFile(sourceUploadPath, 'utf8'),
|
||||||
])
|
])
|
||||||
const taskSetupFeatureSource = [
|
const taskSetupFeatureSource = [
|
||||||
@@ -172,20 +181,29 @@ assert.match(unstructuredOptionsSource, /<DatasetSplitEditor/, '非结构化选
|
|||||||
for (const marker of ['<el-upload', '源数据上传', '数据源配置', 'uploadedFiles']) {
|
for (const marker of ['<el-upload', '源数据上传', '数据源配置', 'uploadedFiles']) {
|
||||||
assert.ok(!taskSetupFeatureSource.includes(marker), `第一步仍包含上传职责:${marker}`)
|
assert.ok(!taskSetupFeatureSource.includes(marker), `第一步仍包含上传职责:${marker}`)
|
||||||
}
|
}
|
||||||
assert.match(viewSource, /<SourceUploadStep\s+[\s\S]*?v-else-if="currentStepId === 'upload'"/, '第二步没有挂载独立上传组件')
|
assert.match(viewSource, /<ModelSelectionStep\s+[\s\S]*?v-else-if="currentStepId === 'model'"/, '第二步没有挂载独立大模型选择组件')
|
||||||
assert.match(viewSource, /if \(currentStepId\.value === 'create'\) return '继续:上传文件'/, '第一步主按钮没有指向上传文件')
|
assert.match(viewSource, /<SourceUploadStep\s+[\s\S]*?v-else-if="currentStepId === 'upload'"/, '第三步没有挂载独立上传组件')
|
||||||
assert.match(viewSource, /if \(currentStepId\.value === 'upload'\) return '继续:数据预览'/, '第二步主按钮没有指向数据预览')
|
assert.match(viewSource, /if \(currentStepId\.value === 'create'\) return '继续:选择大模型'/, '第一步主按钮没有指向大模型选择')
|
||||||
|
assert.match(viewSource, /if \(currentStepId\.value === 'model'\) return '继续:上传文件'/, '第二步主按钮没有指向上传文件')
|
||||||
|
assert.match(viewSource, /if \(currentStepId\.value === 'upload'\) return '继续:数据预览'/, '第三步主按钮没有指向数据预览')
|
||||||
assert.match(draftSource, /DATA_PROCESS_DRAFT_SCHEMA_VERSION = 6/, '安全草稿格式必须升级到 v6')
|
assert.match(draftSource, /DATA_PROCESS_DRAFT_SCHEMA_VERSION = 6/, '安全草稿格式必须升级到 v6')
|
||||||
|
|
||||||
const nextFromCreateStart = viewSource.indexOf('async function nextFromCreate()')
|
const nextFromCreateStart = viewSource.indexOf('async function nextFromCreate()')
|
||||||
const nextFromUploadStart = viewSource.indexOf('function nextFromUpload()', nextFromCreateStart)
|
const nextFromModelStart = viewSource.indexOf('async function nextFromModel()', nextFromCreateStart)
|
||||||
|
const nextFromUploadStart = viewSource.indexOf('function nextFromUpload()', nextFromModelStart)
|
||||||
const selectPreviewFileStart = viewSource.indexOf('function selectPreviewFile(', nextFromUploadStart)
|
const selectPreviewFileStart = viewSource.indexOf('function selectPreviewFile(', nextFromUploadStart)
|
||||||
assert.ok(nextFromCreateStart >= 0 && nextFromUploadStart > nextFromCreateStart, '缺少创建步骤与上传步骤的独立跳转函数')
|
assert.ok(
|
||||||
const nextFromCreateSource = viewSource.slice(nextFromCreateStart, nextFromUploadStart)
|
nextFromCreateStart >= 0 && nextFromModelStart > nextFromCreateStart && nextFromUploadStart > nextFromModelStart,
|
||||||
|
'缺少创建、大模型选择与上传步骤的独立跳转函数',
|
||||||
|
)
|
||||||
|
const nextFromCreateSource = viewSource.slice(nextFromCreateStart, nextFromModelStart)
|
||||||
|
const nextFromModelSource = viewSource.slice(nextFromModelStart, nextFromUploadStart)
|
||||||
const nextFromUploadSource = viewSource.slice(nextFromUploadStart, selectPreviewFileStart)
|
const nextFromUploadSource = viewSource.slice(nextFromUploadStart, selectPreviewFileStart)
|
||||||
assert.match(nextFromCreateSource, /taskSetupRef\.value\?\.validate\(\)/, '创建步骤继续前没有校验任务配置')
|
assert.match(nextFromCreateSource, /taskSetupRef\.value\?\.validate\(\)/, '创建步骤继续前没有校验任务配置')
|
||||||
assert.match(nextFromCreateSource, /goToStep\('upload'\)/, '创建步骤校验通过后没有进入上传文件')
|
assert.match(nextFromCreateSource, /goToStep\('model'\)/, '创建步骤校验通过后没有进入大模型选择')
|
||||||
assert.doesNotMatch(nextFromCreateSource, /uploadedFiles|buildPreviewItems/, '创建步骤仍在校验文件或提前生成预览')
|
assert.doesNotMatch(nextFromCreateSource, /uploadedFiles|buildPreviewItems/, '创建步骤仍在校验文件或提前生成预览')
|
||||||
|
assert.match(nextFromModelSource, /modelSelectionRef\.value\?\.validate\(\)/, '大模型选择步骤继续前没有校验模型配置')
|
||||||
|
assert.match(nextFromModelSource, /goToStep\('upload'\)/, '大模型选择完成后没有进入上传文件')
|
||||||
assert.match(nextFromUploadSource, /uploadedFiles\.value\.length === 0/, '上传步骤继续前没有校验源数据')
|
assert.match(nextFromUploadSource, /uploadedFiles\.value\.length === 0/, '上传步骤继续前没有校验源数据')
|
||||||
assert.match(nextFromUploadSource, /buildPreviewItems\(/, '上传步骤没有在进入预览前生成预览数据')
|
assert.match(nextFromUploadSource, /buildPreviewItems\(/, '上传步骤没有在进入预览前生成预览数据')
|
||||||
assert.match(nextFromUploadSource, /goToStep\('preview'\)/, '上传步骤完成后没有进入数据预览')
|
assert.match(nextFromUploadSource, /goToStep\('preview'\)/, '上传步骤完成后没有进入数据预览')
|
||||||
@@ -217,8 +235,6 @@ for (const option of [
|
|||||||
assert.ok(structuredOptionsSource.includes(option), `结构化预处理缺少选项:${option}`)
|
assert.ok(structuredOptionsSource.includes(option), `结构化预处理缺少选项:${option}`)
|
||||||
}
|
}
|
||||||
assert.ok(structuredOptionsSource.includes('生成选项'), '结构化配置缺少生成选项分类')
|
assert.ok(structuredOptionsSource.includes('生成选项'), '结构化配置缺少生成选项分类')
|
||||||
assert.ok(structuredOptionsSource.includes('语义丰富表达'), '生成选项缺少语义丰富表达开关')
|
|
||||||
assert.ok(structuredOptionsSource.includes('使用大模型将问答表述得更自然、柔和'), '语义丰富表达缺少辅助说明')
|
|
||||||
for (const splitName of ['训练集', '验证集', '测试集']) {
|
for (const splitName of ['训练集', '验证集', '测试集']) {
|
||||||
assert.ok(datasetSplitEditorSource.includes(splitName), `生成选项缺少数据集划分:${splitName}`)
|
assert.ok(datasetSplitEditorSource.includes(splitName), `生成选项缺少数据集划分:${splitName}`)
|
||||||
}
|
}
|
||||||
@@ -232,7 +248,6 @@ for (const splitField of ['train', 'validation', 'test']) {
|
|||||||
`数据集划分字段 ${splitField} 缺少 0~100 的整数限制`,
|
`数据集划分字段 ${splitField} 缺少 0~100 的整数限制`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
assert.match(structuredOptionsSource, /<el-switch[\s\S]*options\.semanticEnrichment/, '语义丰富表达必须使用开关控件')
|
|
||||||
assert.match(structuredOptionsSource, /<el-input-number[\s\S]*options\.qaPairsPerRow[\s\S]*:min="1"[\s\S]*:max="5"/, '每行生成数量必须限制在 1 到 5')
|
assert.match(structuredOptionsSource, /<el-input-number[\s\S]*options\.qaPairsPerRow[\s\S]*:min="1"[\s\S]*:max="5"/, '每行生成数量必须限制在 1 到 5')
|
||||||
assert.match(viewSource, /const structuredOptions = ref<StructuredProcessOptions>/, '父页面缺少结构化配置状态')
|
assert.match(viewSource, /const structuredOptions = ref<StructuredProcessOptions>/, '父页面缺少结构化配置状态')
|
||||||
assert.match(stateSource, /datasetSplit:\s*\{ train: 80, validation: 10, test: 10 \}/, '数据集划分默认值必须为 80/10/10')
|
assert.match(stateSource, /datasetSplit:\s*\{ train: 80, validation: 10, test: 10 \}/, '数据集划分默认值必须为 80/10/10')
|
||||||
@@ -252,12 +267,16 @@ for (const field of [
|
|||||||
assert.ok(typesSource.includes(field), `生成控制配置缺少字段:${field}`)
|
assert.ok(typesSource.includes(field), `生成控制配置缺少字段:${field}`)
|
||||||
assert.ok(implementationSource.includes(field), `父页面默认值或草稿状态缺少字段:${field}`)
|
assert.ok(implementationSource.includes(field), `父页面默认值或草稿状态缺少字段:${field}`)
|
||||||
}
|
}
|
||||||
assert.match(structuredOptionsSource, /GenerationOptionsPanel/, '结构化生成选项没有复用统一的大模型与质量筛选组件')
|
assert.match(structuredOptionsSource, /GenerationOptionsPanel/, '结构化生成选项没有复用统一的质量筛选组件')
|
||||||
assert.match(unstructuredOptionsSource, /GenerationOptionsPanel/, '非结构化生成选项没有复用统一的大模型与质量筛选组件')
|
assert.match(unstructuredOptionsSource, /GenerationOptionsPanel/, '非结构化生成选项没有复用统一的质量筛选组件')
|
||||||
assert.match(structuredOptionsSource, /:options="options"/, '结构化生成选项未接入统一配置组件')
|
assert.match(structuredOptionsSource, /:options="options"/, '结构化生成选项未接入统一配置组件')
|
||||||
assert.match(unstructuredOptionsSource, /:options="options"/, '非结构化生成选项未接入统一配置组件')
|
assert.match(unstructuredOptionsSource, /:options="options"/, '非结构化生成选项未接入统一配置组件')
|
||||||
assert.match(taskSetupFeatureSource, /<h3>大模型<\/h3>/, '大模型必须作为与生成选项平级的独立分类')
|
assert.doesNotMatch(taskSetupFeatureSource, /<h3>大模型<\/h3>|section="model"/, '第一步不应继续承载大模型配置')
|
||||||
assert.match(taskSetupFeatureSource, /section="model"/, '独立大模型分类没有挂载模型配置')
|
assert.match(modelSelectionSource, /<h3[^>]*>大模型选择<\/h3>/, '独立步骤缺少大模型选择标题')
|
||||||
|
assert.match(modelSelectionSource, /section="model"/, '独立步骤没有挂载模型配置')
|
||||||
|
assert.match(modelSelectionSource, /defineExpose\(\{ validate \}\)/, '独立大模型选择步骤没有暴露继续前校验')
|
||||||
|
assert.match(modelSelectionSource, /class="form-section"/, '大模型选择步骤没有沿用第一步的通栏表单分区')
|
||||||
|
assert.doesNotMatch(modelSelectionSource, /max-width:\s*980px/, '大模型选择步骤不应使用比第一步更窄的固定内容宽度')
|
||||||
assert.match(taskSetupFeatureSource, /section="quality"/, '质量筛选没有保留在生成选项分类中')
|
assert.match(taskSetupFeatureSource, /section="quality"/, '质量筛选没有保留在生成选项分类中')
|
||||||
assert.doesNotMatch(generationControlSource, /<h4>大模型<\/h4>/, '大模型不应继续作为生成选项内部子分类')
|
assert.doesNotMatch(generationControlSource, /<h4>大模型<\/h4>/, '大模型不应继续作为生成选项内部子分类')
|
||||||
for (const label of ['大模型', '数据生成模型', '默认提示语', '质量筛选', '过滤低质量内容', '过滤过短内容', '最少字数']) {
|
for (const label of ['大模型', '数据生成模型', '默认提示语', '质量筛选', '过滤低质量内容', '过滤过短内容', '最少字数']) {
|
||||||
@@ -267,15 +286,21 @@ assert.match(generationControlSource, /filterable/, '数据生成模型下拉必
|
|||||||
assert.match(generationControlSource, /maxlength="500"/, '默认提示语缺少合理的长度限制')
|
assert.match(generationControlSource, /maxlength="500"/, '默认提示语缺少合理的长度限制')
|
||||||
assert.match(generationControlSource, /\.model-field\s*\{[\s\S]*?display:\s*flex[\s\S]*?flex-direction:\s*column/, '大模型字段没有使用稳定的纵向表单布局')
|
assert.match(generationControlSource, /\.model-field\s*\{[\s\S]*?display:\s*flex[\s\S]*?flex-direction:\s*column/, '大模型字段没有使用稳定的纵向表单布局')
|
||||||
assert.match(generationControlSource, /\.generation-config-group\s*\{[\s\S]*?border:\s*1px solid #e2e5ec/, '大模型配置没有保留统一配置面板边框')
|
assert.match(generationControlSource, /\.generation-config-group\s*\{[\s\S]*?border:\s*1px solid #e2e5ec/, '大模型配置没有保留统一配置面板边框')
|
||||||
|
assert.match(generationControlSource, /\.model-config-group\s*\{[\s\S]*?padding:\s*0[\s\S]*?border:\s*0/, '独立大模型步骤仍存在嵌套卡片挤压')
|
||||||
|
assert.match(
|
||||||
|
generationControlSource,
|
||||||
|
/\.model-config-group \.advanced-settings-grid\s*\{[\s\S]*?grid-template-columns:\s*1fr/,
|
||||||
|
'大模型高级参数没有改为与第一步一致的纵向布局',
|
||||||
|
)
|
||||||
assert.match(stateSource, /const DEFAULT_GENERATION_PROMPT\s*=\s*['"][^'"]{40,}['"]/, '大模型配置缺少可直接使用的默认提示语')
|
assert.match(stateSource, /const DEFAULT_GENERATION_PROMPT\s*=\s*['"][^'"]{40,}['"]/, '大模型配置缺少可直接使用的默认提示语')
|
||||||
assert.equal((stateSource.match(/generationPrompt:\s*DEFAULT_GENERATION_PROMPT/g) || []).length, 2, '结构化与非结构化任务必须共用默认提示语')
|
assert.equal((stateSource.match(/generationPrompt:\s*DEFAULT_GENERATION_PROMPT/g) || []).length, 2, '结构化与非结构化任务必须共用默认提示语')
|
||||||
assert.match(generationControlSource, /v-if="options\.qualityFilterEnabled"/, '质量规则没有随总开关渐进显示')
|
assert.match(generationControlSource, /v-if="options\.qualityFilterEnabled"/, '质量规则没有随总开关渐进显示')
|
||||||
assert.match(generationControlSource, /v-if="options\.filterShortContent"/, '最少字数没有随短内容规则显示')
|
assert.match(generationControlSource, /v-if="options\.filterShortContent"/, '最少字数没有随短内容规则显示')
|
||||||
assert.match(generationControlSource, /:min="1"[\s\S]*:max="1000"/, '最少字数缺少 1 到 1000 的边界限制')
|
assert.match(generationControlSource, /:min="1"[\s\S]*:max="1000"/, '最少字数缺少 1 到 1000 的边界限制')
|
||||||
assert.match(taskSetupSource, /generationValidationMessage/, '生成模型与质量规则缺少继续前校验')
|
assert.match(taskSetupSource, /qualityValidationMessage/, '质量规则缺少继续前校验')
|
||||||
assert.match(viewSource, /useModelsStore/, '创建页没有加载模型列表')
|
assert.match(viewSource, /useModelsStore/, '创建页没有加载模型列表')
|
||||||
assert.match(viewSource, /model\.type === 'LLM'/, '数据生成模型列表没有排除非大模型')
|
assert.match(viewSource, /model\.type === 'LLM'/, '数据生成模型列表没有排除非大模型')
|
||||||
assert.match(viewSource, /:generation-models="generationModels"/, '创建页没有向生成选项传递模型列表')
|
assert.match(viewSource, /<ModelSelectionStep[\s\S]*?:models="generationModels"/, '创建页没有向独立大模型选择步骤传递模型列表')
|
||||||
|
|
||||||
assert.match(typesSource, /export interface UnstructuredProcessOptions/, '缺少非结构化处理选项类型')
|
assert.match(typesSource, /export interface UnstructuredProcessOptions/, '缺少非结构化处理选项类型')
|
||||||
for (const field of [
|
for (const field of [
|
||||||
@@ -312,11 +337,7 @@ for (const method of ['自动语义切分', '按标题和段落', '按固定长
|
|||||||
for (const label of ['切片长度', '重叠长度', '最小切片长度', '保护表格、代码和列表']) {
|
for (const label of ['切片长度', '重叠长度', '最小切片长度', '保护表格、代码和列表']) {
|
||||||
assert.ok(unstructuredOptionsSource.includes(label), `切分选项缺少配置:${label}`)
|
assert.ok(unstructuredOptionsSource.includes(label), `切分选项缺少配置:${label}`)
|
||||||
}
|
}
|
||||||
assert.ok(unstructuredOptionsSource.includes('高级设置'), '切分选项缺少渐进式高级设置入口')
|
assert.doesNotMatch(unstructuredOptionsSource, /advancedChunkSettingsOpen|>高级设置</, '切分核心参数不应再隐藏在高级设置中')
|
||||||
assert.match(unstructuredOptionsSource, /:aria-expanded="advancedChunkSettingsOpen"/, '高级设置入口缺少展开状态的可访问性标记')
|
|
||||||
assert.match(unstructuredOptionsSource, /v-if="advancedChunkSettingsOpen"/, '高级设置内容没有默认收起')
|
|
||||||
assert.match(unstructuredOptionsSource, /watch\(\(\) => props\.options\.chunkMethod,[\s\S]*?method === 'custom'[\s\S]*?advancedChunkSettingsOpen\.value = true/, '选择自定义分隔符时没有自动展开高级设置')
|
|
||||||
assert.match(unstructuredOptionsSource, /function revealValidation\(\)[\s\S]*?advancedChunkSettingsOpen\.value = true/, '非结构化面板没有暴露高级校验定位能力')
|
|
||||||
assert.match(taskSetupSource, /if \(chunkValidationMessage\.value\) \{[\s\S]*?revealValidation\(\)[\s\S]*?return false/, '高级切分配置校验失败时没有重新展开定位')
|
assert.match(taskSetupSource, /if \(chunkValidationMessage\.value\) \{[\s\S]*?revealValidation\(\)[\s\S]*?return false/, '高级切分配置校验失败时没有重新展开定位')
|
||||||
assert.match(unstructuredOptionsSource, /const preserveSpecialContentEnabled = computed/, '特殊内容保护没有合并为单一开关')
|
assert.match(unstructuredOptionsSource, /const preserveSpecialContentEnabled = computed/, '特殊内容保护没有合并为单一开关')
|
||||||
assert.match(unstructuredOptionsSource, /function updateSpecialContentProtection/, '特殊内容保护开关缺少更新逻辑')
|
assert.match(unstructuredOptionsSource, /function updateSpecialContentProtection/, '特殊内容保护开关缺少更新逻辑')
|
||||||
@@ -324,7 +345,7 @@ assert.match(unstructuredOptionsSource, /options\.chunkSize[\s\S]*?:min="200"[\s
|
|||||||
assert.match(unstructuredOptionsSource, /options\.chunkOverlap[\s\S]*?:min="0"[\s\S]*?:max="500"/, '重叠长度必须限制在 0 到 500 Token')
|
assert.match(unstructuredOptionsSource, /options\.chunkOverlap[\s\S]*?:min="0"[\s\S]*?:max="500"/, '重叠长度必须限制在 0 到 500 Token')
|
||||||
assert.match(unstructuredOptionsSource, /options\.minChunkSize[\s\S]*?:min="20"[\s\S]*?:max="500"/, '最小切片长度必须限制在 20 到 500 Token')
|
assert.match(unstructuredOptionsSource, /options\.minChunkSize[\s\S]*?:min="20"[\s\S]*?:max="500"/, '最小切片长度必须限制在 20 到 500 Token')
|
||||||
|
|
||||||
for (const label of ['语义丰富表达', '每个切片生成数量', '数据集划分']) {
|
for (const label of ['每个切片生成数量', '数据集划分']) {
|
||||||
assert.ok(taskSetupFeatureSource.includes(label), `非结构化生成选项缺少:${label}`)
|
assert.ok(taskSetupFeatureSource.includes(label), `非结构化生成选项缺少:${label}`)
|
||||||
}
|
}
|
||||||
for (const removedLabel of ['上下文范围', '问题类型', '跳过无法回答的内容']) {
|
for (const removedLabel of ['上下文范围', '问题类型', '跳过无法回答的内容']) {
|
||||||
@@ -862,4 +883,4 @@ assert.match(
|
|||||||
)
|
)
|
||||||
assert.match(previewSource, /height:\s*clamp\(560px,\s*calc\(100vh - 370px\),\s*720px\)/, '对照预览高度不足以展示切片正文')
|
assert.match(previewSource, /height:\s*clamp\(560px,\s*calc\(100vh - 370px\),\s*720px\)/, '对照预览高度不足以展示切片正文')
|
||||||
|
|
||||||
console.log('数据处理五步向导回归检查通过')
|
console.log('数据处理六步向导回归检查通过')
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ const [
|
|||||||
createSource,
|
createSource,
|
||||||
taskStepSource,
|
taskStepSource,
|
||||||
ruleStepSource,
|
ruleStepSource,
|
||||||
|
basicMetricStepSource,
|
||||||
|
startStepSource,
|
||||||
dimensionFieldsSource,
|
dimensionFieldsSource,
|
||||||
listSource,
|
listSource,
|
||||||
routerSource,
|
routerSource,
|
||||||
@@ -19,6 +21,8 @@ const [
|
|||||||
readFile(path.join(evalViewDir, 'EvalCreateView.vue'), 'utf8'),
|
readFile(path.join(evalViewDir, 'EvalCreateView.vue'), 'utf8'),
|
||||||
readFile(path.join(evalViewDir, 'create/EvalTaskSetupStep.vue'), 'utf8'),
|
readFile(path.join(evalViewDir, 'create/EvalTaskSetupStep.vue'), 'utf8'),
|
||||||
readFile(path.join(evalViewDir, 'create/EvalRuleSetupStep.vue'), 'utf8'),
|
readFile(path.join(evalViewDir, 'create/EvalRuleSetupStep.vue'), 'utf8'),
|
||||||
|
readFile(path.join(evalViewDir, 'create/BasicMetricSetupStep.vue'), 'utf8'),
|
||||||
|
readFile(path.join(evalViewDir, 'create/StartEvalStep.vue'), 'utf8'),
|
||||||
readFile(path.join(evalViewDir, 'create/DimensionFormFields.vue'), 'utf8'),
|
readFile(path.join(evalViewDir, 'create/DimensionFormFields.vue'), 'utf8'),
|
||||||
readFile(path.join(evalViewDir, 'EvalView.vue'), 'utf8'),
|
readFile(path.join(evalViewDir, 'EvalView.vue'), 'utf8'),
|
||||||
readFile(path.join(sourceRoot, 'router/index.ts'), 'utf8'),
|
readFile(path.join(sourceRoot, 'router/index.ts'), 'utf8'),
|
||||||
@@ -74,21 +78,43 @@ assert.match(
|
|||||||
|
|
||||||
assert.match(createSource, /EvalTaskSetupStep/, '向导缺少任务配置子组件')
|
assert.match(createSource, /EvalTaskSetupStep/, '向导缺少任务配置子组件')
|
||||||
assert.match(createSource, /EvalRuleSetupStep/, '向导缺少评测规则子组件')
|
assert.match(createSource, /EvalRuleSetupStep/, '向导缺少评测规则子组件')
|
||||||
|
assert.match(createSource, /BasicMetricSetupStep/, '向导缺少基础评测指标子组件')
|
||||||
|
assert.match(createSource, /StartEvalStep/, '向导缺少开始评测确认子组件')
|
||||||
assert.match(
|
assert.match(
|
||||||
createSource,
|
createSource,
|
||||||
/任务配置[\s\S]*?评测规则/,
|
/任务配置[\s\S]*?大模型评测指标[\s\S]*?基础评测指标[\s\S]*?开始评测/,
|
||||||
'评测创建向导必须按“任务配置、评测规则”定义两个步骤',
|
'评测创建向导必须按“任务配置、大模型评测指标、基础评测指标、开始评测”定义四个步骤',
|
||||||
)
|
)
|
||||||
assert.match(
|
assert.match(
|
||||||
ruleStepSource,
|
ruleStepSource,
|
||||||
/:show-description=["']false["']/,
|
/:show-description=["']false["']/,
|
||||||
'新建评测任务第二步不应显示重复的规则描述输入框',
|
'大模型评测指标步骤不应显示重复的规则描述输入框',
|
||||||
|
)
|
||||||
|
assert.match(
|
||||||
|
ruleStepSource,
|
||||||
|
/:show-status-settings=["']false["']/,
|
||||||
|
'大模型评测指标步骤不应显示维度管理状态字段',
|
||||||
|
)
|
||||||
|
assert.match(
|
||||||
|
ruleStepSource,
|
||||||
|
/LLM_METRIC_TYPES[^=]*=\s*\[['"]classification['"],\s*['"]metric['"]\][\s\S]*?:allowed-types=["']LLM_METRIC_TYPES["']/,
|
||||||
|
'大模型评测指标步骤只应提供依赖大模型的分类与评分指标',
|
||||||
)
|
)
|
||||||
assert.match(
|
assert.match(
|
||||||
dimensionFieldsSource,
|
dimensionFieldsSource,
|
||||||
/v-if=["']showDescription["'][^>]*label=["']描述["']/,
|
/v-if=["']showDescription["'][^>]*label=["']描述["']/,
|
||||||
'共享维度字段必须支持按场景隐藏描述输入框',
|
'共享维度字段必须支持按场景隐藏描述输入框',
|
||||||
)
|
)
|
||||||
|
assert.match(
|
||||||
|
dimensionFieldsSource,
|
||||||
|
/score_min[\s\S]*?score_max[\s\S]*?pass_threshold[\s\S]*?Math\.min[\s\S]*?Math\.max/,
|
||||||
|
'指标型评分区间变化时必须把通过阈值约束在合法范围内',
|
||||||
|
)
|
||||||
|
assert.match(
|
||||||
|
dimensionFieldsSource,
|
||||||
|
/prop=["']score_min["'][\s\S]*?:max=["'][^"']*score_max[^"']*["'][\s\S]*?prop=["']score_max["'][\s\S]*?:min=["'][^"']*score_min[^"']*["']/,
|
||||||
|
'评分最小值和最大值输入必须具备交叉边界约束',
|
||||||
|
)
|
||||||
assert.match(createSource, /currentStep\s*=\s*ref\(0\)/, '评测创建向导缺少当前步骤状态')
|
assert.match(createSource, /currentStep\s*=\s*ref\(0\)/, '评测创建向导缺少当前步骤状态')
|
||||||
assert.match(createSource, /class=["']custom-wizard-steps["']/, '评测向导未复用数据处理的自定义步骤条结构')
|
assert.match(createSource, /class=["']custom-wizard-steps["']/, '评测向导未复用数据处理的自定义步骤条结构')
|
||||||
assert.match(createSource, /class=["']step-connector["']/, '评测向导步骤条缺少连接线')
|
assert.match(createSource, /class=["']step-connector["']/, '评测向导步骤条缺少连接线')
|
||||||
@@ -102,8 +128,18 @@ assert.match(
|
|||||||
)
|
)
|
||||||
assert.match(
|
assert.match(
|
||||||
createSource,
|
createSource,
|
||||||
/<EvalRuleSetupStep[\s\S]*?v-else/,
|
/<EvalRuleSetupStep[\s\S]*?currentStep[^"']*1/,
|
||||||
'评测规则子组件没有绑定第二步',
|
'大模型评测指标子组件没有绑定第二步',
|
||||||
|
)
|
||||||
|
assert.match(
|
||||||
|
createSource,
|
||||||
|
/<BasicMetricSetupStep[\s\S]*?currentStep[^"']*2/,
|
||||||
|
'基础评测指标子组件没有绑定第三步',
|
||||||
|
)
|
||||||
|
assert.match(
|
||||||
|
createSource,
|
||||||
|
/<StartEvalStep[\s\S]*?v-else/,
|
||||||
|
'开始评测确认子组件没有绑定第四步',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.match(taskStepSource, /prop=["']dataset_id["']/, '数据集字段缺少表单校验标识')
|
assert.match(taskStepSource, /prop=["']dataset_id["']/, '数据集字段缺少表单校验标识')
|
||||||
@@ -113,16 +149,15 @@ assert.match(
|
|||||||
'选择评测数据集时必须校验 dataset_id',
|
'选择评测数据集时必须校验 dataset_id',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.match(createSource, /['"]baseline['"]/, '向导缺少基线评测分支')
|
|
||||||
assert.match(
|
assert.match(
|
||||||
`${createSource}\n${ruleStepSource}`,
|
basicMetricStepSource,
|
||||||
/已有维度|existing/,
|
/BLEU[\s\S]*?ROUGE[\s\S]*?(?:Cosine|余弦)/,
|
||||||
'评测规则步骤缺少使用已有维度的分支',
|
'基础评测指标步骤必须提供 BLEU、ROUGE 与余弦相似度配置',
|
||||||
)
|
)
|
||||||
assert.match(
|
assert.match(
|
||||||
`${createSource}\n${ruleStepSource}`,
|
basicMetricStepSource,
|
||||||
/新建(?:评测)?(?:维度|规则)|create/,
|
/bleu_enabled[\s\S]*?rouge_enabled[\s\S]*?cosine_enabled/,
|
||||||
'评测规则步骤缺少新建维度的分支',
|
'基础评测指标必须支持分别决定是否启用',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.match(
|
assert.match(
|
||||||
@@ -137,17 +172,18 @@ assert.match(
|
|||||||
)
|
)
|
||||||
assert.match(
|
assert.match(
|
||||||
createSource,
|
createSource,
|
||||||
/eval_type[\s\S]*?baseline[\s\S]*?(?:dimension_id|createDimension)/,
|
/basic_metrics[\s\S]*?bleu[\s\S]*?rouge[\s\S]*?cosine/,
|
||||||
'基线评测必须有明确的不创建自定义维度分支',
|
'启动评测时必须提交基础评测指标配置',
|
||||||
)
|
)
|
||||||
assert.match(
|
assert.match(
|
||||||
createSource,
|
startStepSource,
|
||||||
/ruleMode[\s\S]*?['"]existing['"]/,
|
/任务信息[\s\S]*?大模型评测指标[\s\S]*?基础评测指标/,
|
||||||
'已有维度模式必须有独立的提交分支',
|
'开始评测步骤必须展示前三步配置摘要',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.match(createSource, /:loading=["']submitting["']/, '最终提交按钮缺少 loading 状态')
|
assert.match(createSource, /:loading=["']submitting["']/, '最终提交按钮缺少 loading 状态')
|
||||||
assert.match(createSource, /:disabled=["'][^"']*submitting/, '提交期间必须禁用重复操作')
|
assert.match(createSource, /:disabled=["'][^"']*submitting/, '提交期间必须禁用重复操作')
|
||||||
|
assert.match(createSource, />\s*开始评测\s*</, '最终提交按钮必须命名为“开始评测”')
|
||||||
assert.match(createSource, /class=["'][^"']*wizard-footer/, '评测向导缺少统一底部操作栏')
|
assert.match(createSource, /class=["'][^"']*wizard-footer/, '评测向导缺少统一底部操作栏')
|
||||||
assert.match(
|
assert.match(
|
||||||
createSource,
|
createSource,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { get, post, put, del } from '../request'
|
import { get, post, put, del } from '../request'
|
||||||
import type { EvalTask, EvalTaskDetail, Dimension } from '@/types'
|
import type { EvalTask, EvalTaskDetail, Dimension, StartEvalPayload } from '@/types'
|
||||||
|
|
||||||
/** 评测任务列表 */
|
/** 评测任务列表 */
|
||||||
export const getEvalList = () => get<EvalTask[]>('/model-eval')
|
export const getEvalList = () => get<EvalTask[]>('/model-eval')
|
||||||
@@ -11,7 +11,7 @@ export const getEvalDetail = (id: string | number) => get<EvalTaskDetail>(`/mode
|
|||||||
export const deleteEval = (id: string | number) => del(`/model-eval/${id}`)
|
export const deleteEval = (id: string | number) => del(`/model-eval/${id}`)
|
||||||
|
|
||||||
/** 启动评测 */
|
/** 启动评测 */
|
||||||
export const startEval = (data: any) => post('/model-eval/start', data)
|
export const startEval = (data: StartEvalPayload) => post('/model-eval/start', data)
|
||||||
|
|
||||||
/** 评测维度列表 */
|
/** 评测维度列表 */
|
||||||
export const getDimensionList = () => get<Dimension[]>('/dimension')
|
export const getDimensionList = () => get<Dimension[]>('/dimension')
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const menuGroups = [
|
|||||||
{
|
{
|
||||||
title: '模型服务',
|
title: '模型服务',
|
||||||
items: [
|
items: [
|
||||||
{ key: 'fine-tune', label: '模型微调', icon: 'fa-cogs', to: '/fine-tune' },
|
{ key: 'fine-tune', label: '模型训练', icon: 'fa-cogs', to: '/fine-tune' },
|
||||||
{ key: 'model-eval', label: '模型评测', icon: 'fa-line-chart', to: '/model-eval' },
|
{ key: 'model-eval', label: '模型评测', icon: 'fa-line-chart', to: '/model-eval' },
|
||||||
{ key: 'model-inference', label: '模型推理', icon: 'fa-server', to: '/model-inference' },
|
{ key: 'model-inference', label: '模型推理', icon: 'fa-server', to: '/model-inference' },
|
||||||
{ key: 'model-manage', label: '模型管理', icon: 'fa-cube', to: '/model-manage' },
|
{ key: 'model-manage', label: '模型管理', icon: 'fa-cube', to: '/model-manage' },
|
||||||
@@ -45,8 +45,8 @@ const menuGroups = [
|
|||||||
{
|
{
|
||||||
title: '数据治理',
|
title: '数据治理',
|
||||||
items: [
|
items: [
|
||||||
{ key: 'data-process', label: '数据处理', icon: 'fa-filter', to: '/data-process' },
|
|
||||||
{ key: 'dataset', label: '数据集管理', icon: 'fa-file-text', to: '/dataset' },
|
{ key: 'dataset', label: '数据集管理', icon: 'fa-file-text', to: '/dataset' },
|
||||||
|
{ key: 'data-process', label: '数据处理', icon: 'fa-filter', to: '/data-process' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
path: 'fine-tune',
|
path: 'fine-tune',
|
||||||
name: 'fine-tune',
|
name: 'fine-tune',
|
||||||
component: () => import('@/views/fine-tune/FineTuneListView.vue'),
|
component: () => import('@/views/fine-tune/FineTuneListView.vue'),
|
||||||
meta: { title: '模型微调', pageSurface: 'self' },
|
meta: { title: '模型训练', pageSurface: 'self' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'fine-tune/create',
|
path: 'fine-tune/create',
|
||||||
|
|||||||
@@ -224,6 +224,34 @@ export interface EvalTask {
|
|||||||
create_time?: string
|
create_time?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 启动评测时提交的可选基础指标配置。 */
|
||||||
|
export interface BasicEvalMetricsConfig {
|
||||||
|
bleu: {
|
||||||
|
enabled: boolean
|
||||||
|
ngram: number
|
||||||
|
}
|
||||||
|
rouge: {
|
||||||
|
enabled: boolean
|
||||||
|
methods: string[]
|
||||||
|
}
|
||||||
|
cosine: {
|
||||||
|
enabled: boolean
|
||||||
|
}
|
||||||
|
output_precision: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StartEvalPayload {
|
||||||
|
eval_task_name: string
|
||||||
|
eval_type: EvalType
|
||||||
|
model_id: string | number
|
||||||
|
gpu_id: string | number
|
||||||
|
dataset_id: string | number
|
||||||
|
dimension_id: string | number
|
||||||
|
data_source: 'dataset' | 'inference'
|
||||||
|
leaderboard: boolean
|
||||||
|
basic_metrics: BasicEvalMetricsConfig
|
||||||
|
}
|
||||||
|
|
||||||
/** 单个测试样本的评测结果 */
|
/** 单个测试样本的评测结果 */
|
||||||
export interface EvalSampleResult {
|
export interface EvalSampleResult {
|
||||||
id: number | string
|
id: number | string
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { ElMessage, type UploadFile } from 'element-plus'
|
|||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import AppConfirmDialog from '@/components/AppConfirmDialog.vue'
|
import AppConfirmDialog from '@/components/AppConfirmDialog.vue'
|
||||||
import TaskSetupStep from './create/TaskSetupStep.vue'
|
import TaskSetupStep from './create/TaskSetupStep.vue'
|
||||||
|
import ModelSelectionStep from './create/ModelSelectionStep.vue'
|
||||||
import SourceUploadStep from './create/SourceUploadStep.vue'
|
import SourceUploadStep from './create/SourceUploadStep.vue'
|
||||||
import PreviewCompareStep from './create/PreviewCompareStep.vue'
|
import PreviewCompareStep from './create/PreviewCompareStep.vue'
|
||||||
import GenerationStep from './create/GenerationStep.vue'
|
import GenerationStep from './create/GenerationStep.vue'
|
||||||
@@ -22,6 +23,7 @@ import { useDataProcessGeneration } from './create/useDataProcessGeneration'
|
|||||||
import { useModelsStore } from '@/stores/models'
|
import { useModelsStore } from '@/stores/models'
|
||||||
import type {
|
import type {
|
||||||
ExternalDataSource,
|
ExternalDataSource,
|
||||||
|
GenerationControlOptions,
|
||||||
PreviewItem,
|
PreviewItem,
|
||||||
ProcessType,
|
ProcessType,
|
||||||
StepId,
|
StepId,
|
||||||
@@ -35,22 +37,27 @@ const modelsStore = useModelsStore()
|
|||||||
const { list: modelList } = storeToRefs(modelsStore)
|
const { list: modelList } = storeToRefs(modelsStore)
|
||||||
const generationModels = computed(() => modelList.value.filter((model) => model.type === 'LLM'))
|
const generationModels = computed(() => modelList.value.filter((model) => model.type === 'LLM'))
|
||||||
const taskSetupRef = ref<InstanceType<typeof TaskSetupStep>>()
|
const taskSetupRef = ref<InstanceType<typeof TaskSetupStep>>()
|
||||||
|
const modelSelectionRef = ref<InstanceType<typeof ModelSelectionStep>>()
|
||||||
const confirmDialogRef = ref<InstanceType<typeof AppConfirmDialog>>()
|
const confirmDialogRef = ref<InstanceType<typeof AppConfirmDialog>>()
|
||||||
const PREVIEW_MODEL_VERSION = 'document-chunk-v2'
|
const PREVIEW_MODEL_VERSION = 'document-chunk-v2'
|
||||||
|
|
||||||
const WIZARD_STEPS = [
|
const WIZARD_STEPS = [
|
||||||
{ id: 'create', title: '创建任务', desc: '填写任务信息与处理配置' },
|
{ id: 'create', title: '创建任务', desc: '填写任务信息与处理配置' },
|
||||||
|
{ id: 'model', title: '大模型选择', desc: '选择生成模型并设置输出要求' },
|
||||||
{ id: 'upload', title: '上传文件', desc: '上传或接入待处理的源数据' },
|
{ id: 'upload', title: '上传文件', desc: '上传或接入待处理的源数据' },
|
||||||
{ id: 'preview', title: '数据预览', desc: '核对源文件与预览内容' },
|
{ id: 'preview', title: '数据预览', desc: '核对源文件与预览内容' },
|
||||||
{ id: 'generate', title: '开始生成', desc: '确认摘要并启动处理' },
|
{ id: 'generate', title: '开始生成', desc: '确认摘要并启动处理' },
|
||||||
{ id: 'results', title: '结果编辑与保存', desc: '检查、修改并保存结果' },
|
{ id: 'results', title: '编辑与保存', desc: '检查、修改并保存结果' },
|
||||||
] as const satisfies ReadonlyArray<{ id: StepId; title: string; desc: string }>
|
] as const satisfies ReadonlyArray<{ id: StepId; title: string; desc: string }>
|
||||||
const currentStep = ref(0)
|
const currentStep = ref(0)
|
||||||
const currentStepId = computed<StepId>(() => WIZARD_STEPS[currentStep.value]?.id ?? 'create')
|
const currentStepId = computed<StepId>(() => WIZARD_STEPS[currentStep.value]?.id ?? 'create')
|
||||||
const task = reactive({ name: '', description: '' })
|
const task = reactive({ name: '', description: '' })
|
||||||
const processType = ref<ProcessType>('unstructured')
|
const processType = ref<ProcessType>('structured')
|
||||||
const structuredOptions = ref<StructuredProcessOptions>(createDefaultStructuredOptions())
|
const structuredOptions = ref<StructuredProcessOptions>(createDefaultStructuredOptions())
|
||||||
const unstructuredOptions = ref<UnstructuredProcessOptions>(createDefaultUnstructuredOptions())
|
const unstructuredOptions = ref<UnstructuredProcessOptions>(createDefaultUnstructuredOptions())
|
||||||
|
const modelSelectionOptions = computed<GenerationControlOptions>(() => (
|
||||||
|
processType.value === 'unstructured' ? unstructuredOptions.value : structuredOptions.value
|
||||||
|
))
|
||||||
const uploadedFiles = ref<UploadedDataFile[]>([])
|
const uploadedFiles = ref<UploadedDataFile[]>([])
|
||||||
|
|
||||||
const externalSource = reactive<ExternalDataSource>({
|
const externalSource = reactive<ExternalDataSource>({
|
||||||
@@ -119,7 +126,8 @@ const previewFiles = computed(() => uploadedFiles.value.map((file) => {
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
const primaryActionLabel = computed(() => {
|
const primaryActionLabel = computed(() => {
|
||||||
if (currentStepId.value === 'create') return '继续:上传文件'
|
if (currentStepId.value === 'create') return '继续:选择大模型'
|
||||||
|
if (currentStepId.value === 'model') return '继续:上传文件'
|
||||||
if (currentStepId.value === 'upload') return '继续:数据预览'
|
if (currentStepId.value === 'upload') return '继续:数据预览'
|
||||||
if (currentStepId.value === 'preview') return '确认预览并继续'
|
if (currentStepId.value === 'preview') return '确认预览并继续'
|
||||||
if (currentStepId.value === 'results') return '保存任务'
|
if (currentStepId.value === 'results') return '保存任务'
|
||||||
@@ -144,6 +152,14 @@ function goToStep(stepId: StepId) {
|
|||||||
if (nextStepIndex >= 0) currentStep.value = nextStepIndex
|
if (nextStepIndex >= 0) currentStep.value = nextStepIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateModelSelectionOptions(value: GenerationControlOptions) {
|
||||||
|
if (processType.value === 'unstructured') {
|
||||||
|
unstructuredOptions.value = { ...unstructuredOptions.value, ...value }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
structuredOptions.value = { ...structuredOptions.value, ...value }
|
||||||
|
}
|
||||||
|
|
||||||
const { persistDraft, restoreDraft } = useDataProcessDraft({
|
const { persistDraft, restoreDraft } = useDataProcessDraft({
|
||||||
currentStepId,
|
currentStepId,
|
||||||
task,
|
task,
|
||||||
@@ -393,6 +409,12 @@ function resetSourceDataForProcessTypeChange() {
|
|||||||
async function nextFromCreate() {
|
async function nextFromCreate() {
|
||||||
const valid = await taskSetupRef.value?.validate()
|
const valid = await taskSetupRef.value?.validate()
|
||||||
if (!valid) return
|
if (!valid) return
|
||||||
|
goToStep('model')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function nextFromModel() {
|
||||||
|
const valid = await modelSelectionRef.value?.validate()
|
||||||
|
if (!valid) return
|
||||||
goToStep('upload')
|
goToStep('upload')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,6 +526,10 @@ async function handlePrimaryAction() {
|
|||||||
await nextFromCreate()
|
await nextFromCreate()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (currentStepId.value === 'model') {
|
||||||
|
await nextFromModel()
|
||||||
|
return
|
||||||
|
}
|
||||||
if (currentStepId.value === 'upload') {
|
if (currentStepId.value === 'upload') {
|
||||||
nextFromUpload()
|
nextFromUpload()
|
||||||
return
|
return
|
||||||
@@ -596,9 +622,13 @@ onMounted(() => {
|
|||||||
<div class="wizard-main-inner">
|
<div class="wizard-main-inner">
|
||||||
<div class="wizard-steps-container">
|
<div class="wizard-steps-container">
|
||||||
<div class="custom-wizard-steps">
|
<div class="custom-wizard-steps">
|
||||||
|
<template v-for="(step, index) in WIZARD_STEPS" :key="step.id">
|
||||||
|
<div
|
||||||
|
v-if="index !== 0"
|
||||||
|
class="step-connector"
|
||||||
|
:class="{ 'is-active': currentStep >= index }"
|
||||||
|
></div>
|
||||||
<div
|
<div
|
||||||
v-for="(step, index) in WIZARD_STEPS"
|
|
||||||
:key="step.id"
|
|
||||||
class="step-item"
|
class="step-item"
|
||||||
:class="{
|
:class="{
|
||||||
'is-active': currentStep === index,
|
'is-active': currentStep === index,
|
||||||
@@ -606,7 +636,6 @@ onMounted(() => {
|
|||||||
}"
|
}"
|
||||||
:aria-current="currentStep === index ? 'step' : undefined"
|
:aria-current="currentStep === index ? 'step' : undefined"
|
||||||
>
|
>
|
||||||
<div v-if="index !== 0" class="step-connector"></div>
|
|
||||||
<div class="step-node">
|
<div class="step-node">
|
||||||
<div class="step-icon">
|
<div class="step-icon">
|
||||||
<i v-if="currentStep > index" class="fa fa-check" />
|
<i v-if="currentStep > index" class="fa fa-check" />
|
||||||
@@ -617,6 +646,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -629,7 +659,14 @@ onMounted(() => {
|
|||||||
v-model:process-type="processType"
|
v-model:process-type="processType"
|
||||||
v-model:structured-options="structuredOptions"
|
v-model:structured-options="structuredOptions"
|
||||||
v-model:unstructured-options="unstructuredOptions"
|
v-model:unstructured-options="unstructuredOptions"
|
||||||
:generation-models="generationModels"
|
/>
|
||||||
|
|
||||||
|
<ModelSelectionStep
|
||||||
|
v-else-if="currentStepId === 'model'"
|
||||||
|
ref="modelSelectionRef"
|
||||||
|
:options="modelSelectionOptions"
|
||||||
|
:models="generationModels"
|
||||||
|
@update:options="updateModelSelectionOptions"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SourceUploadStep
|
<SourceUploadStep
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ function formatDateTime(value?: string) {
|
|||||||
:data="dataList"
|
:data="dataList"
|
||||||
searchable
|
searchable
|
||||||
:search-fields="['name']"
|
:search-fields="['name']"
|
||||||
create-text="新建数据处理任务"
|
create-text="新建数据处理"
|
||||||
create-to="/data-process/create"
|
create-to="/data-process/create"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:page-size="10"
|
:page-size="10"
|
||||||
|
|||||||
@@ -128,19 +128,19 @@ function ariaLabel(label: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dataset-split-row {
|
.dataset-split-row {
|
||||||
align-items: stretch;
|
align-items: flex-start;
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataset-split-config {
|
.dataset-split-config {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
flex: 0 0 460px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataset-split-grid {
|
.dataset-split-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
gap: 16px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataset-split-field {
|
.dataset-split-field {
|
||||||
@@ -173,6 +173,15 @@ function ariaLabel(label: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
|
.dataset-split-row {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dataset-split-config {
|
||||||
|
flex: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.dataset-split-grid {
|
.dataset-split-grid {
|
||||||
grid-template-columns: minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1fr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import type { GenerationControlOptions } from './types'
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
options: GenerationControlOptions
|
options: GenerationControlOptions
|
||||||
models: ModelItem[]
|
models?: ModelItem[]
|
||||||
section: 'model' | 'quality'
|
section: 'model' | 'quality'
|
||||||
validationMessage?: string
|
validationMessage?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const advancedModelSettingsOpen = ref(false)
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
'update:options': [value: GenerationControlOptions]
|
'update:options': [value: GenerationControlOptions]
|
||||||
}>()
|
}>()
|
||||||
@@ -61,7 +59,7 @@ function sectionValidationMessage() {
|
|||||||
@update:model-value="updateField('generationModelId', $event)"
|
@update:model-value="updateField('generationModelId', $event)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="model in models"
|
v-for="model in models || []"
|
||||||
:key="model.id"
|
:key="model.id"
|
||||||
:label="model.name"
|
:label="model.name"
|
||||||
:value="model.id"
|
:value="model.id"
|
||||||
@@ -99,20 +97,6 @@ function sectionValidationMessage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="advanced-settings-toggle"
|
|
||||||
:aria-expanded="advancedModelSettingsOpen"
|
|
||||||
@click="advancedModelSettingsOpen = !advancedModelSettingsOpen"
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
<strong>高级设置</strong>
|
|
||||||
<small>温度、最大输出长度与格式约束</small>
|
|
||||||
</span>
|
|
||||||
<i class="fa" :class="advancedModelSettingsOpen ? 'fa-chevron-up' : 'fa-chevron-down'" />
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div v-if="advancedModelSettingsOpen" class="advanced-settings-panel">
|
|
||||||
<div class="advanced-settings-grid">
|
<div class="advanced-settings-grid">
|
||||||
<label class="config-field">
|
<label class="config-field">
|
||||||
<span class="config-field-label">生成温度 (Temperature)</span>
|
<span class="config-field-label">生成温度 (Temperature)</span>
|
||||||
@@ -157,7 +141,6 @@ function sectionValidationMessage() {
|
|||||||
@update:model-value="updateField('jsonMode', Boolean($event))"
|
@update:model-value="updateField('jsonMode', Boolean($event))"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<p v-if="sectionValidationMessage()" class="generation-validation-message" role="alert">
|
<p v-if="sectionValidationMessage()" class="generation-validation-message" role="alert">
|
||||||
{{ sectionValidationMessage() }}
|
{{ sectionValidationMessage() }}
|
||||||
@@ -251,7 +234,22 @@ function sectionValidationMessage() {
|
|||||||
.model-config-group {
|
.model-config-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 16px;
|
gap: 20px;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-config-group .advanced-settings-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-config-group .config-field {
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.model-field {
|
.model-field {
|
||||||
@@ -297,61 +295,6 @@ function sectionValidationMessage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.advanced-settings-toggle {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 48px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 16px;
|
|
||||||
margin-top: 4px;
|
|
||||||
padding: 10px 14px;
|
|
||||||
color: #344054;
|
|
||||||
text-align: left;
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #e2e5ec;
|
|
||||||
border-radius: 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: border-color 0.18s ease, background-color 0.18s ease;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: #f8f7ff;
|
|
||||||
border-color: #b7b2f7;
|
|
||||||
}
|
|
||||||
|
|
||||||
> span {
|
|
||||||
display: grid;
|
|
||||||
gap: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
strong {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
small {
|
|
||||||
color: #8a93a3;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
i {
|
|
||||||
flex: 0 0 auto;
|
|
||||||
color: #7b8495;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.advanced-settings-panel {
|
|
||||||
display: grid;
|
|
||||||
gap: 16px;
|
|
||||||
margin-top: -8px;
|
|
||||||
padding: 16px;
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #e2e5ec;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.advanced-settings-grid {
|
.advanced-settings-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
@@ -401,8 +344,8 @@ function sectionValidationMessage() {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 20px;
|
gap: 16px;
|
||||||
padding: 14px;
|
padding: 12px 14px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid #e2e5ec;
|
border: 1px solid #e2e5ec;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import type { ModelItem } from '@/types'
|
||||||
|
import type { GenerationControlOptions } from './types'
|
||||||
|
import GenerationOptionsPanel from './GenerationOptionsPanel.vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
options: GenerationControlOptions
|
||||||
|
models: ModelItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:options': [value: GenerationControlOptions]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const validationAttempted = ref(false)
|
||||||
|
const modelValidationMessage = computed(() => (
|
||||||
|
props.options.generationModelId === '' ? '请选择数据生成模型' : ''
|
||||||
|
))
|
||||||
|
|
||||||
|
function validate() {
|
||||||
|
validationAttempted.value = true
|
||||||
|
if (!modelValidationMessage.value) return true
|
||||||
|
ElMessage.error(modelValidationMessage.value)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ validate })
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="model-selection-step" aria-labelledby="model-selection-title">
|
||||||
|
<div class="form-section">
|
||||||
|
<div class="section-title-row">
|
||||||
|
<div>
|
||||||
|
<h3 id="model-selection-title">大模型选择</h3>
|
||||||
|
<p>选择本次数据生成使用的模型,并设置统一的输出要求</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="model-form-content">
|
||||||
|
<GenerationOptionsPanel
|
||||||
|
:options="options"
|
||||||
|
:models="models"
|
||||||
|
section="model"
|
||||||
|
:validation-message="validationAttempted ? modelValidationMessage : ''"
|
||||||
|
@update:options="emit('update:options', $event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.model-selection-step {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-section {
|
||||||
|
padding: 0 0 26px;
|
||||||
|
margin-bottom: 26px;
|
||||||
|
border-bottom: 1px solid #edf0f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 5px;
|
||||||
|
color: #2f3747;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
color: #8a93a3;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-form-content {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ModelItem } from '@/types'
|
|
||||||
import type {
|
import type {
|
||||||
GenerationControlOptions,
|
GenerationControlOptions,
|
||||||
PreprocessOption,
|
PreprocessOption,
|
||||||
@@ -10,9 +9,8 @@ import GenerationOptionsPanel from './GenerationOptionsPanel.vue'
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
options: StructuredProcessOptions
|
options: StructuredProcessOptions
|
||||||
generationModels: ModelItem[]
|
|
||||||
validationAttempted: boolean
|
validationAttempted: boolean
|
||||||
generationValidationMessage: string
|
qualityValidationMessage: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -89,24 +87,11 @@ function updatePreprocessOptions(value: Array<string | number | boolean>) {
|
|||||||
<div class="generation-option-list">
|
<div class="generation-option-list">
|
||||||
<GenerationOptionsPanel
|
<GenerationOptionsPanel
|
||||||
:options="options"
|
:options="options"
|
||||||
:models="generationModels"
|
|
||||||
section="quality"
|
section="quality"
|
||||||
:validation-message="validationAttempted ? generationValidationMessage : ''"
|
:validation-message="validationAttempted ? qualityValidationMessage : ''"
|
||||||
@update:options="updateGenerationOptions"
|
@update:options="updateGenerationOptions"
|
||||||
/>
|
/>
|
||||||
<div class="generation-option-row">
|
|
||||||
<div class="generation-option-copy">
|
|
||||||
<strong>语义丰富表达</strong>
|
|
||||||
<small>使用大模型将问答表述得更自然、柔和</small>
|
|
||||||
</div>
|
|
||||||
<el-switch
|
|
||||||
:model-value="options.semanticEnrichment"
|
|
||||||
inline-prompt
|
|
||||||
active-text="开"
|
|
||||||
inactive-text="关"
|
|
||||||
@update:model-value="updateField('semanticEnrichment', Boolean($event))"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="generation-option-row">
|
<div class="generation-option-row">
|
||||||
<div class="generation-option-copy">
|
<div class="generation-option-copy">
|
||||||
<strong>每行生成数量</strong>
|
<strong>每行生成数量</strong>
|
||||||
@@ -128,23 +113,6 @@ function updatePreprocessOptions(value: Array<string | number | boolean>) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-section model-options-section">
|
|
||||||
<div class="section-title-row">
|
|
||||||
<div>
|
|
||||||
<h3>大模型</h3>
|
|
||||||
<p>选择数据生成模型,并设置模型输出内容的要求</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="generation-option-list">
|
|
||||||
<GenerationOptionsPanel
|
|
||||||
:options="options"
|
|
||||||
:models="generationModels"
|
|
||||||
section="model"
|
|
||||||
:validation-message="validationAttempted ? generationValidationMessage : ''"
|
|
||||||
@update:options="updateGenerationOptions"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -191,6 +159,8 @@ function updatePreprocessOptions(value: Array<string | number | boolean>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.preprocess-option {
|
.preprocess-option {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 64px;
|
min-height: 64px;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||||
import type { ModelItem } from '@/types'
|
|
||||||
import type {
|
import type {
|
||||||
GenerationControlOptions,
|
GenerationControlOptions,
|
||||||
ProcessType,
|
ProcessType,
|
||||||
@@ -17,7 +16,6 @@ const props = defineProps<{
|
|||||||
processType: ProcessType
|
processType: ProcessType
|
||||||
structuredOptions: StructuredProcessOptions
|
structuredOptions: StructuredProcessOptions
|
||||||
unstructuredOptions: UnstructuredProcessOptions
|
unstructuredOptions: UnstructuredProcessOptions
|
||||||
generationModels: ModelItem[]
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -52,10 +50,9 @@ const activeGenerationOptions = computed<GenerationControlOptions | null>(() =>
|
|||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|
||||||
const generationValidationMessage = computed(() => {
|
const qualityValidationMessage = computed(() => {
|
||||||
const options = activeGenerationOptions.value
|
const options = activeGenerationOptions.value
|
||||||
if (!options) return ''
|
if (!options) return ''
|
||||||
if (options.generationModelId === '') return '请选择数据生成模型'
|
|
||||||
if (options.qualityFilterEnabled && !options.filterLowQuality && !options.filterShortContent) {
|
if (options.qualityFilterEnabled && !options.filterLowQuality && !options.filterShortContent) {
|
||||||
return '开启质量筛选后,请至少选择一项筛选规则'
|
return '开启质量筛选后,请至少选择一项筛选规则'
|
||||||
}
|
}
|
||||||
@@ -97,17 +94,28 @@ async function validate() {
|
|||||||
if (!formRef.value) return false
|
if (!formRef.value) return false
|
||||||
try {
|
try {
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
if (props.processType === 'structured' && splitTotal.value !== 100) return false
|
if (props.processType === 'structured' && splitTotal.value !== 100) {
|
||||||
|
ElMessage.error('结构化数据处理:数据集划分比例总和必须为 100%')
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (props.processType === 'unstructured') {
|
if (props.processType === 'unstructured') {
|
||||||
if (unstructuredSplitTotal.value !== 100) return false
|
if (unstructuredSplitTotal.value !== 100) {
|
||||||
|
ElMessage.error('非结构化数据处理:数据集划分比例总和必须为 100%')
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (chunkValidationMessage.value) {
|
if (chunkValidationMessage.value) {
|
||||||
unstructuredOptionsPanelRef.value?.revealValidation()
|
unstructuredOptionsPanelRef.value?.revealValidation()
|
||||||
|
ElMessage.error(chunkValidationMessage.value)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (generationValidationMessage.value) return false
|
if (qualityValidationMessage.value) {
|
||||||
|
ElMessage.error(qualityValidationMessage.value)
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch {
|
||||||
|
ElMessage.error('请完善标红的必填项')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,7 +125,7 @@ defineExpose({ validate })
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="task-setup-step">
|
<section class="task-setup-step">
|
||||||
<el-form ref="formRef" :model="formModel" :rules="rules" label-position="top">
|
<el-form ref="formRef" :model="formModel" :rules="rules" label-position="top" scroll-to-error>
|
||||||
<div class="form-section">
|
<div class="form-section">
|
||||||
<h3>基本信息</h3>
|
<h3>基本信息</h3>
|
||||||
<div class="basic-grid">
|
<div class="basic-grid">
|
||||||
@@ -199,9 +207,8 @@ defineExpose({ validate })
|
|||||||
<StructuredOptionsPanel
|
<StructuredOptionsPanel
|
||||||
v-if="processType === 'structured'"
|
v-if="processType === 'structured'"
|
||||||
:options="structuredOptions"
|
:options="structuredOptions"
|
||||||
:generation-models="generationModels"
|
|
||||||
:validation-attempted="validationAttempted"
|
:validation-attempted="validationAttempted"
|
||||||
:generation-validation-message="generationValidationMessage"
|
:quality-validation-message="qualityValidationMessage"
|
||||||
@update:options="emit('update:structuredOptions', $event)"
|
@update:options="emit('update:structuredOptions', $event)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -209,9 +216,8 @@ defineExpose({ validate })
|
|||||||
v-if="processType === 'unstructured'"
|
v-if="processType === 'unstructured'"
|
||||||
ref="unstructuredOptionsPanelRef"
|
ref="unstructuredOptionsPanelRef"
|
||||||
:options="unstructuredOptions"
|
:options="unstructuredOptions"
|
||||||
:generation-models="generationModels"
|
|
||||||
:validation-attempted="validationAttempted"
|
:validation-attempted="validationAttempted"
|
||||||
:generation-validation-message="generationValidationMessage"
|
:quality-validation-message="qualityValidationMessage"
|
||||||
:chunk-validation-message="chunkValidationMessage"
|
:chunk-validation-message="chunkValidationMessage"
|
||||||
@update:options="emit('update:unstructuredOptions', $event)"
|
@update:options="emit('update:unstructuredOptions', $event)"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import type { ModelItem } from '@/types'
|
|
||||||
import type {
|
import type {
|
||||||
ChunkMethod,
|
ChunkMethod,
|
||||||
GenerationControlOptions,
|
GenerationControlOptions,
|
||||||
@@ -12,9 +11,8 @@ import GenerationOptionsPanel from './GenerationOptionsPanel.vue'
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
options: UnstructuredProcessOptions
|
options: UnstructuredProcessOptions
|
||||||
generationModels: ModelItem[]
|
|
||||||
validationAttempted: boolean
|
validationAttempted: boolean
|
||||||
generationValidationMessage: string
|
qualityValidationMessage: string
|
||||||
chunkValidationMessage: string
|
chunkValidationMessage: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
@@ -47,8 +45,6 @@ const UNSTRUCTURED_NUMBER_LIMITS = {
|
|||||||
|
|
||||||
type UnstructuredNumberField = keyof typeof UNSTRUCTURED_NUMBER_LIMITS
|
type UnstructuredNumberField = keyof typeof UNSTRUCTURED_NUMBER_LIMITS
|
||||||
|
|
||||||
const advancedChunkSettingsOpen = ref(props.options.chunkMethod === 'custom')
|
|
||||||
|
|
||||||
const smartPreprocessEnabled = computed(() => SMART_PREPROCESS_OPTIONS.every(
|
const smartPreprocessEnabled = computed(() => SMART_PREPROCESS_OPTIONS.every(
|
||||||
(option) => props.options.preprocessOptions.includes(option),
|
(option) => props.options.preprocessOptions.includes(option),
|
||||||
))
|
))
|
||||||
@@ -61,14 +57,6 @@ const preserveSpecialContentEnabled = computed(() => (
|
|||||||
&& props.options.preserveLists
|
&& props.options.preserveLists
|
||||||
))
|
))
|
||||||
|
|
||||||
watch(() => props.options.chunkMethod, (method) => {
|
|
||||||
if (method === 'custom') advancedChunkSettingsOpen.value = true
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(() => props.chunkValidationMessage, (message) => {
|
|
||||||
if (message) advancedChunkSettingsOpen.value = true
|
|
||||||
})
|
|
||||||
|
|
||||||
function updateField<K extends keyof UnstructuredProcessOptions>(
|
function updateField<K extends keyof UnstructuredProcessOptions>(
|
||||||
field: K,
|
field: K,
|
||||||
value: UnstructuredProcessOptions[K],
|
value: UnstructuredProcessOptions[K],
|
||||||
@@ -117,7 +105,7 @@ function updateUnstructuredNumber(field: UnstructuredNumberField, value: number
|
|||||||
}
|
}
|
||||||
|
|
||||||
function revealValidation() {
|
function revealValidation() {
|
||||||
advancedChunkSettingsOpen.value = true
|
// Advanced settings are now flattened, no need to open toggle
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ revealValidation })
|
defineExpose({ revealValidation })
|
||||||
@@ -131,35 +119,39 @@ defineExpose({ revealValidation })
|
|||||||
<p>默认使用推荐策略,只需决定是否需要脱敏</p>
|
<p>默认使用推荐策略,只需决定是否需要脱敏</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="generation-option-list compact-option-list">
|
<div class="preprocess-option-grid">
|
||||||
<div class="generation-option-row">
|
<label class="preprocess-option" :class="{ 'is-checked': smartPreprocessEnabled }">
|
||||||
<div class="generation-option-copy">
|
<el-checkbox
|
||||||
<strong>智能预处理</strong>
|
|
||||||
<small>自动完成内容清理、结构解析、短段合并、质量过滤、去重及上下文保留</small>
|
|
||||||
</div>
|
|
||||||
<el-switch
|
|
||||||
:model-value="smartPreprocessEnabled"
|
:model-value="smartPreprocessEnabled"
|
||||||
aria-label="智能预处理"
|
|
||||||
inline-prompt
|
|
||||||
active-text="开"
|
|
||||||
inactive-text="关"
|
|
||||||
@update:model-value="updateSmartPreprocess"
|
@update:model-value="updateSmartPreprocess"
|
||||||
/>
|
/>
|
||||||
</div>
|
<span class="preprocess-option-copy">
|
||||||
<div class="generation-option-row">
|
<strong>智能预处理</strong>
|
||||||
<div class="generation-option-copy">
|
<small>自动清理、解析、去重及保留上下文</small>
|
||||||
<strong>敏感信息脱敏</strong>
|
</span>
|
||||||
<small>处理姓名、手机号、邮箱和证件号等信息</small>
|
</label>
|
||||||
</div>
|
|
||||||
<el-switch
|
<label class="preprocess-option" :class="{ 'is-checked': desensitizeEnabled }">
|
||||||
|
<el-checkbox
|
||||||
:model-value="desensitizeEnabled"
|
:model-value="desensitizeEnabled"
|
||||||
aria-label="敏感信息脱敏"
|
|
||||||
inline-prompt
|
|
||||||
active-text="开"
|
|
||||||
inactive-text="关"
|
|
||||||
@update:model-value="updateDesensitize"
|
@update:model-value="updateDesensitize"
|
||||||
/>
|
/>
|
||||||
</div>
|
<span class="preprocess-option-copy">
|
||||||
|
<strong>敏感信息脱敏</strong>
|
||||||
|
<small>处理姓名、手机号等隐私信息</small>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="preprocess-option" :class="{ 'is-checked': preserveSpecialContentEnabled }">
|
||||||
|
<el-checkbox
|
||||||
|
:model-value="preserveSpecialContentEnabled"
|
||||||
|
@update:model-value="updateSpecialContentProtection"
|
||||||
|
/>
|
||||||
|
<span class="preprocess-option-copy">
|
||||||
|
<strong>保护表格、代码和列表</strong>
|
||||||
|
<small>避免切分点破坏特殊内容块的完整性</small>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -224,36 +216,6 @@ defineExpose({ revealValidation })
|
|||||||
</span>
|
</span>
|
||||||
<small>在相邻切片中最多重复保留的上下文,默认 100 Token</small>
|
<small>在相邻切片中最多重复保留的上下文,默认 100 Token</small>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="chunk-estimation-note">
|
|
||||||
Token 数为轻量估算值,实际长度以训练使用的模型分词器为准。
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p v-if="chunkValidationMessage" class="option-validation-message" role="alert">
|
|
||||||
{{ chunkValidationMessage }}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="advanced-settings-toggle"
|
|
||||||
:aria-expanded="advancedChunkSettingsOpen"
|
|
||||||
aria-controls="unstructured-advanced-settings"
|
|
||||||
@click="advancedChunkSettingsOpen = !advancedChunkSettingsOpen"
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
<strong>高级设置</strong>
|
|
||||||
<small>最小切片长度、自定义分隔符和特殊内容保护</small>
|
|
||||||
</span>
|
|
||||||
<i class="fa" :class="advancedChunkSettingsOpen ? 'fa-chevron-up' : 'fa-chevron-down'" />
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="advancedChunkSettingsOpen"
|
|
||||||
id="unstructured-advanced-settings"
|
|
||||||
class="advanced-settings-panel"
|
|
||||||
>
|
|
||||||
<div class="advanced-settings-grid">
|
|
||||||
<label class="config-field">
|
<label class="config-field">
|
||||||
<span class="config-field-label">最小切片长度</span>
|
<span class="config-field-label">最小切片长度</span>
|
||||||
<span class="unit-input">
|
<span class="unit-input">
|
||||||
@@ -286,21 +248,13 @@ defineExpose({ revealValidation })
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="generation-option-row advanced-protection-row">
|
<p class="chunk-estimation-note">
|
||||||
<div class="generation-option-copy">
|
Token 数为轻量估算值,实际长度以训练使用的模型分词器为准。
|
||||||
<strong>保护表格、代码和列表</strong>
|
</p>
|
||||||
<small>避免切分点破坏特殊内容块的完整性</small>
|
|
||||||
</div>
|
<p v-if="chunkValidationMessage" class="option-validation-message" role="alert">
|
||||||
<el-switch
|
{{ chunkValidationMessage }}
|
||||||
:model-value="preserveSpecialContentEnabled"
|
</p>
|
||||||
aria-label="保护表格、代码和列表"
|
|
||||||
inline-prompt
|
|
||||||
active-text="开"
|
|
||||||
inactive-text="关"
|
|
||||||
@update:model-value="updateSpecialContentProtection"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-section generation-options-section">
|
<div class="form-section generation-options-section">
|
||||||
@@ -313,25 +267,11 @@ defineExpose({ revealValidation })
|
|||||||
<div class="generation-option-list">
|
<div class="generation-option-list">
|
||||||
<GenerationOptionsPanel
|
<GenerationOptionsPanel
|
||||||
:options="options"
|
:options="options"
|
||||||
:models="generationModels"
|
|
||||||
section="quality"
|
section="quality"
|
||||||
:validation-message="validationAttempted ? generationValidationMessage : ''"
|
:validation-message="validationAttempted ? qualityValidationMessage : ''"
|
||||||
@update:options="updateGenerationOptions"
|
@update:options="updateGenerationOptions"
|
||||||
/>
|
/>
|
||||||
<div class="generation-option-row">
|
|
||||||
<div class="generation-option-copy">
|
|
||||||
<strong>语义丰富表达</strong>
|
|
||||||
<small>使用大模型将问答表述得更自然、柔和</small>
|
|
||||||
</div>
|
|
||||||
<el-switch
|
|
||||||
:model-value="options.semanticEnrichment"
|
|
||||||
aria-label="非结构化语义丰富表达"
|
|
||||||
inline-prompt
|
|
||||||
active-text="开"
|
|
||||||
inactive-text="关"
|
|
||||||
@update:model-value="updateField('semanticEnrichment', Boolean($event))"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="generation-option-row">
|
<div class="generation-option-row">
|
||||||
<div class="generation-option-copy">
|
<div class="generation-option-copy">
|
||||||
@@ -358,23 +298,6 @@ defineExpose({ revealValidation })
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-section model-options-section">
|
|
||||||
<div class="section-title-row">
|
|
||||||
<div>
|
|
||||||
<h3>大模型</h3>
|
|
||||||
<p>选择数据生成模型,并设置模型输出内容的要求</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="generation-option-list">
|
|
||||||
<GenerationOptionsPanel
|
|
||||||
:options="options"
|
|
||||||
:models="generationModels"
|
|
||||||
section="model"
|
|
||||||
:validation-message="validationAttempted ? generationValidationMessage : ''"
|
|
||||||
@update:options="updateGenerationOptions"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -419,11 +342,60 @@ defineExpose({ revealValidation })
|
|||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.compact-option-list {
|
.preprocess-option-grid {
|
||||||
gap: 8px;
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.generation-option-row {
|
.preprocess-option {
|
||||||
min-height: 58px;
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 64px;
|
||||||
|
margin-right: 0;
|
||||||
|
padding: 12px 14px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: flex-start;
|
||||||
|
border: 1px solid #e2e5ec;
|
||||||
|
border-radius: 8px;
|
||||||
|
transition: border-color 0.18s ease, background-color 0.18s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #b7b2f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-checked {
|
||||||
|
background: #fafaff;
|
||||||
|
border-color: #8b82f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-checkbox__input) {
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-checkbox__label) {
|
||||||
|
min-width: 0;
|
||||||
|
padding-left: 10px;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.preprocess-option-copy {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
strong {
|
||||||
|
color: #344054;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
color: #8a93a3;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,75 +490,8 @@ defineExpose({ revealValidation })
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.advanced-settings-toggle {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 48px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 16px;
|
|
||||||
margin-top: 12px;
|
|
||||||
padding: 10px 14px;
|
|
||||||
color: #344054;
|
|
||||||
text-align: left;
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #e2e5ec;
|
|
||||||
border-radius: 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: border-color 0.18s ease, background-color 0.18s ease;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: #f8f7ff;
|
|
||||||
border-color: #b7b2f7;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:focus-visible {
|
|
||||||
outline: 2px solid #5b50f2;
|
|
||||||
outline-offset: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> span {
|
|
||||||
display: grid;
|
|
||||||
gap: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
strong {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
small {
|
|
||||||
color: #8a93a3;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
i {
|
|
||||||
flex: 0 0 auto;
|
|
||||||
color: #7b8495;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.advanced-settings-panel {
|
|
||||||
display: grid;
|
|
||||||
gap: 12px;
|
|
||||||
margin-top: 8px;
|
|
||||||
padding: 12px;
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #e2e5ec;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.advanced-settings-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.chunk-settings-grid,
|
.chunk-settings-grid {
|
||||||
.advanced-settings-grid {
|
|
||||||
grid-template-columns: minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,10 +500,13 @@ defineExpose({ revealValidation })
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.compact-option-list .generation-option-row,
|
.compact-option-list .generation-option-row {
|
||||||
.advanced-protection-row {
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preprocess-option-grid {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
max-width: 860px;
|
max-width: 1040px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
@@ -45,11 +45,7 @@
|
|||||||
.step-item {
|
.step-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex: 1;
|
flex: none;
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
flex: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-connector {
|
.step-connector {
|
||||||
@@ -60,14 +56,14 @@
|
|||||||
transition: background-color 0.3s;
|
transition: background-color 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-item.is-completed .step-connector,
|
.step-connector.is-active {
|
||||||
.step-item.is-active .step-connector {
|
|
||||||
background-color: #5146e5;
|
background-color: #5146e5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-node {
|
.step-node {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +145,30 @@
|
|||||||
min-width: 160px;
|
min-width: 160px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1100px) {
|
||||||
|
.custom-wizard-steps {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-connector {
|
||||||
|
margin: 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-node {
|
||||||
|
gap: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-title {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-item.is-active .step-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 760px) {
|
@media (max-width: 760px) {
|
||||||
.wizard-main {
|
.wizard-main {
|
||||||
padding: 24px 20px;
|
padding: 24px 20px;
|
||||||
@@ -168,9 +188,7 @@
|
|||||||
|
|
||||||
.step-title {
|
.step-title {
|
||||||
max-width: 72px;
|
max-width: 72px;
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.35;
|
line-height: 1.35;
|
||||||
white-space: normal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wizard-footer {
|
.wizard-footer {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export type ProcessType = 'structured' | 'unstructured' | 'external'
|
export type ProcessType = 'structured' | 'unstructured' | 'external'
|
||||||
|
|
||||||
export type StepId = 'create' | 'upload' | 'preview' | 'generate' | 'results'
|
export type StepId = 'create' | 'model' | 'upload' | 'preview' | 'generate' | 'results'
|
||||||
|
|
||||||
export type PreprocessOption =
|
export type PreprocessOption =
|
||||||
| 'clean_invalid'
|
| 'clean_invalid'
|
||||||
|
|||||||
@@ -94,9 +94,9 @@ export function useDataProcessDraft(bindings: DraftBindings) {
|
|||||||
bindings.goToStep('create')
|
bindings.goToStep('create')
|
||||||
bindings.task.name = snapshot.task?.name || ''
|
bindings.task.name = snapshot.task?.name || ''
|
||||||
bindings.task.description = snapshot.task?.description || ''
|
bindings.task.description = snapshot.task?.description || ''
|
||||||
bindings.processType.value = snapshot.processType === 'structured' || snapshot.processType === 'external'
|
bindings.processType.value = snapshot.processType === 'unstructured' || snapshot.processType === 'external'
|
||||||
? snapshot.processType
|
? snapshot.processType
|
||||||
: 'unstructured'
|
: 'structured'
|
||||||
|
|
||||||
if (snapshot.structuredOptions) {
|
if (snapshot.structuredOptions) {
|
||||||
bindings.structuredOptions.value = {
|
bindings.structuredOptions.value = {
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import { ElMessage } from 'element-plus'
|
|||||||
import PageCard from '@/components/PageCard.vue'
|
import PageCard from '@/components/PageCard.vue'
|
||||||
import EvalTaskSetupStep, { type EvalTaskSetupDraft } from './create/EvalTaskSetupStep.vue'
|
import EvalTaskSetupStep, { type EvalTaskSetupDraft } from './create/EvalTaskSetupStep.vue'
|
||||||
import EvalRuleSetupStep, { type EvalRuleSetupDraft } from './create/EvalRuleSetupStep.vue'
|
import EvalRuleSetupStep, { type EvalRuleSetupDraft } from './create/EvalRuleSetupStep.vue'
|
||||||
import { createDimension, getDimensionList, startEval } from '@/api/modules/eval'
|
import BasicMetricSetupStep, { type BasicMetricSetupDraft } from './create/BasicMetricSetupStep.vue'
|
||||||
|
import StartEvalStep from './create/StartEvalStep.vue'
|
||||||
|
import { createDimension, startEval } from '@/api/modules/eval'
|
||||||
import { getTrainedModels, getModelList } from '@/api/modules/model'
|
import { getTrainedModels, getModelList } from '@/api/modules/model'
|
||||||
import { getDatasetList } from '@/api/modules/dataset'
|
import { getDatasetList } from '@/api/modules/dataset'
|
||||||
import { getSystemInfo } from '@/api/modules/system'
|
import { getSystemInfo } from '@/api/modules/system'
|
||||||
@@ -19,15 +21,17 @@ const submitting = ref(false)
|
|||||||
const currentStep = ref(0)
|
const currentStep = ref(0)
|
||||||
const taskStepRef = ref<StepExposed>()
|
const taskStepRef = ref<StepExposed>()
|
||||||
const ruleStepRef = ref<StepExposed>()
|
const ruleStepRef = ref<StepExposed>()
|
||||||
|
const basicMetricStepRef = ref<StepExposed>()
|
||||||
|
|
||||||
const WIZARD_STEPS = [
|
const WIZARD_STEPS = [
|
||||||
{ title: '任务配置', description: '选择模型、算力与评测数据' },
|
{ title: '任务配置', description: '选择模型、算力与评测数据' },
|
||||||
{ title: '评测规则', description: '选择或创建评测维度' },
|
{ title: '大模型评测指标', description: '配置评测模型、方式与标准' },
|
||||||
|
{ title: '基础评测指标', description: '选择 BLEU、ROUGE 等参考指标' },
|
||||||
|
{ title: '开始评测', description: '确认配置并启动评测任务' },
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
const trainedModels = ref<TrainedModel[]>([])
|
const trainedModels = ref<TrainedModel[]>([])
|
||||||
const evalDatasets = ref<DatasetItem[]>([])
|
const evalDatasets = ref<DatasetItem[]>([])
|
||||||
const dimensions = ref<Dimension[]>([])
|
|
||||||
const evalModels = ref<ModelItem[]>([])
|
const evalModels = ref<ModelItem[]>([])
|
||||||
const gpus = ref<GpuInfo[]>([])
|
const gpus = ref<GpuInfo[]>([])
|
||||||
const createdDimensionId = ref<string | number>('')
|
const createdDimensionId = ref<string | number>('')
|
||||||
@@ -42,9 +46,6 @@ const taskForm = ref<EvalTaskSetupDraft>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const ruleForm = ref<EvalRuleSetupDraft>({
|
const ruleForm = ref<EvalRuleSetupDraft>({
|
||||||
ruleMode: 'new',
|
|
||||||
dimension_id: '',
|
|
||||||
newDimension: {
|
|
||||||
type: '',
|
type: '',
|
||||||
description: '',
|
description: '',
|
||||||
eval_model: '',
|
eval_model: '',
|
||||||
@@ -57,11 +58,19 @@ const ruleForm = ref<EvalRuleSetupDraft>({
|
|||||||
score_min: 0,
|
score_min: 0,
|
||||||
score_max: 5,
|
score_max: 5,
|
||||||
pass_threshold: 3,
|
pass_threshold: 3,
|
||||||
},
|
})
|
||||||
|
|
||||||
|
const basicMetricForm = ref<BasicMetricSetupDraft>({
|
||||||
|
bleu_enabled: false,
|
||||||
|
bleu_n: 4,
|
||||||
|
rouge_enabled: false,
|
||||||
|
rouge_methods: ['rouge_1', 'rouge_2'],
|
||||||
|
cosine_enabled: false,
|
||||||
|
output_precision: 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => ruleForm.value.newDimension,
|
ruleForm,
|
||||||
() => {
|
() => {
|
||||||
createdDimensionId.value = ''
|
createdDimensionId.value = ''
|
||||||
},
|
},
|
||||||
@@ -72,20 +81,18 @@ async function loadData() {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
const results = await Promise.allSettled([
|
const results = await Promise.allSettled([
|
||||||
getTrainedModels(),
|
getTrainedModels(),
|
||||||
getDimensionList(),
|
|
||||||
getDatasetList(),
|
getDatasetList(),
|
||||||
getSystemInfo(),
|
getSystemInfo(),
|
||||||
getModelList(),
|
getModelList(),
|
||||||
])
|
])
|
||||||
|
|
||||||
if (results[0].status === 'fulfilled') trainedModels.value = results[0].value?.models || []
|
if (results[0].status === 'fulfilled') trainedModels.value = results[0].value?.models || []
|
||||||
if (results[1].status === 'fulfilled') dimensions.value = results[1].value || []
|
if (results[1].status === 'fulfilled') {
|
||||||
if (results[2].status === 'fulfilled') {
|
evalDatasets.value = (results[1].value || []).filter((dataset) => dataset.type === 'eval')
|
||||||
evalDatasets.value = (results[2].value || []).filter((dataset) => dataset.type === 'eval')
|
|
||||||
}
|
}
|
||||||
if (results[3].status === 'fulfilled') gpus.value = results[3].value?.gpu || []
|
if (results[2].status === 'fulfilled') gpus.value = results[2].value?.gpu || []
|
||||||
if (results[4].status === 'fulfilled') {
|
if (results[3].status === 'fulfilled') {
|
||||||
evalModels.value = (results[4].value || []).filter((model) => model.purpose === 'evaluation')
|
evalModels.value = (results[3].value || []).filter((model) => model.purpose === 'evaluation')
|
||||||
}
|
}
|
||||||
|
|
||||||
const failedCount = results.filter((result) => result.status === 'rejected').length
|
const failedCount = results.filter((result) => result.status === 'rejected').length
|
||||||
@@ -95,25 +102,19 @@ async function loadData() {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function buildDimensionPayload() {
|
function buildDimensionPayload() {
|
||||||
const draft = ruleForm.value.newDimension
|
const draft = ruleForm.value
|
||||||
const payload: Partial<Dimension> = {
|
const payload: Partial<Dimension> = {
|
||||||
name: `Custom_Dim_${Date.now()}`,
|
name: `Custom_Dim_${Date.now()}`,
|
||||||
type: draft.type,
|
type: draft.type,
|
||||||
description: draft.description,
|
description: draft.description,
|
||||||
eval_model: draft.type === 'text_similarity' ? undefined : draft.eval_model,
|
eval_model: draft.eval_model,
|
||||||
eval_method: draft.eval_method,
|
eval_method: draft.eval_method,
|
||||||
eval_prompt: draft.type === 'text_similarity' ? undefined : draft.eval_prompt,
|
eval_prompt: draft.eval_prompt,
|
||||||
is_active: draft.is_active,
|
is_active: draft.is_active,
|
||||||
is_default: draft.is_default,
|
is_default: draft.is_default,
|
||||||
create_time: new Date().toISOString(),
|
create_time: new Date().toISOString(),
|
||||||
}
|
}
|
||||||
if (draft.type === 'text_similarity') {
|
|
||||||
payload.bleu_n = draft.bleu_n
|
|
||||||
payload.output_precision = draft.output_precision
|
|
||||||
}
|
|
||||||
if (draft.type === 'metric') {
|
if (draft.type === 'metric') {
|
||||||
payload.score_min = draft.score_min
|
payload.score_min = draft.score_min
|
||||||
payload.score_max = draft.score_max
|
payload.score_max = draft.score_max
|
||||||
@@ -123,8 +124,6 @@ function buildDimensionPayload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function resolveDimensionId() {
|
async function resolveDimensionId() {
|
||||||
if (ruleForm.value.ruleMode === 'baseline') return ''
|
|
||||||
if (ruleForm.value.ruleMode === 'existing') return ruleForm.value.dimension_id
|
|
||||||
if (createdDimensionId.value !== '') return createdDimensionId.value
|
if (createdDimensionId.value !== '') return createdDimensionId.value
|
||||||
|
|
||||||
const created = await createDimension(buildDimensionPayload())
|
const created = await createDimension(buildDimensionPayload())
|
||||||
@@ -137,24 +136,32 @@ async function resolveDimensionId() {
|
|||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
if (loading.value || submitting.value) return
|
if (loading.value || submitting.value) return
|
||||||
const ruleValid = await ruleStepRef.value?.validate()
|
|
||||||
if (!ruleValid) {
|
|
||||||
ElMessage.warning('请检查并完善评测规则')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
try {
|
try {
|
||||||
const dimensionId = await resolveDimensionId()
|
const dimensionId = await resolveDimensionId()
|
||||||
await startEval({
|
await startEval({
|
||||||
eval_task_name: taskForm.value.eval_task_name,
|
eval_task_name: taskForm.value.eval_task_name,
|
||||||
eval_type: ruleForm.value.ruleMode === 'baseline' ? 'baseline' : 'custom',
|
eval_type: 'custom',
|
||||||
model_id: taskForm.value.model_id,
|
model_id: taskForm.value.model_id,
|
||||||
gpu_id: taskForm.value.gpu_id,
|
gpu_id: taskForm.value.gpu_id,
|
||||||
dataset_id: taskForm.value.data_source === 'dataset' ? taskForm.value.dataset_id : '',
|
dataset_id: taskForm.value.data_source === 'dataset' ? taskForm.value.dataset_id : '',
|
||||||
dimension_id: dimensionId,
|
dimension_id: dimensionId,
|
||||||
data_source: taskForm.value.data_source,
|
data_source: taskForm.value.data_source,
|
||||||
leaderboard: taskForm.value.leaderboard,
|
leaderboard: taskForm.value.leaderboard,
|
||||||
|
basic_metrics: {
|
||||||
|
bleu: {
|
||||||
|
enabled: basicMetricForm.value.bleu_enabled,
|
||||||
|
ngram: basicMetricForm.value.bleu_n,
|
||||||
|
},
|
||||||
|
rouge: {
|
||||||
|
enabled: basicMetricForm.value.rouge_enabled,
|
||||||
|
methods: basicMetricForm.value.rouge_methods,
|
||||||
|
},
|
||||||
|
cosine: {
|
||||||
|
enabled: basicMetricForm.value.cosine_enabled,
|
||||||
|
},
|
||||||
|
output_precision: basicMetricForm.value.output_precision,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
ElMessage.success('评测任务已创建并启动')
|
ElMessage.success('评测任务已创建并启动')
|
||||||
router.push('/model-eval')
|
router.push('/model-eval')
|
||||||
@@ -168,17 +175,33 @@ async function handleSubmit() {
|
|||||||
|
|
||||||
async function handleNext() {
|
async function handleNext() {
|
||||||
if (loading.value || submitting.value) return
|
if (loading.value || submitting.value) return
|
||||||
|
if (currentStep.value === 0) {
|
||||||
const taskValid = await taskStepRef.value?.validate()
|
const taskValid = await taskStepRef.value?.validate()
|
||||||
if (!taskValid) {
|
if (!taskValid) {
|
||||||
ElMessage.warning('请检查并完善任务配置')
|
ElMessage.warning('请检查并完善任务配置')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
currentStep.value = 1
|
}
|
||||||
|
if (currentStep.value === 1) {
|
||||||
|
const ruleValid = await ruleStepRef.value?.validate()
|
||||||
|
if (!ruleValid) {
|
||||||
|
ElMessage.warning('请检查并完善大模型评测指标')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentStep.value === 2) {
|
||||||
|
const basicMetricValid = await basicMetricStepRef.value?.validate()
|
||||||
|
if (!basicMetricValid) {
|
||||||
|
ElMessage.warning('请检查并完善基础评测指标')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentStep.value = Math.min(currentStep.value + 1, WIZARD_STEPS.length - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleBack() {
|
function handleBack() {
|
||||||
if (submitting.value) return
|
if (submitting.value) return
|
||||||
currentStep.value = 0
|
currentStep.value = Math.max(currentStep.value - 1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
@@ -189,22 +212,29 @@ onMounted(loadData)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PageCard title="新建评测任务" subtitle="完成任务配置与评测规则设置后启动评测">
|
<PageCard
|
||||||
|
title="新建评测任务"
|
||||||
|
subtitle="依次配置任务、大模型评测指标与基础评测指标,确认后开始评测"
|
||||||
|
>
|
||||||
<div class="create-wizard-layout">
|
<div class="create-wizard-layout">
|
||||||
<main v-loading="loading" class="wizard-main">
|
<main v-loading="loading" class="wizard-main">
|
||||||
<div class="wizard-steps-container" aria-label="评测任务创建步骤">
|
<div class="wizard-steps-container" aria-label="评测任务创建步骤">
|
||||||
<div class="custom-wizard-steps">
|
<div class="custom-wizard-steps">
|
||||||
|
<template v-for="(step, index) in WIZARD_STEPS" :key="step.title">
|
||||||
|
<div
|
||||||
|
v-if="index !== 0"
|
||||||
|
class="step-connector"
|
||||||
|
:class="{ 'is-active': currentStep >= index }"
|
||||||
|
></div>
|
||||||
<div
|
<div
|
||||||
v-for="(step, index) in WIZARD_STEPS"
|
|
||||||
:key="step.title"
|
|
||||||
class="step-item"
|
class="step-item"
|
||||||
:class="{
|
:class="{
|
||||||
'is-active': currentStep === index,
|
'is-active': currentStep === index,
|
||||||
'is-completed': currentStep > index,
|
'is-completed': currentStep > index,
|
||||||
}"
|
}"
|
||||||
:aria-current="currentStep === index ? 'step' : undefined"
|
:aria-current="currentStep === index ? 'step' : undefined"
|
||||||
|
:aria-label="`${index + 1}. ${step.title}:${step.description}`"
|
||||||
>
|
>
|
||||||
<div v-if="index !== 0" class="step-connector"></div>
|
|
||||||
<div class="step-node">
|
<div class="step-node">
|
||||||
<div class="step-icon" aria-hidden="true">
|
<div class="step-icon" aria-hidden="true">
|
||||||
<i v-if="currentStep > index" class="fa fa-check" />
|
<i v-if="currentStep > index" class="fa fa-check" />
|
||||||
@@ -216,6 +246,7 @@ onMounted(loadData)
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -231,37 +262,53 @@ onMounted(loadData)
|
|||||||
:disabled="submitting"
|
:disabled="submitting"
|
||||||
/>
|
/>
|
||||||
<EvalRuleSetupStep
|
<EvalRuleSetupStep
|
||||||
v-else
|
v-else-if="currentStep === 1"
|
||||||
ref="ruleStepRef"
|
ref="ruleStepRef"
|
||||||
v-model="ruleForm"
|
v-model="ruleForm"
|
||||||
:dimensions="dimensions"
|
|
||||||
:eval-models="evalModels"
|
:eval-models="evalModels"
|
||||||
:loading="loading"
|
|
||||||
:disabled="submitting"
|
:disabled="submitting"
|
||||||
/>
|
/>
|
||||||
|
<BasicMetricSetupStep
|
||||||
|
v-else-if="currentStep === 2"
|
||||||
|
ref="basicMetricStepRef"
|
||||||
|
v-model="basicMetricForm"
|
||||||
|
:disabled="submitting"
|
||||||
|
/>
|
||||||
|
<StartEvalStep
|
||||||
|
v-else
|
||||||
|
:task="taskForm"
|
||||||
|
:llm-metric="ruleForm"
|
||||||
|
:basic-metrics="basicMetricForm"
|
||||||
|
:trained-models="trainedModels"
|
||||||
|
:eval-datasets="evalDatasets"
|
||||||
|
:eval-models="evalModels"
|
||||||
|
:gpus="gpus"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="wizard-footer">
|
<footer class="wizard-footer">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="currentStep === 1"
|
v-if="currentStep > 0"
|
||||||
class="footer-back"
|
class="footer-back"
|
||||||
:disabled="submitting"
|
:disabled="submitting"
|
||||||
@click="handleBack"
|
@click="handleBack"
|
||||||
>
|
>
|
||||||
<i class="fa fa-arrow-left footer-button-icon" />返回:任务配置
|
<i class="fa fa-arrow-left footer-button-icon" />返回:{{ WIZARD_STEPS[currentStep - 1].title }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-else class="footer-back" :disabled="submitting" @click="handleCancel">
|
<el-button v-else class="footer-back" :disabled="submitting" @click="handleCancel">
|
||||||
取消
|
取消
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
v-if="currentStep === 0"
|
v-if="currentStep < WIZARD_STEPS.length - 1"
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="loading || submitting"
|
:disabled="loading || submitting"
|
||||||
@click="handleNext"
|
@click="handleNext"
|
||||||
>
|
>
|
||||||
下一步:评测规则<i class="fa fa-arrow-right footer-button-icon is-right" />
|
下一步:{{ WIZARD_STEPS[currentStep + 1].title }}<i
|
||||||
|
class="fa fa-arrow-right footer-button-icon is-right"
|
||||||
|
/>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-else
|
v-else
|
||||||
@@ -270,7 +317,7 @@ onMounted(loadData)
|
|||||||
:disabled="loading || submitting"
|
:disabled="loading || submitting"
|
||||||
@click="handleSubmit"
|
@click="handleSubmit"
|
||||||
>
|
>
|
||||||
创建并启动评测
|
开始评测
|
||||||
</el-button>
|
</el-button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
@@ -301,31 +348,26 @@ onMounted(loadData)
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
max-width: 760px;
|
max-width: 1120px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-item {
|
.step-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-item:first-child {
|
|
||||||
flex: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-connector {
|
.step-connector {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
margin: 0 20px;
|
margin: 0 12px;
|
||||||
background: #e2e8f0;
|
background: #e2e8f0;
|
||||||
transition: background-color 0.2s ease;
|
transition: background-color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-item.is-active .step-connector,
|
.step-connector.is-active {
|
||||||
.step-item.is-completed .step-connector {
|
|
||||||
background: #5146e5;
|
background: #5146e5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,6 +457,12 @@ onMounted(loadData)
|
|||||||
margin-left: 6px;
|
margin-left: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1100px) {
|
||||||
|
.step-description {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 760px) {
|
@media (max-width: 760px) {
|
||||||
.wizard-main {
|
.wizard-main {
|
||||||
padding: 24px 20px;
|
padding: 24px 20px;
|
||||||
@@ -425,10 +473,10 @@ onMounted(loadData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
.step-connector {
|
.step-connector {
|
||||||
margin: 0 10px;
|
margin: 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-description {
|
.step-text {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,19 +21,28 @@ export interface DimensionFormDraft {
|
|||||||
pass_threshold: number
|
pass_threshold: number
|
||||||
}
|
}
|
||||||
|
|
||||||
withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
evalModels: ModelItem[]
|
evalModels: ModelItem[]
|
||||||
showDescription?: boolean
|
showDescription?: boolean
|
||||||
|
showStatusSettings?: boolean
|
||||||
|
allowedTypes?: DimensionType[]
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
showDescription: true,
|
showDescription: true,
|
||||||
|
showStatusSettings: true,
|
||||||
|
allowedTypes: () => ['classification', 'metric', 'text_similarity'],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const form = defineModel<DimensionFormDraft>({ required: true })
|
const form = defineModel<DimensionFormDraft>({ required: true })
|
||||||
|
const SCORE_STEP = 0.5
|
||||||
|
|
||||||
const typeOptions = Object.entries(DIMENSION_TYPE_MAP).map(([value, label]) => ({ value, label }))
|
const typeOptions = computed(() =>
|
||||||
|
Object.entries(DIMENSION_TYPE_MAP)
|
||||||
|
.filter(([value]) => props.allowedTypes.includes(value as DimensionType))
|
||||||
|
.map(([value, label]) => ({ value, label })),
|
||||||
|
)
|
||||||
const currentMethods = computed(() => (form.value.type ? EVAL_METHODS[form.value.type] || [] : []))
|
const currentMethods = computed(() => (form.value.type ? EVAL_METHODS[form.value.type] || [] : []))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,6 +74,23 @@ watch(
|
|||||||
},
|
},
|
||||||
{ flush: 'sync' },
|
{ flush: 'sync' },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** 始终保持评分区间合法,并把通过阈值收敛到当前区间内。 */
|
||||||
|
watch(
|
||||||
|
() => [form.value.type, form.value.score_min, form.value.score_max] as const,
|
||||||
|
([type, scoreMin, scoreMax]) => {
|
||||||
|
if (type !== 'metric') return
|
||||||
|
if (scoreMax <= scoreMin) {
|
||||||
|
form.value.score_max = scoreMin + SCORE_STEP
|
||||||
|
return
|
||||||
|
}
|
||||||
|
form.value.pass_threshold = Math.min(
|
||||||
|
Math.max(form.value.pass_threshold, scoreMin),
|
||||||
|
scoreMax,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{ flush: 'sync' },
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -134,13 +160,24 @@ watch(
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="form.type === 'metric'">
|
<template v-if="form.type === 'metric'">
|
||||||
<el-form-item label="评分最小值">
|
<el-form-item label="评分最小值" prop="score_min">
|
||||||
<el-input-number v-model="form.score_min" :min="0" :step="1" style="width: 160px" />
|
<el-input-number
|
||||||
|
v-model="form.score_min"
|
||||||
|
:min="0"
|
||||||
|
:max="Math.max(form.score_max - SCORE_STEP, 0)"
|
||||||
|
:step="SCORE_STEP"
|
||||||
|
style="width: 160px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="评分最大值">
|
<el-form-item label="评分最大值" prop="score_max">
|
||||||
<el-input-number v-model="form.score_max" :min="0" :step="1" style="width: 160px" />
|
<el-input-number
|
||||||
|
v-model="form.score_max"
|
||||||
|
:min="form.score_min + SCORE_STEP"
|
||||||
|
:step="SCORE_STEP"
|
||||||
|
style="width: 160px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="通过阈值">
|
<el-form-item label="通过阈值" prop="pass_threshold">
|
||||||
<div style="width: 100%">
|
<div style="width: 100%">
|
||||||
<el-slider
|
<el-slider
|
||||||
v-model="form.pass_threshold"
|
v-model="form.pass_threshold"
|
||||||
@@ -154,12 +191,14 @@ watch(
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="showStatusSettings">
|
||||||
<el-form-item label="启用该维度">
|
<el-form-item label="启用该维度">
|
||||||
<el-switch v-model="form.is_active" />
|
<el-switch v-model="form.is_active" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设为默认">
|
<el-form-item label="设为默认">
|
||||||
<el-switch v-model="form.is_default" />
|
<el-switch v-model="form.is_default" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -1,49 +1,31 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import DimensionFormFields, { type DimensionFormDraft } from './DimensionFormFields.vue'
|
import DimensionFormFields, { type DimensionFormDraft } from './DimensionFormFields.vue'
|
||||||
import type { Dimension, ModelItem } from '@/types'
|
import type { DimensionType, ModelItem } from '@/types'
|
||||||
|
|
||||||
export type EvalRuleMode = 'existing' | 'new' | 'baseline'
|
export type EvalRuleSetupDraft = DimensionFormDraft
|
||||||
|
|
||||||
export interface EvalRuleSetupDraft {
|
defineProps<{
|
||||||
ruleMode: EvalRuleMode
|
|
||||||
dimension_id: string | number
|
|
||||||
newDimension: DimensionFormDraft
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
dimensions: Dimension[]
|
|
||||||
evalModels: ModelItem[]
|
evalModels: ModelItem[]
|
||||||
loading?: boolean
|
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const form = defineModel<EvalRuleSetupDraft>({ required: true })
|
const form = defineModel<EvalRuleSetupDraft>({ required: true })
|
||||||
const existingFormRef = ref<FormInstance>()
|
|
||||||
const newFormRef = ref<FormInstance>()
|
const newFormRef = ref<FormInstance>()
|
||||||
|
const LLM_METRIC_TYPES: DimensionType[] = ['classification', 'metric']
|
||||||
const existingRules: FormRules = {
|
|
||||||
dimension_id: [{ required: true, message: '请选择评测维度', trigger: 'change' }],
|
|
||||||
}
|
|
||||||
|
|
||||||
const dimensionRules: FormRules<DimensionFormDraft> = {
|
const dimensionRules: FormRules<DimensionFormDraft> = {
|
||||||
type: [{ required: true, message: '请选择指标类型', trigger: 'change' }],
|
type: [{ required: true, message: '请选择大模型评测指标类型', trigger: 'change' }],
|
||||||
eval_model: [{ required: true, message: '请选择大模型', trigger: 'change' }],
|
eval_model: [{ required: true, message: '请选择评测大模型', trigger: 'change' }],
|
||||||
eval_method: [{ required: true, message: '请选择评估方式', trigger: 'change' }],
|
eval_method: [{ required: true, message: '请选择评估方式', trigger: 'change' }],
|
||||||
eval_prompt: [{ required: true, message: '请填写评估 Prompt', trigger: 'blur' }],
|
eval_prompt: [{ required: true, message: '请填写评估 Prompt', trigger: 'blur' }],
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedDimension = computed(() =>
|
|
||||||
props.dimensions.find((dimension) => String(dimension.id) === String(form.value.dimension_id)),
|
|
||||||
)
|
|
||||||
|
|
||||||
async function validate() {
|
async function validate() {
|
||||||
const target = newFormRef.value
|
if (!newFormRef.value) return false
|
||||||
if (!target) return false
|
|
||||||
try {
|
try {
|
||||||
const valid = await target.validate()
|
return !!(await newFormRef.value.validate())
|
||||||
return !!valid
|
|
||||||
} catch {
|
} catch {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -56,7 +38,7 @@ defineExpose({ validate })
|
|||||||
<div class="rule-step">
|
<div class="rule-step">
|
||||||
<el-form
|
<el-form
|
||||||
ref="newFormRef"
|
ref="newFormRef"
|
||||||
:model="form.newDimension"
|
:model="form"
|
||||||
:rules="dimensionRules"
|
:rules="dimensionRules"
|
||||||
label-width="130px"
|
label-width="130px"
|
||||||
class="step-form step-form-wide"
|
class="step-form step-form-wide"
|
||||||
@@ -64,17 +46,17 @@ defineExpose({ validate })
|
|||||||
scroll-to-error
|
scroll-to-error
|
||||||
>
|
>
|
||||||
<DimensionFormFields
|
<DimensionFormFields
|
||||||
v-model="form.newDimension"
|
v-model="form"
|
||||||
:eval-models="evalModels"
|
:eval-models="evalModels"
|
||||||
:show-description="false"
|
:show-description="false"
|
||||||
|
:show-status-settings="false"
|
||||||
|
:allowed-types="LLM_METRIC_TYPES"
|
||||||
/>
|
/>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
.step-form {
|
.step-form {
|
||||||
max-width: 760px;
|
max-width: 760px;
|
||||||
}
|
}
|
||||||
@@ -82,6 +64,4 @@ defineExpose({ validate })
|
|||||||
.step-form-wide {
|
.step-form-wide {
|
||||||
max-width: 920px;
|
max-width: 920px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user