Compare commits
14 Commits
aea0d51b44
...
server
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
746d1118df | ||
|
|
6e1197d321 | ||
|
|
a70cf6addd | ||
|
|
8b83b8facf | ||
|
|
e09c6e81df | ||
|
|
2bceb686c6 | ||
|
|
acbd6d91b3 | ||
|
|
762d48d090 | ||
|
|
42f2efb449 | ||
|
|
8c1a0d785c | ||
|
|
66eac77c96 | ||
|
|
d8ba048c6d | ||
|
|
c9ddc3b652 | ||
|
|
0917206191 |
102
design-qa.md
102
design-qa.md
@@ -325,3 +325,105 @@ Verification evidence:
|
|||||||
Design-QA final result: blocked
|
Design-QA final result: blocked
|
||||||
|
|
||||||
final result: blocked
|
final result: blocked
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Dataset Version Actions Design QA
|
||||||
|
|
||||||
|
## Evidence
|
||||||
|
|
||||||
|
- Source visual truth: `/Users/caoxiaozhu/.codex/generated_images/019f5e2e-3bee-77f0-b285-89ef139db56c/exec-48a163b6-d4c9-4646-9199-135957c6e72e.png`
|
||||||
|
- Historical-version implementation: `/Users/caoxiaozhu/.codex/visualizations/2026/07/14/019f5e2e-3bee-77f0-b285-89ef139db56c/dataset-version-build/implementation-historical-version-final.png`
|
||||||
|
- Delete-confirm implementation: `/Users/caoxiaozhu/.codex/visualizations/2026/07/14/019f5e2e-3bee-77f0-b285-89ef139db56c/dataset-version-build/implementation-delete-confirm.png`
|
||||||
|
- Full-view comparison: `/Users/caoxiaozhu/.codex/visualizations/2026/07/14/019f5e2e-3bee-77f0-b285-89ef139db56c/dataset-version-build/comparison-full.png`
|
||||||
|
- Focused version-control comparison: `/Users/caoxiaozhu/.codex/visualizations/2026/07/14/019f5e2e-3bee-77f0-b285-89ef139db56c/dataset-version-build/comparison-version-controls-final.png`
|
||||||
|
- Viewport: 1316 × 768 browser window; source crop normalized for the focused comparison.
|
||||||
|
- State: authenticated dataset detail, V3 current, V2 selected as a read-only historical version.
|
||||||
|
|
||||||
|
## Full-view comparison
|
||||||
|
|
||||||
|
The existing product shell, dataset summary, version selector, read-only alert, file toolbar, and sample table remain unchanged. The former standalone primary action has been replaced by one compact rounded-square overflow button at the far right of the version-control row, matching the selected hierarchy.
|
||||||
|
|
||||||
|
## Focused comparison and required fidelity surfaces
|
||||||
|
|
||||||
|
- Fonts and typography: existing system/PingFang stack, 13px labels, 12px metadata, and Element Plus menu text are preserved.
|
||||||
|
- Spacing and layout rhythm: the 40px overflow trigger aligns with the version selector and leaves the central status copy flexible; the 168px menu provides 40px action rows.
|
||||||
|
- Colors and visual tokens: the existing indigo primary token is used for the activate icon; the delete item and confirmation action use the danger token.
|
||||||
|
- Image and icon fidelity: no new raster assets are needed. Existing Font Awesome ellipsis, check-circle, and trash icons match the repository's icon system.
|
||||||
|
- Copy and content: the menu contains exactly “设为当前版本” and “删除版本”, separated visually; the confirmation names V2 and explains that current V3 is unaffected.
|
||||||
|
|
||||||
|
## Interaction checks
|
||||||
|
|
||||||
|
- Created V2 and V3 through the real edit-and-save flow, then switched from current V3 to historical V2.
|
||||||
|
- Historical records became read-only and the overflow trigger appeared; current V3 showed no history-operation trigger.
|
||||||
|
- Opening the trigger exposed exactly two accessible menu items: “设为当前版本” and “删除版本”.
|
||||||
|
- Choosing “删除版本” opened the danger confirmation dialog; cancelling returned focus without deleting data.
|
||||||
|
- Actual deletion behavior, protected-version rejection, optimistic-lock handling, and non-reused version numbers are covered by `test:dataset-preview`.
|
||||||
|
|
||||||
|
## Comparison history
|
||||||
|
|
||||||
|
### Iteration 1 — blocked
|
||||||
|
|
||||||
|
- [P2] The overflow trigger was circular while the selected mock used a small rounded square.
|
||||||
|
- [P2] The menu did not explicitly lock its target width or primary-action icon color.
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
|
||||||
|
- Replaced the circular trigger with a 40px square and 10px radius.
|
||||||
|
- Set the menu minimum width to 168px, action height to 40px, and the activate icon to the product primary color.
|
||||||
|
|
||||||
|
### Iteration 2 — passed
|
||||||
|
|
||||||
|
No actionable P0/P1/P2 differences remain. The desktop capture API does not retain the transient popup layer in screenshots, so the open-menu labels were additionally verified through the accessibility tree; exact popup shadow rendering remains a non-blocking P3 capture gap.
|
||||||
|
|
||||||
|
final result: passed
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Login Page Responsive Design QA
|
||||||
|
|
||||||
|
## Evidence
|
||||||
|
|
||||||
|
- Source visual truth: `/Users/caoxiaozhu/.codex/generated_images/019f5f3f-f7e1-7e41-9605-ea307d9f09e6/exec-d376c603-0c47-45ad-86fd-3e99c1a95ec7.png`
|
||||||
|
- Implementation route: `http://localhost:6801/login`
|
||||||
|
- Implementation screenshot: unavailable because the in-app browser runtime could not initialize in this session.
|
||||||
|
- Intended desktop viewport: 1536 × 1024.
|
||||||
|
- Intended laptop viewports: 1366 × 768 and 1280 × 720.
|
||||||
|
- State: unauthenticated login page, default username and password populated.
|
||||||
|
|
||||||
|
## Static and automated evidence
|
||||||
|
|
||||||
|
- Added a 1440px width breakpoint that shifts the split from 58/42 to 55/45 and caps the form at 440px.
|
||||||
|
- Added a short-screen breakpoint for heights up to 820px that reduces title, form, input, footer, and panel spacing without hiding the left visual.
|
||||||
|
- Kept the single-column fallback at 900px and below.
|
||||||
|
- `regression-login-layout.mjs`: passed.
|
||||||
|
- `regression-default-dashboard.mjs`: passed.
|
||||||
|
- `vue-tsc -b --noEmit`: passed.
|
||||||
|
- Vite dev transform for `LoginView.vue`: HTTP 200.
|
||||||
|
- Production build: blocked by the pre-existing missing route component `UserPermissionView.vue`, outside the login-page change.
|
||||||
|
|
||||||
|
## Required fidelity surfaces
|
||||||
|
|
||||||
|
- Fonts and typography: code uses the existing product font stack with laptop-specific display-size reductions; visual comparison remains unavailable.
|
||||||
|
- Spacing and layout rhythm: dedicated width and height media queries are present; rendered measurements remain unavailable.
|
||||||
|
- Colors and visual tokens: existing indigo tokens and the selected dark-purple visual asset are preserved.
|
||||||
|
- Image quality and asset fidelity: the generated `login-hero-flow.png` is used directly; the official `logo.png` is reused for the brand lockup.
|
||||||
|
- Copy and content: platform title, supporting copy, form labels, actions, and footer match the selected design.
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
- [P2] Browser-rendered laptop comparison unavailable
|
||||||
|
Location: login page at 1366 × 768 and 1280 × 720.
|
||||||
|
Evidence: the in-app browser runtime failed during initialization, so no implementation screenshot or side-by-side comparison could be captured.
|
||||||
|
Impact: static checks cannot prove that all visible spacing and crop details match the selected design at laptop sizes.
|
||||||
|
Fix: capture both laptop viewports in a working in-app browser session, compare them with the source, and resolve any remaining P0/P1/P2 differences.
|
||||||
|
|
||||||
|
## Comparison history
|
||||||
|
|
||||||
|
### Iteration 1 — blocked
|
||||||
|
|
||||||
|
- User reported that the initial implementation was optimized for large displays and did not compose well on laptop screens.
|
||||||
|
- Added explicit laptop-width and short-screen layout rules and passed targeted regression/type checks.
|
||||||
|
- Post-fix visual evidence remains unavailable because browser capture is blocked.
|
||||||
|
|
||||||
|
final result: blocked
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"type-check": "vue-tsc -b --noEmit",
|
"type-check": "vue-tsc -b --noEmit",
|
||||||
"test": "node scripts/run-regressions.mjs",
|
"test": "node scripts/run-regressions.mjs",
|
||||||
|
"test:login-layout": "node scripts/regression-login-layout.mjs",
|
||||||
"test:default-dashboard": "node scripts/regression-default-dashboard.mjs",
|
"test:default-dashboard": "node scripts/regression-default-dashboard.mjs",
|
||||||
"test:dashboard": "node scripts/regression-dashboard.mjs",
|
"test:dashboard": "node scripts/regression-dashboard.mjs",
|
||||||
"test:data-process-list": "node scripts/regression-data-process-list.mjs",
|
"test:data-process-list": "node scripts/regression-data-process-list.mjs",
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
"test:eval-detail": "node scripts/regression-eval-detail.mjs",
|
"test:eval-detail": "node scripts/regression-eval-detail.mjs",
|
||||||
"test:model-manage": "node scripts/regression-model-manage.mjs",
|
"test:model-manage": "node scripts/regression-model-manage.mjs",
|
||||||
"test:hardware": "node scripts/regression-hardware-dashboard.mjs",
|
"test:hardware": "node scripts/regression-hardware-dashboard.mjs",
|
||||||
|
"test:user-settings": "node scripts/regression-user-settings.mjs",
|
||||||
"test:training-log-layout": "node scripts/regression-training-log-layout.mjs",
|
"test:training-log-layout": "node scripts/regression-training-log-layout.mjs",
|
||||||
"test:fine-tune-create": "node scripts/regression-fine-tune-create-ui.mjs",
|
"test:fine-tune-create": "node scripts/regression-fine-tune-create-ui.mjs",
|
||||||
"test:page-surface": "node scripts/regression-page-surface.mjs"
|
"test:page-surface": "node scripts/regression-page-surface.mjs"
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ assert.match(
|
|||||||
|
|
||||||
assert.match(echartsSource, /import\s*\{[^}]*BarChart[^}]*\}\s*from\s*['"]echarts\/charts['"]/, 'ECharts 未注册 BarChart')
|
assert.match(echartsSource, /import\s*\{[^}]*BarChart[^}]*\}\s*from\s*['"]echarts\/charts['"]/, 'ECharts 未注册 BarChart')
|
||||||
assert.match(echartsSource, /use\(\[[\s\S]*?BarChart[\s\S]*?\]\)/, 'BarChart 未加入 ECharts 按需注册列表')
|
assert.match(echartsSource, /use\(\[[\s\S]*?BarChart[\s\S]*?\]\)/, 'BarChart 未加入 ECharts 按需注册列表')
|
||||||
|
assert.match(echartsSource, /import\s*\{[^}]*PieChart[^}]*\}\s*from\s*['"]echarts\/charts['"]/, 'ECharts 未注册 PieChart')
|
||||||
|
assert.match(echartsSource, /use\(\[[\s\S]*?PieChart[\s\S]*?\]\)/, 'PieChart 未加入 ECharts 按需注册列表')
|
||||||
|
|
||||||
for (const copy of [
|
for (const copy of [
|
||||||
'平台运行状态',
|
'平台运行状态',
|
||||||
@@ -39,16 +41,24 @@ assert.match(dashboardSource, /router\.push\(['"]\/fine-tune['"]\)/, '查看全
|
|||||||
assert.match(dashboardSource, /router\.push\(`\/training-log\/\$\{task\.id\}`\)/, '训练任务详情应进入训练日志页')
|
assert.match(dashboardSource, /router\.push\(`\/training-log\/\$\{task\.id\}`\)/, '训练任务详情应进入训练日志页')
|
||||||
assert.doesNotMatch(dashboardSource, /class=["']dashboard-heading["']/, '服务看板不应重复展示页面标题栏')
|
assert.doesNotMatch(dashboardSource, /class=["']dashboard-heading["']/, '服务看板不应重复展示页面标题栏')
|
||||||
assert.doesNotMatch(dashboardSource, /查看告警/, '服务看板不应保留冗余的顶部告警按钮')
|
assert.doesNotMatch(dashboardSource, /查看告警/, '服务看板不应保留冗余的顶部告警按钮')
|
||||||
assert.match(dashboardSource, /\.dashboard-view\s*\{[\s\S]*?gap:\s*10px;/, '服务看板应使用紧凑的区块间距')
|
assert.match(dashboardSource, /\.dashboard-view\s*\{[\s\S]*?gap:\s*16px;/, '服务看板区块间距应保持舒展')
|
||||||
assert.match(dashboardSource, /\.dashboard-middle\s*\{[\s\S]*?flex:\s*1 1 auto;[\s\S]*?min-height:\s*0;/, '中间区域应弹性占满剩余高度')
|
assert.match(dashboardSource, /\.dashboard-view\s*\{[\s\S]*?min-height:\s*100%;/, '服务看板应至少填满页面可用高度')
|
||||||
|
assert.match(dashboardSource, /\.dashboard-middle\s*\{[\s\S]*?flex:\s*0 0 auto;[\s\S]*?min-height:\s*0;/, '中间区域不应因新增统计卡片被压缩')
|
||||||
assert.match(dashboardSource, /grid-template-columns:\s*minmax\(0,\s*1\.9fr\)\s*minmax\(300px,\s*0\.82fr\);/, '服务状态列应收窄,为训练图表释放更多宽度')
|
assert.match(dashboardSource, /grid-template-columns:\s*minmax\(0,\s*1\.9fr\)\s*minmax\(300px,\s*0\.82fr\);/, '服务状态列应收窄,为训练图表释放更多宽度')
|
||||||
assert.match(dashboardSource, /\.training-chart\s*\{[\s\S]*?flex:\s*1 1 auto;[\s\S]*?height:\s*auto;[\s\S]*?min-height:\s*230px;/, '训练统计图应随可用空间自动拉伸')
|
assert.match(dashboardSource, /\.training-chart\s*\{[\s\S]*?height:\s*300px;[\s\S]*?min-height:\s*300px;/, '训练统计图应保持舒展、稳定的展示高度')
|
||||||
assert.match(dashboardSource, /@media\s*\(max-height:\s*900px\)[\s\S]*?\.training-chart\s*\{[\s\S]*?min-height:\s*200px;/, '较矮桌面视口应保留图表最小可读高度')
|
|
||||||
assert.match(dashboardSource, /\.service-table\s*\{[\s\S]*?grid-template-rows:[^;]*repeat\(4,\s*minmax\(48px,\s*1fr\)\)/, '服务状态行应随中间区域同步拉伸')
|
assert.match(dashboardSource, /\.service-table\s*\{[\s\S]*?grid-template-rows:[^;]*repeat\(4,\s*minmax\(48px,\s*1fr\)\)/, '服务状态行应随中间区域同步拉伸')
|
||||||
assert.match(dashboardSource, /\.tasks-heading\s*\{[\s\S]*?min-height:\s*32px;[\s\S]*?padding:\s*0 14px 10px;/, '训练任务标题区应适当加高')
|
assert.match(dashboardSource, /\.tasks-heading\s*\{[\s\S]*?min-height:\s*32px;[\s\S]*?padding:\s*0 14px 10px;/, '训练任务标题区应适当加高')
|
||||||
assert.match(dashboardSource, /\.tasks-table\s*\{[\s\S]*?th,\s*td\s*\{[\s\S]*?height:\s*42px;[\s\S]*?th\s*\{[\s\S]*?height:\s*36px;/, '训练任务表格行应适当加高')
|
assert.match(dashboardSource, /\.tasks-table\s*\{[\s\S]*?th,\s*td\s*\{[\s\S]*?height:\s*42px;[\s\S]*?th\s*\{[\s\S]*?height:\s*36px;/, '训练任务表格行应适当加高')
|
||||||
assert.match(dashboardSource, /@media\s*\(max-height:\s*900px\)[\s\S]*?\.tasks-heading\s*\{[\s\S]*?min-height:\s*28px;[\s\S]*?padding:\s*0 12px 8px;[\s\S]*?\.tasks-table\s*\{[\s\S]*?height:\s*36px;[\s\S]*?th\s*\{[\s\S]*?height:\s*32px;/, '低高度桌面视口也应提高训练任务占比')
|
assert.match(dashboardSource, /@media\s*\(max-height:\s*900px\)[\s\S]*?\.tasks-heading\s*\{[\s\S]*?min-height:\s*28px;[\s\S]*?padding:\s*0 12px 8px;[\s\S]*?\.tasks-table\s*\{[\s\S]*?height:\s*36px;[\s\S]*?th\s*\{[\s\S]*?height:\s*32px;/, '低高度桌面视口也应提高训练任务占比')
|
||||||
assert.match(mainLayoutSource, /\.layout-content:has\(\.dashboard-view\)[\s\S]*?overflow-y:\s*hidden;/, '服务看板容器应避免产生页面纵向滚动条')
|
assert.match(dashboardSource, /class=["']user-stats-row["'][\s\S]*?用户操作分布[\s\S]*?登录时长排行[\s\S]*?最近登录用户/, '服务看板应展示三块用户统计卡片')
|
||||||
assert.match(mainLayoutSource, /\.page-canvas\s*\{[\s\S]*?flex:\s*1 1 auto;[\s\S]*?overflow:\s*hidden;/, '服务看板页面画布应约束在可用视口内')
|
assert.match(dashboardSource, /class=["']duration-chart["'][\s\S]*?loginDurationChartOption/, '登录时长应使用 ECharts 图表展示')
|
||||||
|
assert.match(dashboardSource, /const loginDurationChartOption[\s\S]*?type:\s*['"]bar['"][\s\S]*?formatter:\s*['"]\{c\} 小时['"]/, '登录时长应以横向柱状图展示具体小时数')
|
||||||
|
assert.match(dashboardSource, /const operationChartOption[\s\S]*?position:\s*['"]outside['"][\s\S]*?labelLine:\s*\{[\s\S]*?show:\s*true/, '饼图应以外侧引导线标注操作名称')
|
||||||
|
assert.match(dashboardSource, /const loginDurationChartOption[\s\S]*?grid:\s*\{\s*top:\s*8,\s*right:\s*12,\s*bottom:\s*6,\s*left:\s*8,[\s\S]*?max:\s*Math\.ceil\(Math\.max[\s\S]*?position:\s*['"]insideRight['"]/, '登录时长图应收紧左右边距、按数据范围拉伸,并将数值置于柱内')
|
||||||
|
assert.match(dashboardSource, /\.user-stats-row\s*\{[\s\S]*?repeat\(3,\s*minmax\(0,\s*1fr\)\)/, '宽屏用户统计卡片应保持三列')
|
||||||
|
assert.match(dashboardSource, /@media\s*\(max-width:\s*1180px\)[\s\S]*?\.user-stats-row\s*\{[\s\S]*?repeat\(2,\s*minmax\(0,\s*1fr\)\)/, '中等宽度应将用户统计卡片降为两列')
|
||||||
|
assert.match(dashboardSource, /@media\s*\(max-width:\s*720px\)[\s\S]*?\.user-stats-row\s*\{[\s\S]*?grid-template-columns:\s*1fr;/, '窄屏应将用户统计卡片降为单列')
|
||||||
|
assert.match(mainLayoutSource, /\.layout-content:has\(\.dashboard-view\)[\s\S]*?overflow-y:\s*auto;/, '服务看板应允许在内容超出视口时纵向滚动')
|
||||||
|
assert.match(mainLayoutSource, /\.page-canvas\s*\{[\s\S]*?flex:\s*1 0 auto;[\s\S]*?overflow:\s*visible;/, '服务看板画布应允许新增卡片完整显示')
|
||||||
|
|
||||||
console.log('服务看板回归检查通过')
|
console.log('服务看板回归检查通过')
|
||||||
|
|||||||
@@ -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('数据处理六步向导回归检查通过')
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const mockPath = path.join(root, 'src/mock/data.ts')
|
|||||||
const recordsPath = path.join(root, 'src/views/dataset/datasetRecords.ts')
|
const recordsPath = path.join(root, 'src/views/dataset/datasetRecords.ts')
|
||||||
const versionsPath = path.join(root, 'src/mock/datasetVersions.ts')
|
const versionsPath = path.join(root, 'src/mock/datasetVersions.ts')
|
||||||
const source = fs.readFileSync(previewPath, 'utf8')
|
const source = fs.readFileSync(previewPath, 'utf8')
|
||||||
|
const previewLogicSource = source.slice(0, source.indexOf('<style'))
|
||||||
const previewComponentSources = previewComponentPaths.map((componentPath) => {
|
const previewComponentSources = previewComponentPaths.map((componentPath) => {
|
||||||
expect(fs.existsSync(componentPath), `缺少数据集预览叶子组件:${path.basename(componentPath)}`)
|
expect(fs.existsSync(componentPath), `缺少数据集预览叶子组件:${path.basename(componentPath)}`)
|
||||||
return fs.readFileSync(componentPath, 'utf8')
|
return fs.readFileSync(componentPath, 'utf8')
|
||||||
@@ -40,6 +41,7 @@ const {
|
|||||||
activateDatasetVersion,
|
activateDatasetVersion,
|
||||||
appendDatasetVersion,
|
appendDatasetVersion,
|
||||||
createInitialVersionState,
|
createInitialVersionState,
|
||||||
|
deleteDatasetVersion,
|
||||||
getActiveDatasetVersion,
|
getActiveDatasetVersion,
|
||||||
} = await import(`data:text/javascript;base64,${Buffer.from(versionsModuleCode).toString('base64')}`)
|
} = await import(`data:text/javascript;base64,${Buffer.from(versionsModuleCode).toString('base64')}`)
|
||||||
|
|
||||||
@@ -47,7 +49,7 @@ function expect(condition, message) {
|
|||||||
if (!condition) throw new Error(message)
|
if (!condition) throw new Error(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(source.split('\n').length < 800, 'DatasetPreviewView.vue 应拆分到 800 行以内')
|
expect(previewLogicSource.split('\n').length < 520, 'DatasetPreviewView.vue 的逻辑与模板应保持在 520 行以内')
|
||||||
for (const componentName of ['DatasetVersionBar', 'DatasetRecordTable', 'DatasetRecordEditorDialog', 'DatasetRawPreview']) {
|
for (const componentName of ['DatasetVersionBar', 'DatasetRecordTable', 'DatasetRecordEditorDialog', 'DatasetRawPreview']) {
|
||||||
expect(source.includes(`import ${componentName}`), `主页面未导入叶子组件:${componentName}`)
|
expect(source.includes(`import ${componentName}`), `主页面未导入叶子组件:${componentName}`)
|
||||||
expect(source.includes(`<${componentName}`), `主页面未挂载叶子组件:${componentName}`)
|
expect(source.includes(`<${componentName}`), `主页面未挂载叶子组件:${componentName}`)
|
||||||
@@ -69,7 +71,11 @@ expect(source.includes('保存版本'), '文件工具栏应提供保存版本按
|
|||||||
expect(source.includes('baseVersionContent'), '页面应区分已保存版本与待保存工作副本')
|
expect(source.includes('baseVersionContent'), '页面应区分已保存版本与待保存工作副本')
|
||||||
expect(previewSurfaceSource.includes('class="version-control-bar"'), '详情页应提供独立版本控制区')
|
expect(previewSurfaceSource.includes('class="version-control-bar"'), '详情页应提供独立版本控制区')
|
||||||
expect(previewSurfaceSource.includes('设为当前版本'), '历史版本应支持显式切换为当前版本')
|
expect(previewSurfaceSource.includes('设为当前版本'), '历史版本应支持显式切换为当前版本')
|
||||||
|
expect(previewSurfaceSource.includes('class="version-actions"'), '历史版本操作应收纳到省略号菜单')
|
||||||
|
expect(previewSurfaceSource.includes('删除版本'), '历史版本操作菜单应提供删除入口')
|
||||||
expect(previewSurfaceSource.includes('历史版本(只读)'), '历史版本应明确展示只读状态')
|
expect(previewSurfaceSource.includes('历史版本(只读)'), '历史版本应明确展示只读状态')
|
||||||
|
expect(source.includes('AppConfirmDialog'), '删除历史版本前应使用公共危险确认弹窗')
|
||||||
|
expect(source.includes("tone: 'danger'"), '删除历史版本确认弹窗应使用危险态')
|
||||||
expect(source.includes('loadedVersionId.value'), '下载和展示应绑定正在查看的具体版本')
|
expect(source.includes('loadedVersionId.value'), '下载和展示应绑定正在查看的具体版本')
|
||||||
expect(source.includes('versionRequestId'), '快速切换历史版本时应防止旧响应覆盖新内容')
|
expect(source.includes('versionRequestId'), '快速切换历史版本时应防止旧响应覆盖新内容')
|
||||||
expect(previewSurfaceSource.includes('v-model:current-page="currentPage"'), '样本列表应支持分页浏览')
|
expect(previewSurfaceSource.includes('v-model:current-page="currentPage"'), '样本列表应支持分页浏览')
|
||||||
@@ -97,7 +103,7 @@ const activateVersionStart = source.indexOf('async function activateViewedVersio
|
|||||||
const versionChangeSource = source.slice(versionChangeStart, activateVersionStart)
|
const versionChangeSource = source.slice(versionChangeStart, activateVersionStart)
|
||||||
expect(versionChangeSource.includes('resetRecordEditor()'), '成功切换版本后必须关闭并清空旧编辑器状态')
|
expect(versionChangeSource.includes('resetRecordEditor()'), '成功切换版本后必须关闭并清空旧编辑器状态')
|
||||||
expect(!source.includes('handleDownloadAll'), '页面不应保留整包下载逻辑')
|
expect(!source.includes('handleDownloadAll'), '页面不应保留整包下载逻辑')
|
||||||
expect(!source.includes('handleDelete'), '页面不应保留删除逻辑')
|
expect(!source.includes('deleteDataset('), '详情页不应恢复删除整个数据集的逻辑')
|
||||||
expect(!source.includes('router.back()'), '页面不应保留页头返回逻辑')
|
expect(!source.includes('router.back()'), '页面不应保留页头返回逻辑')
|
||||||
expect(mockSource.includes('files: ['), 'Mock 数据集应包含可验收的文件列表')
|
expect(mockSource.includes('files: ['), 'Mock 数据集应包含可验收的文件列表')
|
||||||
expect(mockSource.includes('mockDatasetPreviews'), 'Mock 数据应包含文件预览内容')
|
expect(mockSource.includes('mockDatasetPreviews'), 'Mock 数据应包含文件预览内容')
|
||||||
@@ -107,12 +113,15 @@ expect(mockSource.includes('.map((dataset)'), '所有 Mock 数据集都应自动
|
|||||||
expect(mockSource.includes(': [{ id: `dataset-${dataset.id}-samples`'), '每个 Mock 数据集应只对应一个数据文件')
|
expect(mockSource.includes(': [{ id: `dataset-${dataset.id}-samples`'), '每个 Mock 数据集应只对应一个数据文件')
|
||||||
expect(apiSource.includes('createDatasetFileVersion'), '数据集 API 应提供创建新版本方法')
|
expect(apiSource.includes('createDatasetFileVersion'), '数据集 API 应提供创建新版本方法')
|
||||||
expect(apiSource.includes('activateDatasetFileVersion'), '数据集 API 应提供切换当前版本方法')
|
expect(apiSource.includes('activateDatasetFileVersion'), '数据集 API 应提供切换当前版本方法')
|
||||||
|
expect(apiSource.includes('deleteDatasetFileVersion'), '数据集 API 应提供删除历史版本方法')
|
||||||
expect(apiSource.includes('getDatasetFileVersionContent'), '数据集 API 应支持读取历史版本内容')
|
expect(apiSource.includes('getDatasetFileVersionContent'), '数据集 API 应支持读取历史版本内容')
|
||||||
expect(apiSource.includes('expected_current_version_id'), '创建和激活版本应携带乐观锁版本指针')
|
expect(apiSource.includes('expected_current_version_id'), '创建和激活版本应携带乐观锁版本指针')
|
||||||
expect(!apiSource.includes('updateDatasetFileContent'), '数据编辑不应继续覆盖历史版本内容')
|
expect(!apiSource.includes('updateDatasetFileContent'), '数据编辑不应继续覆盖历史版本内容')
|
||||||
expect(adapterSource.includes('mock:dataset-versions:'), 'Mock 版本历史应支持刷新持久化')
|
expect(adapterSource.includes('mock:dataset-versions:'), 'Mock 版本历史应支持刷新持久化')
|
||||||
expect(adapterSource.includes('当前版本已被其他用户更新'), 'Mock 应拒绝基于过期版本的并发覆盖')
|
expect(adapterSource.includes('当前版本已被其他用户更新'), 'Mock 应拒绝基于过期版本的并发覆盖')
|
||||||
expect(adapterSource.includes('历史版本不可覆盖'), '旧的覆盖保存接口应明确拒绝修改历史版本')
|
expect(adapterSource.includes('历史版本不可覆盖'), '旧的覆盖保存接口应明确拒绝修改历史版本')
|
||||||
|
expect(versionsSource.includes('当前版本不可删除'), 'Mock 应拒绝删除当前版本')
|
||||||
|
expect(versionsSource.includes('初始版本不可删除'), 'Mock 应拒绝删除初始版本')
|
||||||
expect(adapterSource.includes('Mock 存储空间不足'), 'Mock 存储失败时应返回明确错误且保留编辑草稿')
|
expect(adapterSource.includes('Mock 存储空间不足'), 'Mock 存储失败时应返回明确错误且保留编辑草稿')
|
||||||
|
|
||||||
const jsonl = [
|
const jsonl = [
|
||||||
@@ -145,6 +154,21 @@ expect(v2State.versions[1].version === 2 && v2State.active_version_id === 'v2',
|
|||||||
const switchedToV1 = activateDatasetVersion(v2State, 'v1')
|
const switchedToV1 = activateDatasetVersion(v2State, 'v1')
|
||||||
expect(getActiveDatasetVersion(switchedToV1).content === 'A', '切换当前版本后应读取对应历史内容')
|
expect(getActiveDatasetVersion(switchedToV1).content === 'A', '切换当前版本后应读取对应历史内容')
|
||||||
expect(v2State.active_version_id === 'v2' && v2State.versions[1].content === 'B', '切换版本不得污染原状态或历史快照')
|
expect(v2State.active_version_id === 'v2' && v2State.versions[1].content === 'B', '切换版本不得污染原状态或历史快照')
|
||||||
|
const v3State = appendDatasetVersion(v2State, 'C', '2026-07-13T02:00:00Z', '修改第二条')
|
||||||
|
const deletedV2State = deleteDatasetVersion(v3State, 'v2')
|
||||||
|
expect(!deletedV2State.versions.some((item) => item.id === 'v2'), '删除历史版本后不应继续返回该版本')
|
||||||
|
expect(deletedV2State.active_version_id === 'v3', '删除历史版本不得改变当前版本指针')
|
||||||
|
const v4State = appendDatasetVersion(deletedV2State, 'D', '2026-07-13T03:00:00Z', '继续编辑')
|
||||||
|
expect(v4State.versions.at(-1)?.version === 4, '删除历史版本后不得复用旧版本号')
|
||||||
|
for (const protectedVersionId of ['v1', 'v3']) {
|
||||||
|
let protectedVersionRejected = false
|
||||||
|
try {
|
||||||
|
deleteDatasetVersion(v3State, protectedVersionId)
|
||||||
|
} catch {
|
||||||
|
protectedVersionRejected = true
|
||||||
|
}
|
||||||
|
expect(protectedVersionRejected, `${protectedVersionId} 受保护版本不得删除`)
|
||||||
|
}
|
||||||
let invalidVersionRejected = false
|
let invalidVersionRejected = false
|
||||||
try {
|
try {
|
||||||
activateDatasetVersion(v2State, 'missing')
|
activateDatasetVersion(v2State, 'missing')
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ const selfSurfaceRoutes = [
|
|||||||
'data-process',
|
'data-process',
|
||||||
'data-process/create',
|
'data-process/create',
|
||||||
'dataset',
|
'dataset',
|
||||||
|
'user-settings',
|
||||||
]
|
]
|
||||||
for (const routePath of selfSurfaceRoutes) {
|
for (const routePath of selfSurfaceRoutes) {
|
||||||
const routeBlock = extractRouteBlock(routerSource, routePath)
|
const routeBlock = extractRouteBlock(routerSource, routePath)
|
||||||
|
|||||||
@@ -72,6 +72,17 @@ export const activateDatasetFileVersion = (
|
|||||||
{ version_id: versionId, expected_current_version_id: expectedCurrentVersionId },
|
{ version_id: versionId, expected_current_version_id: expectedCurrentVersionId },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** 删除非当前、非初始的历史版本 */
|
||||||
|
export const deleteDatasetFileVersion = (
|
||||||
|
fileId: string | number,
|
||||||
|
versionId: string,
|
||||||
|
expectedCurrentVersionId: string,
|
||||||
|
) =>
|
||||||
|
del<DatasetVersionList>(
|
||||||
|
`/dataset-manage/versions/${encodeURIComponent(fileId)}/${encodeURIComponent(versionId)}`,
|
||||||
|
{ expected_current_version_id: expectedCurrentVersionId },
|
||||||
|
)
|
||||||
|
|
||||||
/** 下载文件 URL */
|
/** 下载文件 URL */
|
||||||
export const downloadFileUrl = (
|
export const downloadFileUrl = (
|
||||||
datasetId: string | number,
|
datasetId: string | number,
|
||||||
|
|||||||
@@ -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')
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
import { get, post } from '../request'
|
import { del, get, post, put } from '../request'
|
||||||
import type { SystemInfo, HealthMetrics } from '@/types'
|
import type {
|
||||||
|
CreateUserPayload,
|
||||||
|
HealthMetrics,
|
||||||
|
LoginResponse,
|
||||||
|
SystemInfo,
|
||||||
|
SystemUser,
|
||||||
|
UpdateUserAccessPayload,
|
||||||
|
} from '@/types'
|
||||||
|
|
||||||
/** 系统信息(CPU/内存/磁盘/GPU/网络/系统) */
|
/** 系统信息(CPU/内存/磁盘/GPU/网络/系统) */
|
||||||
export const getSystemInfo = () => get<SystemInfo>('/system-info')
|
export const getSystemInfo = () => get<SystemInfo>('/system-info')
|
||||||
@@ -9,4 +16,21 @@ export const getHealth = () => get<HealthMetrics>('/health')
|
|||||||
|
|
||||||
/** 登录 */
|
/** 登录 */
|
||||||
export const login = (username: string, password: string) =>
|
export const login = (username: string, password: string) =>
|
||||||
post('/login', { username, password })
|
post<LoginResponse>('/login', { username, password })
|
||||||
|
|
||||||
|
/** 用户列表 */
|
||||||
|
export const getUsers = () => get<SystemUser[]>('/users')
|
||||||
|
|
||||||
|
/** 创建用户 */
|
||||||
|
export const createUser = (payload: CreateUserPayload) =>
|
||||||
|
post<SystemUser>('/users', payload)
|
||||||
|
|
||||||
|
/** 删除用户,currentUsername 用于防止删除当前登录账号 */
|
||||||
|
export const deleteUser = (id: string, currentUsername: string) =>
|
||||||
|
del<{ deleted: string }>(`/users/${encodeURIComponent(id)}`, {
|
||||||
|
current_username: currentUsername,
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 更新用户角色、状态及页面权限 */
|
||||||
|
export const updateUserAccess = (id: string, payload: UpdateUserAccessPayload) =>
|
||||||
|
put<SystemUser>(`/users/${encodeURIComponent(id)}`, payload)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { computed, nextTick, ref, watch } from 'vue'
|
import { computed, nextTick, ref, watch } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
import type { PermissionCode } from '@/types'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -27,41 +28,65 @@ const activeMenu = computed(() => {
|
|||||||
return seg
|
return seg
|
||||||
})
|
})
|
||||||
|
|
||||||
const menuGroups = [
|
interface MenuItem {
|
||||||
|
key: string
|
||||||
|
label: string
|
||||||
|
icon: string
|
||||||
|
to: string
|
||||||
|
permission: PermissionCode
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MenuGroup {
|
||||||
|
title?: string
|
||||||
|
showTitle?: boolean
|
||||||
|
items: MenuItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const menuGroups: MenuGroup[] = [
|
||||||
{
|
{
|
||||||
// 服务看板:独立入口,不显示分类小标题
|
// 服务看板:独立入口,不显示分类小标题
|
||||||
showTitle: false,
|
showTitle: false,
|
||||||
items: [{ key: 'dashboard', label: '服务看板', icon: 'fa-tachometer', to: '/dashboard' }],
|
items: [{ key: 'dashboard', label: '服务看板', icon: 'fa-tachometer', to: '/dashboard', permission: 'dashboard' }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '模型服务',
|
title: '模型服务',
|
||||||
items: [
|
items: [
|
||||||
{ key: 'fine-tune', label: '模型微调', icon: 'fa-cogs', to: '/fine-tune' },
|
{ key: 'fine-tune', label: '模型训练', icon: 'fa-cogs', to: '/fine-tune', permission: 'fine-tune' },
|
||||||
{ key: 'model-eval', label: '模型评测', icon: 'fa-line-chart', to: '/model-eval' },
|
{ key: 'model-eval', label: '模型评测', icon: 'fa-line-chart', to: '/model-eval', permission: 'model-eval' },
|
||||||
{ key: 'model-inference', label: '模型推理', icon: 'fa-server', to: '/model-inference' },
|
{ key: 'model-inference', label: '模型推理', icon: 'fa-server', to: '/model-inference', permission: 'model-inference' },
|
||||||
{ key: 'model-manage', label: '模型管理', icon: 'fa-cube', to: '/model-manage' },
|
{ key: 'model-manage', label: '模型管理', icon: 'fa-cube', to: '/model-manage', permission: 'model-manage' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '数据治理',
|
title: '数据治理',
|
||||||
items: [
|
items: [
|
||||||
{ key: 'data-process', label: '数据处理', icon: 'fa-filter', to: '/data-process' },
|
{ key: 'dataset', label: '数据集管理', icon: 'fa-file-text', to: '/dataset', permission: 'dataset' },
|
||||||
{ key: 'dataset', label: '数据集管理', icon: 'fa-file-text', to: '/dataset' },
|
{ key: 'data-process', label: '数据处理', icon: 'fa-filter', to: '/data-process', permission: 'data-process' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '其他工具',
|
title: '其他工具',
|
||||||
items: [{ key: 'data-convert', label: '数据类型转换', icon: 'fa-exchange', to: '/data-convert' }],
|
items: [{ key: 'data-convert', label: '数据类型转换', icon: 'fa-exchange', to: '/data-convert', permission: 'data-convert' }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '系统设置',
|
title: '系统设置',
|
||||||
items: [
|
items: [
|
||||||
{ key: 'hardware', label: '平台性能', icon: 'fa-bar-chart', to: '/hardware' },
|
{ key: 'user-settings', label: '用户设置', icon: 'fa-users', to: '/user-settings', permission: 'user-settings' },
|
||||||
{ key: 'logs', label: '查看日志', icon: 'fa-file-text', to: '/logs' },
|
{ key: 'hardware', label: '平台性能', icon: 'fa-bar-chart', to: '/hardware', permission: 'hardware' },
|
||||||
|
{ key: 'logs', label: '查看日志', icon: 'fa-file-text', to: '/logs', permission: 'logs' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const visibleMenuGroups = computed(() =>
|
||||||
|
menuGroups
|
||||||
|
.map((group) => ({
|
||||||
|
...group,
|
||||||
|
items: group.items.filter((item) => auth.hasPermission(item.permission)),
|
||||||
|
}))
|
||||||
|
.filter((group) => group.items.length > 0),
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 传给 el-menu 的激活值。
|
* 传给 el-menu 的激活值。
|
||||||
*
|
*
|
||||||
@@ -78,7 +103,7 @@ watch(activeMenu, (value) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function handleSelect(key: string) {
|
async function handleSelect(key: string) {
|
||||||
const all = menuGroups.flatMap((g) => g.items)
|
const all = visibleMenuGroups.value.flatMap((g) => g.items)
|
||||||
const target = all.find((i) => i.key === key)
|
const target = all.find((i) => i.key === key)
|
||||||
if (!target) return
|
if (!target) return
|
||||||
|
|
||||||
@@ -115,7 +140,7 @@ function handleLogout() {
|
|||||||
active-text-color="var(--sidebar-active-text)"
|
active-text-color="var(--sidebar-active-text)"
|
||||||
@select="handleSelect"
|
@select="handleSelect"
|
||||||
>
|
>
|
||||||
<template v-for="group in menuGroups" :key="group.title || group.items[0].key">
|
<template v-for="group in visibleMenuGroups" :key="group.title || group.items[0].key">
|
||||||
<div v-if="group.title" class="sidebar-section-title">{{ group.title }}</div>
|
<div v-if="group.title" class="sidebar-section-title">{{ group.title }}</div>
|
||||||
<el-menu-item
|
<el-menu-item
|
||||||
v-for="item in group.items"
|
v-for="item in group.items"
|
||||||
@@ -134,8 +159,8 @@ function handleLogout() {
|
|||||||
<div class="footer-user" v-if="auth.username">
|
<div class="footer-user" v-if="auth.username">
|
||||||
<el-avatar :size="36" src="https://picsum.photos/id/1005/36/36" class="user-avatar" />
|
<el-avatar :size="36" src="https://picsum.photos/id/1005/36/36" class="user-avatar" />
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<span class="user-name">{{ auth.username }}</span>
|
<span class="user-name">{{ auth.displayName }}</span>
|
||||||
<span class="user-role">Administrator</span>
|
<span class="user-role">{{ auth.roleLabel }}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-tooltip content="退出登录" placement="top">
|
<el-tooltip content="退出登录" placement="top">
|
||||||
<div class="logout-btn" @click="handleLogout">
|
<div class="logout-btn" @click="handleLogout">
|
||||||
|
|||||||
@@ -84,13 +84,13 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
@media (min-width: 1181px) {
|
@media (min-width: 1181px) {
|
||||||
.layout-content:has(.dashboard-view) {
|
.layout-content:has(.dashboard-view) {
|
||||||
overflow-y: hidden;
|
overflow-y: auto;
|
||||||
|
|
||||||
.page-canvas {
|
.page-canvas {
|
||||||
flex: 1 1 auto;
|
flex: 1 0 auto;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
overflow: hidden;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
import type { AxiosAdapter, AxiosInstance, AxiosRequestConfig } from 'axios'
|
import type { AxiosAdapter, AxiosInstance, AxiosRequestConfig } from 'axios'
|
||||||
import {
|
import {
|
||||||
mockLoginOk,
|
|
||||||
mockHealth,
|
mockHealth,
|
||||||
mockSystemInfo,
|
mockSystemInfo,
|
||||||
mockModels,
|
mockModels,
|
||||||
@@ -27,9 +26,20 @@ import {
|
|||||||
activateDatasetVersion,
|
activateDatasetVersion,
|
||||||
appendDatasetVersion,
|
appendDatasetVersion,
|
||||||
createInitialVersionState,
|
createInitialVersionState,
|
||||||
|
deleteDatasetVersion,
|
||||||
|
DatasetVersionMutationError,
|
||||||
getActiveDatasetVersion,
|
getActiveDatasetVersion,
|
||||||
|
normalizeDatasetVersionState,
|
||||||
} from './datasetVersions'
|
} from './datasetVersions'
|
||||||
import type { StoredDatasetVersion, StoredDatasetVersionState } from './datasetVersions'
|
import type { StoredDatasetVersion, StoredDatasetVersionState } from './datasetVersions'
|
||||||
|
import {
|
||||||
|
authenticateMockUser,
|
||||||
|
createMockUser,
|
||||||
|
deleteMockUser,
|
||||||
|
listMockUsers,
|
||||||
|
updateMockUserAccess,
|
||||||
|
UserMutationError,
|
||||||
|
} from './users'
|
||||||
|
|
||||||
/** 模拟网络延迟 */
|
/** 模拟网络延迟 */
|
||||||
function delay(ms = 200): Promise<void> {
|
function delay(ms = 200): Promise<void> {
|
||||||
@@ -83,7 +93,13 @@ function getVersionState(fileId: string): StoredDatasetVersionState {
|
|||||||
if (persisted) {
|
if (persisted) {
|
||||||
try {
|
try {
|
||||||
const state = JSON.parse(persisted) as StoredDatasetVersionState
|
const state = JSON.parse(persisted) as StoredDatasetVersionState
|
||||||
if (state.versions?.length && state.active_version_id) return state
|
if (state.versions?.length && state.active_version_id) {
|
||||||
|
const normalizedState = normalizeDatasetVersionState(state)
|
||||||
|
if (state.next_version_number !== normalizedState.next_version_number) {
|
||||||
|
persistVersionState(fileId, normalizedState)
|
||||||
|
}
|
||||||
|
return normalizedState
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// 版本数据损坏时回退到初始版本
|
// 版本数据损坏时回退到初始版本
|
||||||
}
|
}
|
||||||
@@ -100,6 +116,14 @@ function versionMetadata(version: StoredDatasetVersion) {
|
|||||||
return metadata
|
return metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function versionListResponse(state: StoredDatasetVersionState) {
|
||||||
|
return {
|
||||||
|
versions: state.versions.map(versionMetadata).sort((a, b) => b.version - a.version),
|
||||||
|
active_version_id: state.active_version_id,
|
||||||
|
next_version_number: state.next_version_number,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 通过路径 + method 匹配 mock 响应 */
|
/** 通过路径 + method 匹配 mock 响应 */
|
||||||
async function handleMock(config: AxiosRequestConfig) {
|
async function handleMock(config: AxiosRequestConfig) {
|
||||||
await delay(150) // 模拟网络延迟
|
await delay(150) // 模拟网络延迟
|
||||||
@@ -111,10 +135,12 @@ async function handleMock(config: AxiosRequestConfig) {
|
|||||||
|
|
||||||
// ==================== 认证 ====================
|
// ==================== 认证 ====================
|
||||||
if (url === '/login' && method === 'post') {
|
if (url === '/login' && method === 'post') {
|
||||||
if (body.username === 'admin' && body.password === 'admin') {
|
try {
|
||||||
return ok(mockLoginOk.data)
|
return ok(authenticateMockUser(String(body.username || ''), String(body.password || '')))
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof UserMutationError) return fail(error.message, error.status)
|
||||||
|
return fail('登录失败', 500)
|
||||||
}
|
}
|
||||||
return fail('账号或密码错误', 401)
|
|
||||||
}
|
}
|
||||||
if (url === '/web-log' && method === 'post') {
|
if (url === '/web-log' && method === 'post') {
|
||||||
return ok({ received: true })
|
return ok({ received: true })
|
||||||
@@ -124,6 +150,37 @@ async function handleMock(config: AxiosRequestConfig) {
|
|||||||
if (url === '/health' && method === 'get') return ok(mockHealth)
|
if (url === '/health' && method === 'get') return ok(mockHealth)
|
||||||
if (url === '/system-info' && method === 'get') return ok(mockSystemInfo)
|
if (url === '/system-info' && method === 'get') return ok(mockSystemInfo)
|
||||||
|
|
||||||
|
// ==================== 用户设置 ====================
|
||||||
|
if (url === '/users' && method === 'get') return ok(listMockUsers())
|
||||||
|
if (url === '/users' && method === 'post') {
|
||||||
|
try {
|
||||||
|
return ok(createMockUser(body))
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof UserMutationError) return fail(error.message, error.status)
|
||||||
|
return fail('创建用户失败', 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let userMatch = url.match(/^\/users\/([^/]+)$/)
|
||||||
|
if (userMatch && method === 'put') {
|
||||||
|
try {
|
||||||
|
return ok(updateMockUserAccess(decodeURIComponent(userMatch[1]), body))
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof UserMutationError) return fail(error.message, error.status)
|
||||||
|
return fail('更新用户失败', 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (userMatch && method === 'delete') {
|
||||||
|
try {
|
||||||
|
return ok(deleteMockUser(
|
||||||
|
decodeURIComponent(userMatch[1]),
|
||||||
|
String(params.current_username || ''),
|
||||||
|
))
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof UserMutationError) return fail(error.message, error.status)
|
||||||
|
return fail('删除用户失败', 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== 模型管理 ====================
|
// ==================== 模型管理 ====================
|
||||||
if (url === '/model-manage' && method === 'get') return ok(mockModels)
|
if (url === '/model-manage' && method === 'get') return ok(mockModels)
|
||||||
if (url === '/model-manage/local-models' && method === 'get') return ok(mockLocalModels)
|
if (url === '/model-manage/local-models' && method === 'get') return ok(mockLocalModels)
|
||||||
@@ -185,10 +242,7 @@ async function handleMock(config: AxiosRequestConfig) {
|
|||||||
if (m && method === 'get') {
|
if (m && method === 'get') {
|
||||||
const fileId = decodeURIComponent(m[1])
|
const fileId = decodeURIComponent(m[1])
|
||||||
const state = getVersionState(fileId)
|
const state = getVersionState(fileId)
|
||||||
return ok({
|
return ok(versionListResponse(state))
|
||||||
versions: state.versions.map(versionMetadata).sort((a, b) => b.version - a.version),
|
|
||||||
active_version_id: state.active_version_id,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if (m && method === 'post') {
|
if (m && method === 'post') {
|
||||||
const fileId = decodeURIComponent(m[1])
|
const fileId = decodeURIComponent(m[1])
|
||||||
@@ -249,6 +303,30 @@ async function handleMock(config: AxiosRequestConfig) {
|
|||||||
? ok({ version: versionMetadata(version), content: version.content })
|
? ok({ version: versionMetadata(version), content: version.content })
|
||||||
: fail('数据集版本不存在', 404)
|
: fail('数据集版本不存在', 404)
|
||||||
}
|
}
|
||||||
|
if (m && method === 'delete') {
|
||||||
|
const fileId = decodeURIComponent(m[1])
|
||||||
|
const versionId = decodeURIComponent(m[2])
|
||||||
|
const currentState = getVersionState(fileId)
|
||||||
|
if (params.expected_current_version_id !== currentState.active_version_id) {
|
||||||
|
return fail('当前版本已被其他用户更新,请刷新后重试', 409)
|
||||||
|
}
|
||||||
|
|
||||||
|
let nextState: StoredDatasetVersionState
|
||||||
|
try {
|
||||||
|
nextState = deleteDatasetVersion(currentState, versionId)
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof DatasetVersionMutationError) {
|
||||||
|
return fail(error.message, error.status)
|
||||||
|
}
|
||||||
|
return fail('删除版本失败', 500)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
persistVersionState(fileId, nextState)
|
||||||
|
} catch {
|
||||||
|
return fail('浏览器 Mock 存储空间不足', 413)
|
||||||
|
}
|
||||||
|
return ok(versionListResponse(nextState))
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== 训练任务 ====================
|
// ==================== 训练任务 ====================
|
||||||
if (url === '/fine-tune' && method === 'get') return ok(mockFineTuneList)
|
if (url === '/fine-tune' && method === 'get') return ok(mockFineTuneList)
|
||||||
|
|||||||
@@ -9,6 +9,18 @@ export interface StoredDatasetVersion {
|
|||||||
export interface StoredDatasetVersionState {
|
export interface StoredDatasetVersionState {
|
||||||
versions: StoredDatasetVersion[]
|
versions: StoredDatasetVersion[]
|
||||||
active_version_id: string
|
active_version_id: string
|
||||||
|
/** 下次创建版本时使用的序号,确保已删除的版本号不会被复用。 */
|
||||||
|
next_version_number: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DatasetVersionMutationError extends Error {
|
||||||
|
constructor(
|
||||||
|
message: string,
|
||||||
|
readonly status: number,
|
||||||
|
) {
|
||||||
|
super(message)
|
||||||
|
this.name = 'DatasetVersionMutationError'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createInitialVersionState(
|
export function createInitialVersionState(
|
||||||
@@ -22,7 +34,24 @@ export function createInitialVersionState(
|
|||||||
description: '初始版本',
|
description: '初始版本',
|
||||||
content,
|
content,
|
||||||
}
|
}
|
||||||
return { versions: [version], active_version_id: version.id }
|
return { versions: [version], active_version_id: version.id, next_version_number: 2 }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 为旧版 localStorage 数据补齐单调递增的版本号游标。 */
|
||||||
|
export function normalizeDatasetVersionState(
|
||||||
|
state: Omit<StoredDatasetVersionState, 'next_version_number'> & {
|
||||||
|
next_version_number?: number
|
||||||
|
},
|
||||||
|
): StoredDatasetVersionState {
|
||||||
|
const minimumNextNumber = Math.max(0, ...state.versions.map((item) => item.version)) + 1
|
||||||
|
const nextVersionNumber = Number.isInteger(state.next_version_number)
|
||||||
|
? Math.max(minimumNextNumber, state.next_version_number as number)
|
||||||
|
: minimumNextNumber
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
next_version_number: nextVersionNumber,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 追加不可变版本快照,并自动把新版本设为当前版本。 */
|
/** 追加不可变版本快照,并自动把新版本设为当前版本。 */
|
||||||
@@ -32,7 +61,7 @@ export function appendDatasetVersion(
|
|||||||
createTime: string,
|
createTime: string,
|
||||||
description = '在线编辑',
|
description = '在线编辑',
|
||||||
): StoredDatasetVersionState {
|
): StoredDatasetVersionState {
|
||||||
const nextNumber = Math.max(0, ...state.versions.map((item) => item.version)) + 1
|
const nextNumber = state.next_version_number
|
||||||
const version: StoredDatasetVersion = {
|
const version: StoredDatasetVersion = {
|
||||||
id: `v${nextNumber}`,
|
id: `v${nextNumber}`,
|
||||||
version: nextNumber,
|
version: nextNumber,
|
||||||
@@ -43,6 +72,32 @@ export function appendDatasetVersion(
|
|||||||
return {
|
return {
|
||||||
versions: [...state.versions, version],
|
versions: [...state.versions, version],
|
||||||
active_version_id: version.id,
|
active_version_id: version.id,
|
||||||
|
next_version_number: nextNumber + 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除非当前、非初始的历史版本,并保留版本号游标。 */
|
||||||
|
export function deleteDatasetVersion(
|
||||||
|
state: StoredDatasetVersionState,
|
||||||
|
versionId: string,
|
||||||
|
): StoredDatasetVersionState {
|
||||||
|
const version = state.versions.find((item) => item.id === versionId)
|
||||||
|
if (!version) {
|
||||||
|
throw new DatasetVersionMutationError('数据集版本不存在', 404)
|
||||||
|
}
|
||||||
|
if (state.versions.length === 1) {
|
||||||
|
throw new DatasetVersionMutationError('唯一版本不可删除', 400)
|
||||||
|
}
|
||||||
|
if (version.id === state.active_version_id) {
|
||||||
|
throw new DatasetVersionMutationError('当前版本不可删除,请先切换到其他版本', 409)
|
||||||
|
}
|
||||||
|
if (version.version === 1) {
|
||||||
|
throw new DatasetVersionMutationError('初始版本不可删除', 400)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
versions: state.versions.filter((item) => item.id !== versionId),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
import { BarChart, LineChart } from 'echarts/charts'
|
import { BarChart, LineChart, PieChart } from 'echarts/charts'
|
||||||
import {
|
import {
|
||||||
GridComponent,
|
GridComponent,
|
||||||
TooltipComponent,
|
TooltipComponent,
|
||||||
@@ -17,6 +17,7 @@ use([
|
|||||||
CanvasRenderer,
|
CanvasRenderer,
|
||||||
BarChart,
|
BarChart,
|
||||||
LineChart,
|
LineChart,
|
||||||
|
PieChart,
|
||||||
GridComponent,
|
GridComponent,
|
||||||
TooltipComponent,
|
TooltipComponent,
|
||||||
LegendComponent,
|
LegendComponent,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
|
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
import type { PermissionCode } from '@/types'
|
||||||
|
|
||||||
const routes: RouteRecordRaw[] = [
|
const routes: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,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',
|
||||||
@@ -191,6 +192,12 @@ const routes: RouteRecordRaw[] = [
|
|||||||
meta: { title: '数据类型转换' },
|
meta: { title: '数据类型转换' },
|
||||||
},
|
},
|
||||||
// 系统设置
|
// 系统设置
|
||||||
|
{
|
||||||
|
path: 'permission-denied',
|
||||||
|
name: 'permission-denied',
|
||||||
|
component: () => import('@/views/system/PermissionDeniedView.vue'),
|
||||||
|
meta: { title: '无权访问', skipPermission: true },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'hardware',
|
path: 'hardware',
|
||||||
name: 'hardware',
|
name: 'hardware',
|
||||||
@@ -203,6 +210,24 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('@/views/system/LogsView.vue'),
|
component: () => import('@/views/system/LogsView.vue'),
|
||||||
meta: { title: '查看日志' },
|
meta: { title: '查看日志' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'user-settings',
|
||||||
|
name: 'user-settings',
|
||||||
|
component: () => import('@/views/system/UserSettingsView.vue'),
|
||||||
|
meta: { title: '用户设置', pageSurface: 'self', permission: 'user-settings' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'user-settings/create',
|
||||||
|
name: 'user-create',
|
||||||
|
component: () => import('@/views/system/UserCreateView.vue'),
|
||||||
|
meta: { title: '创建用户', permission: 'user-settings' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'user-settings/:id/permission',
|
||||||
|
name: 'user-permission',
|
||||||
|
component: () => import('@/views/system/UserPermissionView.vue'),
|
||||||
|
meta: { title: '权限设置', permission: 'user-settings' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'training-log/:id',
|
path: 'training-log/:id',
|
||||||
name: 'training-log',
|
name: 'training-log',
|
||||||
@@ -222,6 +247,29 @@ const router = createRouter({
|
|||||||
routes,
|
routes,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const permissionBySegment: Record<string, PermissionCode> = {
|
||||||
|
dashboard: 'dashboard',
|
||||||
|
'fine-tune': 'fine-tune',
|
||||||
|
'training-log': 'fine-tune',
|
||||||
|
'model-eval': 'model-eval',
|
||||||
|
'model-inference': 'model-inference',
|
||||||
|
'model-compare': 'model-inference',
|
||||||
|
'model-manage': 'model-manage',
|
||||||
|
dataset: 'dataset',
|
||||||
|
'data-process': 'data-process',
|
||||||
|
'data-convert': 'data-convert',
|
||||||
|
tools: 'data-convert',
|
||||||
|
hardware: 'hardware',
|
||||||
|
logs: 'logs',
|
||||||
|
'user-settings': 'user-settings',
|
||||||
|
}
|
||||||
|
|
||||||
|
function requiredPermission(path: string, explicit?: unknown) {
|
||||||
|
if (explicit) return explicit as PermissionCode
|
||||||
|
const segment = path.split('/')[1]
|
||||||
|
return permissionBySegment[segment]
|
||||||
|
}
|
||||||
|
|
||||||
// 全局守卫:登录校验 + 会话超时
|
// 全局守卫:登录校验 + 会话超时
|
||||||
router.beforeEach((to, _from, next) => {
|
router.beforeEach((to, _from, next) => {
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
@@ -242,6 +290,14 @@ router.beforeEach((to, _from, next) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!to.meta.skipPermission) {
|
||||||
|
const permission = requiredPermission(to.path, to.meta.permission)
|
||||||
|
if (permission && !auth.hasPermission(permission)) {
|
||||||
|
next({ name: 'permission-denied', replace: true })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 续期会话
|
// 续期会话
|
||||||
auth.refresh()
|
auth.refresh()
|
||||||
next()
|
next()
|
||||||
|
|||||||
@@ -2,13 +2,63 @@ import { defineStore } from 'pinia'
|
|||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { login as loginApi } from '@/api/modules/system'
|
import { login as loginApi } from '@/api/modules/system'
|
||||||
import { SESSION_TIMEOUT } from '@/constants'
|
import { SESSION_TIMEOUT } from '@/constants'
|
||||||
|
import type { PermissionCode, SystemUser } from '@/types'
|
||||||
|
|
||||||
|
const USER_STORAGE_KEY = 'currentUser'
|
||||||
|
|
||||||
|
const allPermissions: PermissionCode[] = [
|
||||||
|
'dashboard',
|
||||||
|
'fine-tune',
|
||||||
|
'model-eval',
|
||||||
|
'model-inference',
|
||||||
|
'model-manage',
|
||||||
|
'dataset',
|
||||||
|
'data-process',
|
||||||
|
'data-convert',
|
||||||
|
'hardware',
|
||||||
|
'logs',
|
||||||
|
'user-settings',
|
||||||
|
]
|
||||||
|
|
||||||
|
function restoreUser(): SystemUser | null {
|
||||||
|
const persisted = localStorage.getItem(USER_STORAGE_KEY)
|
||||||
|
if (persisted) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(persisted) as SystemUser
|
||||||
|
} catch {
|
||||||
|
localStorage.removeItem(USER_STORAGE_KEY)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 兼容改造前已经登录的 admin 会话。
|
||||||
|
if (localStorage.getItem('username') === 'admin') {
|
||||||
|
return {
|
||||||
|
id: 'USR-0001',
|
||||||
|
username: 'admin',
|
||||||
|
display_name: '系统管理员',
|
||||||
|
role: 'admin',
|
||||||
|
status: 'active',
|
||||||
|
permissions: allPermissions,
|
||||||
|
create_time: '2026-01-01T08:00:00+08:00',
|
||||||
|
protected: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 认证 store
|
* 认证 store
|
||||||
* 沿用原项目 localStorage 的登录时间戳 + 5 分钟会话超时机制
|
* 沿用原项目 localStorage 的登录时间戳 + 5 分钟会话超时机制
|
||||||
*/
|
*/
|
||||||
export const useAuthStore = defineStore('auth', () => {
|
export const useAuthStore = defineStore('auth', () => {
|
||||||
const username = ref<string>(localStorage.getItem('username') || '')
|
const currentUser = ref<SystemUser | null>(restoreUser())
|
||||||
|
const username = computed(() => currentUser.value?.username || '')
|
||||||
|
const displayName = computed(() => currentUser.value?.display_name || username.value)
|
||||||
|
const roleLabel = computed(() => {
|
||||||
|
if (currentUser.value?.role === 'admin') return '超级管理员'
|
||||||
|
if (currentUser.value?.role === 'operator') return '操作员'
|
||||||
|
return '观察员'
|
||||||
|
})
|
||||||
const loginTime = ref<number>(parseInt(localStorage.getItem('loginTime') || '0', 10) || 0)
|
const loginTime = ref<number>(parseInt(localStorage.getItem('loginTime') || '0', 10) || 0)
|
||||||
|
|
||||||
const isLoggedIn = computed(() => {
|
const isLoggedIn = computed(() => {
|
||||||
@@ -18,13 +68,20 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
|
|
||||||
/** 登录 */
|
/** 登录 */
|
||||||
async function login(user: string, password: string) {
|
async function login(user: string, password: string) {
|
||||||
await loginApi(user, password)
|
const response = await loginApi(user, password)
|
||||||
username.value = user
|
currentUser.value = response.user
|
||||||
loginTime.value = Date.now()
|
loginTime.value = Date.now()
|
||||||
localStorage.setItem('username', user)
|
localStorage.setItem('username', response.user.username)
|
||||||
|
localStorage.setItem(USER_STORAGE_KEY, JSON.stringify(response.user))
|
||||||
localStorage.setItem('loginTime', String(loginTime.value))
|
localStorage.setItem('loginTime', String(loginTime.value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 检查当前账号是否拥有指定模块权限。 */
|
||||||
|
function hasPermission(permission?: PermissionCode) {
|
||||||
|
if (!permission) return true
|
||||||
|
return currentUser.value?.permissions.includes(permission) ?? false
|
||||||
|
}
|
||||||
|
|
||||||
/** 续期会话(活跃时刷新) */
|
/** 续期会话(活跃时刷新) */
|
||||||
function refresh() {
|
function refresh() {
|
||||||
if (isLoggedIn.value) {
|
if (isLoggedIn.value) {
|
||||||
@@ -35,11 +92,23 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
|
|
||||||
/** 退出 */
|
/** 退出 */
|
||||||
function logout() {
|
function logout() {
|
||||||
username.value = ''
|
currentUser.value = null
|
||||||
loginTime.value = 0
|
loginTime.value = 0
|
||||||
localStorage.removeItem('username')
|
localStorage.removeItem('username')
|
||||||
|
localStorage.removeItem(USER_STORAGE_KEY)
|
||||||
localStorage.removeItem('loginTime')
|
localStorage.removeItem('loginTime')
|
||||||
}
|
}
|
||||||
|
|
||||||
return { username, loginTime, isLoggedIn, login, refresh, logout }
|
return {
|
||||||
|
currentUser,
|
||||||
|
username,
|
||||||
|
displayName,
|
||||||
|
roleLabel,
|
||||||
|
loginTime,
|
||||||
|
isLoggedIn,
|
||||||
|
hasPermission,
|
||||||
|
login,
|
||||||
|
refresh,
|
||||||
|
logout,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -124,10 +124,18 @@ body {
|
|||||||
.el-button:active {
|
.el-button:active {
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
.el-button.is-link:hover {
|
.el-button.is-link:hover,
|
||||||
|
.el-button.is-text:hover {
|
||||||
transform: none;
|
transform: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
.el-button.is-link:focus,
|
||||||
|
.el-button.is-text:focus {
|
||||||
|
background-color: transparent !important;
|
||||||
|
border-color: transparent !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* 4. 标签 (el-tag) 圆润化 */
|
/* 4. 标签 (el-tag) 圆润化 */
|
||||||
.el-tag {
|
.el-tag {
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export interface DatasetVersion {
|
|||||||
export interface DatasetVersionList {
|
export interface DatasetVersionList {
|
||||||
versions: DatasetVersion[]
|
versions: DatasetVersion[]
|
||||||
active_version_id: string
|
active_version_id: string
|
||||||
|
next_version_number?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============ 训练任务 ============
|
// ============ 训练任务 ============
|
||||||
@@ -224,6 +225,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
|
||||||
@@ -354,6 +383,57 @@ export interface HealthMetrics {
|
|||||||
disk_percent?: number
|
disk_percent?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============ 用户与权限 ============
|
||||||
|
/** 页面级权限编码,与路由模块保持一一对应 */
|
||||||
|
export type PermissionCode =
|
||||||
|
| 'dashboard'
|
||||||
|
| 'fine-tune'
|
||||||
|
| 'model-eval'
|
||||||
|
| 'model-inference'
|
||||||
|
| 'model-manage'
|
||||||
|
| 'dataset'
|
||||||
|
| 'data-process'
|
||||||
|
| 'data-convert'
|
||||||
|
| 'hardware'
|
||||||
|
| 'logs'
|
||||||
|
| 'user-settings'
|
||||||
|
|
||||||
|
export type UserRole = 'admin' | 'operator' | 'viewer'
|
||||||
|
|
||||||
|
export type UserStatus = 'active' | 'disabled'
|
||||||
|
|
||||||
|
export interface SystemUser {
|
||||||
|
id: string
|
||||||
|
username: string
|
||||||
|
display_name: string
|
||||||
|
role: UserRole
|
||||||
|
status: UserStatus
|
||||||
|
permissions: PermissionCode[]
|
||||||
|
create_time: string
|
||||||
|
last_login?: string
|
||||||
|
protected?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoginResponse {
|
||||||
|
token: string
|
||||||
|
user: SystemUser
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateUserPayload {
|
||||||
|
username: string
|
||||||
|
display_name: string
|
||||||
|
password: string
|
||||||
|
role: UserRole
|
||||||
|
status?: UserStatus
|
||||||
|
permissions?: PermissionCode[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateUserAccessPayload {
|
||||||
|
role?: UserRole
|
||||||
|
status?: UserStatus
|
||||||
|
permissions?: PermissionCode[]
|
||||||
|
}
|
||||||
|
|
||||||
// ============ 日志 ============
|
// ============ 日志 ============
|
||||||
export interface LogFile {
|
export interface LogFile {
|
||||||
file: string
|
file: string
|
||||||
|
|||||||
@@ -25,6 +25,19 @@ interface DashboardTask {
|
|||||||
startedAt: string
|
startedAt: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface LoginDurationStat {
|
||||||
|
id: number
|
||||||
|
username: string
|
||||||
|
duration: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RecentLoginUser {
|
||||||
|
id: number
|
||||||
|
username: string
|
||||||
|
role: string
|
||||||
|
lastLogin: string
|
||||||
|
}
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const period = ref('7d')
|
const period = ref('7d')
|
||||||
|
|
||||||
@@ -185,6 +198,110 @@ const chartOption = computed<EChartsOption>(() => ({
|
|||||||
],
|
],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
const operationChartOption = computed<EChartsOption>(() => ({
|
||||||
|
animationDuration: 500,
|
||||||
|
tooltip: { trigger: 'item' },
|
||||||
|
color: ['#4f46e5', '#10b981', '#f59e0b', '#3b82f6', '#ec4899'],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '操作分类',
|
||||||
|
type: 'pie',
|
||||||
|
radius: ['40%', '64%'],
|
||||||
|
center: ['50%', '50%'],
|
||||||
|
avoidLabelOverlap: true,
|
||||||
|
itemStyle: {
|
||||||
|
borderRadius: 6,
|
||||||
|
borderColor: '#fff',
|
||||||
|
borderWidth: 2
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'outside',
|
||||||
|
formatter: '{b}',
|
||||||
|
color: '#475569',
|
||||||
|
fontSize: 11,
|
||||||
|
lineHeight: 16,
|
||||||
|
width: 70,
|
||||||
|
overflow: 'truncate',
|
||||||
|
},
|
||||||
|
emphasis: {
|
||||||
|
label: { show: true, fontSize: 12, fontWeight: 'bold', color: '#1e293b' }
|
||||||
|
},
|
||||||
|
labelLine: {
|
||||||
|
show: true,
|
||||||
|
length: 10,
|
||||||
|
length2: 8,
|
||||||
|
lineStyle: { color: '#94a3b8', width: 1 },
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{ value: 1048, name: '模型训练' },
|
||||||
|
{ value: 735, name: '数据处理' },
|
||||||
|
{ value: 580, name: '模型评测' },
|
||||||
|
{ value: 484, name: '模型推理' },
|
||||||
|
{ value: 300, name: '系统设置' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}))
|
||||||
|
|
||||||
|
const loginDurationStats: LoginDurationStat[] = [
|
||||||
|
{ id: 1, username: 'admin', duration: 124 },
|
||||||
|
{ id: 2, username: 'zhangsan', duration: 86 },
|
||||||
|
{ id: 3, username: 'lisi', duration: 42 },
|
||||||
|
{ id: 4, username: 'wangwu', duration: 18 },
|
||||||
|
]
|
||||||
|
|
||||||
|
const loginDurationChartOption = computed<EChartsOption>(() => ({
|
||||||
|
animationDuration: 500,
|
||||||
|
grid: { top: 8, right: 40, bottom: 6, left: 8, containLabel: true },
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: { type: 'shadow' },
|
||||||
|
valueFormatter: (value) => `${value} 小时`,
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'value',
|
||||||
|
max: Math.ceil(Math.max(...loginDurationStats.map((user) => user.duration)) / 10) * 10,
|
||||||
|
splitNumber: 4,
|
||||||
|
axisLabel: { color: '#94a3b8', fontSize: 11, formatter: '{value}h' },
|
||||||
|
axisLine: { show: false },
|
||||||
|
axisTick: { show: false },
|
||||||
|
splitLine: { lineStyle: { color: '#eef2f7' } },
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'category',
|
||||||
|
inverse: true,
|
||||||
|
data: loginDurationStats.map((user) => user.username),
|
||||||
|
axisLabel: { color: '#475569', fontSize: 12 },
|
||||||
|
axisLine: { show: false },
|
||||||
|
axisTick: { show: false },
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '登录时长',
|
||||||
|
type: 'bar',
|
||||||
|
data: loginDurationStats.map((user) => user.duration),
|
||||||
|
barMaxWidth: 18,
|
||||||
|
barCategoryGap: '34%',
|
||||||
|
itemStyle: { color: '#4f46e5', borderRadius: [0, 4, 4, 0] },
|
||||||
|
label: { show: true, position: 'right', distance: 8, color: '#64748b', fontSize: 11, formatter: '{c} 小时' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}))
|
||||||
|
|
||||||
|
const recentLoginUsers: RecentLoginUser[] = [
|
||||||
|
{ id: 1, username: 'admin', role: '超级管理员', lastLogin: '10 分钟前' },
|
||||||
|
{ id: 2, username: 'zhangsan', role: '操作员', lastLogin: '2 小时前' },
|
||||||
|
{ id: 5, username: 'zhaoliu', role: '观察员', lastLogin: '5 小时前' },
|
||||||
|
{ id: 3, username: 'lisi', role: '操作员', lastLogin: '昨天 15:30' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const roleTagType: Record<string, 'danger' | 'primary' | 'info'> = {
|
||||||
|
'超级管理员': 'danger',
|
||||||
|
'操作员': 'primary',
|
||||||
|
'观察员': 'info',
|
||||||
|
}
|
||||||
|
|
||||||
function viewAllTasks() {
|
function viewAllTasks() {
|
||||||
router.push('/fine-tune')
|
router.push('/fine-tune')
|
||||||
}
|
}
|
||||||
@@ -262,6 +379,38 @@ function viewTask(task: DashboardTask) {
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="user-stats-row">
|
||||||
|
<section class="stat-card" aria-labelledby="op-dist-title">
|
||||||
|
<h2 id="op-dist-title" class="section-title">用户操作分布</h2>
|
||||||
|
<div class="chart-container">
|
||||||
|
<VChart class="pie-chart" :option="operationChartOption" autoresize />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="stat-card" aria-labelledby="login-dur-title">
|
||||||
|
<h2 id="login-dur-title" class="section-title">登录时长排行 (本月)</h2>
|
||||||
|
<VChart class="duration-chart" :option="loginDurationChartOption" autoresize />
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="stat-card" aria-labelledby="recent-login-title">
|
||||||
|
<h2 id="recent-login-title" class="section-title">最近登录用户</h2>
|
||||||
|
<div class="list-container">
|
||||||
|
<div v-for="user in recentLoginUsers" :key="user.id" class="list-item recent-user-item">
|
||||||
|
<div class="user-info">
|
||||||
|
<el-avatar :size="32" class="user-avatar" :style="{ backgroundColor: '#e2e8f0', color: '#475569' }">
|
||||||
|
{{ user.username.slice(0, 1).toUpperCase() }}
|
||||||
|
</el-avatar>
|
||||||
|
<div class="user-meta">
|
||||||
|
<span class="username">{{ user.username }}</span>
|
||||||
|
<span class="login-time">{{ user.lastLogin }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-tag :type="roleTagType[user.role]" size="small">{{ user.role }}</el-tag>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
<section class="tasks-section" aria-labelledby="tasks-title">
|
<section class="tasks-section" aria-labelledby="tasks-title">
|
||||||
<div class="section-heading-row tasks-heading">
|
<div class="section-heading-row tasks-heading">
|
||||||
<h2 id="tasks-title" class="section-title">训练任务</h2>
|
<h2 id="tasks-title" class="section-title">训练任务</h2>
|
||||||
@@ -319,22 +468,102 @@ function viewTask(task: DashboardTask) {
|
|||||||
.dashboard-view {
|
.dashboard-view {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
min-height: 100%;
|
||||||
gap: 10px;
|
gap: 16px;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
min-height: 0;
|
|
||||||
color: #1e293b;
|
color: #1e293b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.overview-section,
|
.overview-section,
|
||||||
.chart-section,
|
.chart-section,
|
||||||
.service-section,
|
.service-section,
|
||||||
|
.stat-card,
|
||||||
.tasks-section {
|
.tasks-section {
|
||||||
border: 1px solid #e2e8f0;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-stats-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 16px 18px;
|
||||||
|
min-height: 284px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 224px;
|
||||||
|
margin-top: 10px;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pie-chart {
|
||||||
|
width: 100%;
|
||||||
|
height: 224px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.duration-chart {
|
||||||
|
width: 100%;
|
||||||
|
height: 224px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-avatar {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.username {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #334155;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-meta {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-time {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recent-user-item {
|
||||||
|
padding: 2px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
@@ -429,8 +658,8 @@ function viewTask(task: DashboardTask) {
|
|||||||
.dashboard-middle {
|
.dashboard-middle {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1.9fr) minmax(300px, 0.82fr);
|
grid-template-columns: minmax(0, 1.9fr) minmax(300px, 0.82fr);
|
||||||
flex: 1 1 auto;
|
flex: 0 0 auto;
|
||||||
gap: 10px;
|
gap: 16px;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,8 +667,8 @@ function viewTask(task: DashboardTask) {
|
|||||||
.service-section {
|
.service-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 280px;
|
min-height: 360px;
|
||||||
padding: 12px 14px;
|
padding: 16px 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-heading-row {
|
.section-heading-row {
|
||||||
@@ -460,8 +689,8 @@ function viewTask(task: DashboardTask) {
|
|||||||
.training-chart {
|
.training-chart {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: 300px;
|
||||||
min-height: 230px;
|
min-height: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.service-table {
|
.service-table {
|
||||||
@@ -614,10 +843,6 @@ function viewTask(task: DashboardTask) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-height: 900px) and (min-width: 1181px) {
|
@media (max-height: 900px) and (min-width: 1181px) {
|
||||||
.dashboard-view {
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
@@ -666,20 +891,6 @@ function viewTask(task: DashboardTask) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard-middle {
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-section,
|
|
||||||
.service-section {
|
|
||||||
min-height: 240px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.training-chart {
|
|
||||||
min-height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.service-table {
|
.service-table {
|
||||||
grid-template-rows: 32px repeat(4, minmax(40px, 1fr));
|
grid-template-rows: 32px repeat(4, minmax(40px, 1fr));
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
@@ -741,6 +952,17 @@ function viewTask(task: DashboardTask) {
|
|||||||
.dashboard-middle {
|
.dashboard-middle {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-stats-row {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.user-stats-row {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
|||||||
@@ -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 = {
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
import { onBeforeRouteLeave, useRoute } from 'vue-router'
|
import { onBeforeRouteLeave, useRoute } from 'vue-router'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import AppConfirmDialog from '@/components/AppConfirmDialog.vue'
|
||||||
import PageCard from '@/components/PageCard.vue'
|
import PageCard from '@/components/PageCard.vue'
|
||||||
import {
|
import {
|
||||||
activateDatasetFileVersion,
|
activateDatasetFileVersion,
|
||||||
createDatasetFileVersion,
|
createDatasetFileVersion,
|
||||||
|
deleteDatasetFileVersion,
|
||||||
downloadFileUrl,
|
downloadFileUrl,
|
||||||
getDataset,
|
getDataset,
|
||||||
getDatasetFileVersionContent,
|
getDatasetFileVersionContent,
|
||||||
@@ -23,6 +25,7 @@ import type { DatasetFile, DatasetItem, DatasetVersion } from '@/types'
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const datasetId = route.params.id as string
|
const datasetId = route.params.id as string
|
||||||
|
const confirmDialogRef = ref<InstanceType<typeof AppConfirmDialog>>()
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const previewLoading = ref(false)
|
const previewLoading = ref(false)
|
||||||
@@ -44,6 +47,8 @@ const activeVersionId = ref('')
|
|||||||
const loadedVersionId = ref('')
|
const loadedVersionId = ref('')
|
||||||
const versionLoading = ref(false)
|
const versionLoading = ref(false)
|
||||||
const activatingVersion = ref(false)
|
const activatingVersion = ref(false)
|
||||||
|
const deletingVersion = ref(false)
|
||||||
|
const nextVersionNumber = ref(1)
|
||||||
let versionRequestId = 0
|
let versionRequestId = 0
|
||||||
|
|
||||||
const files = computed<DatasetFile[]>(() => dataset.value?.files || [])
|
const files = computed<DatasetFile[]>(() => dataset.value?.files || [])
|
||||||
@@ -54,7 +59,6 @@ const isRecordFile = computed(() => recordResult.value.supported)
|
|||||||
const records = computed(() => recordResult.value.records)
|
const records = computed(() => recordResult.value.records)
|
||||||
const viewedVersion = computed(() => versions.value.find((item) => item.id === loadedVersionId.value))
|
const viewedVersion = computed(() => versions.value.find((item) => item.id === loadedVersionId.value))
|
||||||
const isViewingActiveVersion = computed(() => Boolean(loadedVersionId.value) && loadedVersionId.value === activeVersionId.value)
|
const isViewingActiveVersion = computed(() => Boolean(loadedVersionId.value) && loadedVersionId.value === activeVersionId.value)
|
||||||
const nextVersionNumber = computed(() => Math.max(0, ...versions.value.map((item) => item.version)) + 1)
|
|
||||||
const currentDraft = computed(() => editingRecord.value?.kind === 'object'
|
const currentDraft = computed(() => editingRecord.value?.kind === 'object'
|
||||||
? JSON.stringify(editFields.value)
|
? JSON.stringify(editFields.value)
|
||||||
: rawDraft.value)
|
: rawDraft.value)
|
||||||
@@ -100,6 +104,8 @@ async function loadVersions(file: DatasetFile) {
|
|||||||
const activeContent = await getDatasetFileVersionContent(fileKey(file), result.active_version_id)
|
const activeContent = await getDatasetFileVersionContent(fileKey(file), result.active_version_id)
|
||||||
if (requestId !== versionRequestId) return
|
if (requestId !== versionRequestId) return
|
||||||
versions.value = result.versions
|
versions.value = result.versions
|
||||||
|
nextVersionNumber.value = result.next_version_number
|
||||||
|
?? Math.max(0, ...result.versions.map((item) => item.version)) + 1
|
||||||
activeVersionId.value = result.active_version_id
|
activeVersionId.value = result.active_version_id
|
||||||
selectedVersionId.value = result.active_version_id
|
selectedVersionId.value = result.active_version_id
|
||||||
loadedVersionId.value = result.active_version_id
|
loadedVersionId.value = result.active_version_id
|
||||||
@@ -169,6 +175,52 @@ async function activateViewedVersion() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function deleteViewedVersion() {
|
||||||
|
if (
|
||||||
|
!selectedFile.value
|
||||||
|
|| !viewedVersion.value
|
||||||
|
|| isViewingActiveVersion.value
|
||||||
|
|| deletingVersion.value
|
||||||
|
) return
|
||||||
|
|
||||||
|
const targetVersion = viewedVersion.value
|
||||||
|
const confirmed = await confirmDialogRef.value?.open({
|
||||||
|
title: `删除 V${targetVersion.version} 版本?`,
|
||||||
|
message: `删除后无法恢复。当前版本 V${versions.value.find((item) => item.id === activeVersionId.value)?.version || '-'} 不受影响。`,
|
||||||
|
confirmText: '删除版本',
|
||||||
|
cancelText: '取消',
|
||||||
|
tone: 'danger',
|
||||||
|
})
|
||||||
|
if (!confirmed) return
|
||||||
|
|
||||||
|
deletingVersion.value = true
|
||||||
|
versionLoading.value = true
|
||||||
|
try {
|
||||||
|
const result = await deleteDatasetFileVersion(
|
||||||
|
fileKey(selectedFile.value),
|
||||||
|
targetVersion.id,
|
||||||
|
activeVersionId.value,
|
||||||
|
)
|
||||||
|
const activeContent = await getDatasetFileVersionContent(
|
||||||
|
fileKey(selectedFile.value),
|
||||||
|
result.active_version_id,
|
||||||
|
)
|
||||||
|
versions.value = result.versions
|
||||||
|
nextVersionNumber.value = result.next_version_number
|
||||||
|
?? Math.max(0, ...result.versions.map((item) => item.version)) + 1
|
||||||
|
activeVersionId.value = result.active_version_id
|
||||||
|
selectedVersionId.value = result.active_version_id
|
||||||
|
loadedVersionId.value = result.active_version_id
|
||||||
|
previewContent.value = activeContent.content
|
||||||
|
baseVersionContent.value = activeContent.content
|
||||||
|
resetRecordEditor()
|
||||||
|
ElMessage.success(`V${targetVersion.version} 版本已删除`)
|
||||||
|
} finally {
|
||||||
|
versionLoading.value = false
|
||||||
|
deletingVersion.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function openRecordEditor(record: DatasetRecord) {
|
function openRecordEditor(record: DatasetRecord) {
|
||||||
if (!isViewingActiveVersion.value) {
|
if (!isViewingActiveVersion.value) {
|
||||||
ElMessage.warning('历史版本为只读,请先设为当前版本')
|
ElMessage.warning('历史版本为只读,请先设为当前版本')
|
||||||
@@ -296,6 +348,7 @@ async function saveVersion() {
|
|||||||
previewContent.value = result.content
|
previewContent.value = result.content
|
||||||
baseVersionContent.value = result.content
|
baseVersionContent.value = result.content
|
||||||
versions.value = [result.version, ...versions.value]
|
versions.value = [result.version, ...versions.value]
|
||||||
|
nextVersionNumber.value = result.version.version + 1
|
||||||
activeVersionId.value = result.version.id
|
activeVersionId.value = result.version.id
|
||||||
selectedVersionId.value = result.version.id
|
selectedVersionId.value = result.version.id
|
||||||
loadedVersionId.value = result.version.id
|
loadedVersionId.value = result.version.id
|
||||||
@@ -357,8 +410,10 @@ onBeforeUnmount(() => window.removeEventListener('beforeunload', handleBeforeUnl
|
|||||||
:version-loading="versionLoading"
|
:version-loading="versionLoading"
|
||||||
:saving-record="savingRecord"
|
:saving-record="savingRecord"
|
||||||
:activating-version="activatingVersion"
|
:activating-version="activatingVersion"
|
||||||
|
:deleting-version="deletingVersion"
|
||||||
@change="handleViewedVersionChange"
|
@change="handleViewedVersionChange"
|
||||||
@activate="activateViewedVersion"
|
@activate="activateViewedVersion"
|
||||||
|
@delete="deleteViewedVersion"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-alert
|
<el-alert
|
||||||
@@ -445,6 +500,8 @@ onBeforeUnmount(() => window.removeEventListener('beforeunload', handleBeforeUnl
|
|||||||
@update:field="updateEditField"
|
@update:field="updateEditField"
|
||||||
@update:raw-draft="rawDraft = $event"
|
@update:raw-draft="rawDraft = $event"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AppConfirmDialog ref="confirmDialogRef" />
|
||||||
</PageCard>
|
</PageCard>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
import type { DatasetVersion } from '@/types'
|
import type { DatasetVersion } from '@/types'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -11,14 +12,36 @@ const props = defineProps<{
|
|||||||
versionLoading: boolean
|
versionLoading: boolean
|
||||||
savingRecord: boolean
|
savingRecord: boolean
|
||||||
activatingVersion: boolean
|
activatingVersion: boolean
|
||||||
|
deletingVersion: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
'update:modelValue': [value: string]
|
'update:modelValue': [value: string]
|
||||||
change: [versionId: string]
|
change: [versionId: string]
|
||||||
activate: []
|
activate: []
|
||||||
|
delete: []
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
type VersionAction = 'activate' | 'delete'
|
||||||
|
|
||||||
|
const actionsDisabled = computed(
|
||||||
|
() =>
|
||||||
|
props.versionLoading ||
|
||||||
|
props.savingRecord ||
|
||||||
|
props.activatingVersion ||
|
||||||
|
props.deletingVersion,
|
||||||
|
)
|
||||||
|
|
||||||
|
const deleteDisabledReason = computed(() => {
|
||||||
|
if (props.viewedVersion?.version === 1) return '初始版本不可删除'
|
||||||
|
if (props.versions.length <= 1) return '至少需要保留一个版本'
|
||||||
|
return ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const deleteDisabled = computed(
|
||||||
|
() => actionsDisabled.value || Boolean(deleteDisabledReason.value),
|
||||||
|
)
|
||||||
|
|
||||||
function formatVersionTime(value: string) {
|
function formatVersionTime(value: string) {
|
||||||
return new Date(value).toLocaleString('zh-CN', { hour12: false })
|
return new Date(value).toLocaleString('zh-CN', { hour12: false })
|
||||||
}
|
}
|
||||||
@@ -32,6 +55,16 @@ function handleVersionChange(versionId: string) {
|
|||||||
emit('update:modelValue', versionId)
|
emit('update:modelValue', versionId)
|
||||||
emit('change', versionId)
|
emit('change', versionId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleVersionAction(command: VersionAction) {
|
||||||
|
if (actionsDisabled.value) return
|
||||||
|
if (command === 'activate') {
|
||||||
|
emit('activate')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (deleteDisabled.value) return
|
||||||
|
emit('delete')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -70,15 +103,51 @@ function handleVersionChange(versionId: string) {
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-button
|
<el-dropdown
|
||||||
v-if="viewedVersion && !isViewingActiveVersion"
|
v-if="viewedVersion && !isViewingActiveVersion"
|
||||||
type="primary"
|
class="version-actions"
|
||||||
:loading="activatingVersion"
|
trigger="click"
|
||||||
@click="emit('activate')"
|
placement="bottom-end"
|
||||||
|
popper-class="version-actions-popper"
|
||||||
|
:disabled="actionsDisabled"
|
||||||
|
@command="handleVersionAction"
|
||||||
>
|
>
|
||||||
<i class="fa fa-check-circle" />
|
<el-button
|
||||||
设为当前版本
|
class="version-actions-button"
|
||||||
|
:loading="activatingVersion || deletingVersion"
|
||||||
|
:disabled="actionsDisabled"
|
||||||
|
aria-label="打开历史版本操作菜单"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
v-if="!activatingVersion && !deletingVersion"
|
||||||
|
class="fa fa-ellipsis-h"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item
|
||||||
|
command="activate"
|
||||||
|
class="version-action-primary"
|
||||||
|
:disabled="actionsDisabled"
|
||||||
|
>
|
||||||
|
<i class="fa fa-check-circle" aria-hidden="true" />
|
||||||
|
设为当前版本
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item
|
||||||
|
command="delete"
|
||||||
|
class="version-action-danger"
|
||||||
|
:disabled="deleteDisabled"
|
||||||
|
:title="deleteDisabledReason || undefined"
|
||||||
|
divided
|
||||||
|
>
|
||||||
|
<i class="fa fa-trash-o" aria-hidden="true" />
|
||||||
|
删除版本
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -129,13 +198,43 @@ function handleVersionChange(versionId: string) {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-control-bar > .el-button {
|
.version-actions {
|
||||||
min-height: 40px;
|
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-control-bar > .el-button i {
|
.version-actions-button {
|
||||||
margin-right: 6px;
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-actions-button i {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.version-actions-popper .el-dropdown-menu__item) {
|
||||||
|
gap: 8px;
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.version-actions-popper .el-dropdown-menu) {
|
||||||
|
min-width: 168px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.version-actions-popper .version-action-primary:not(.is-disabled) i) {
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.version-actions-popper .version-action-danger:not(.is-disabled)) {
|
||||||
|
color: var(--el-color-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.version-actions-popper .version-action-danger:not(.is-disabled):hover) {
|
||||||
|
color: var(--el-color-danger);
|
||||||
|
background: var(--el-color-danger-light-9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 680px) {
|
@media (max-width: 680px) {
|
||||||
@@ -147,8 +246,22 @@ function handleVersionChange(versionId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.version-select,
|
.version-select,
|
||||||
.version-control-bar > .el-button {
|
.version-selector-group {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.version-status {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-status > span {
|
||||||
|
white-space: normal;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-actions {
|
||||||
|
align-self: flex-end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -40,41 +40,63 @@ async function handleLogin() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="login-page">
|
<div class="login-page">
|
||||||
<div class="login-card">
|
<section class="login-visual" aria-labelledby="platform-title">
|
||||||
<!-- LOGO 和标题 -->
|
<div class="login-visual-content">
|
||||||
<div class="login-header">
|
<div class="login-visual-copy">
|
||||||
<img src="/logo.png" alt="Logo" class="login-logo" />
|
<h1 id="platform-title">远光软件微调平台</h1>
|
||||||
<h1 class="login-title">远光软件微调平台</h1>
|
<p>大模型微调、评测与推理的一体化工作台</p>
|
||||||
<p class="login-subtitle">模型管理平台</p>
|
</div>
|
||||||
|
|
||||||
|
<div class="login-visual-footer" aria-label="平台核心能力">
|
||||||
|
<span>数据准备</span>
|
||||||
|
<span aria-hidden="true">·</span>
|
||||||
|
<span>模型训练</span>
|
||||||
|
<span aria-hidden="true">·</span>
|
||||||
|
<span>效果评测</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<main class="login-panel">
|
||||||
|
<div class="brand-lockup" role="img" aria-label="远光软件">
|
||||||
|
<span class="brand-logo-crop brand-logo-crop-mark" aria-hidden="true">
|
||||||
|
<img src="/logo.png" alt="" />
|
||||||
|
</span>
|
||||||
|
<span class="brand-logo-crop brand-logo-crop-wordmark" aria-hidden="true">
|
||||||
|
<img src="/logo.png" alt="" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="login-form-wrap">
|
||||||
|
<div class="login-heading">
|
||||||
|
<span>账号登录</span>
|
||||||
|
<h2>欢迎回来</h2>
|
||||||
|
<p>登录后继续使用微调平台</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 登录表单 -->
|
|
||||||
<el-form
|
<el-form
|
||||||
ref="loginFormRef"
|
ref="loginFormRef"
|
||||||
:model="loginForm"
|
:model="loginForm"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
|
label-position="top"
|
||||||
size="large"
|
size="large"
|
||||||
@keyup.enter="handleLogin"
|
@keyup.enter="handleLogin"
|
||||||
>
|
>
|
||||||
<el-form-item prop="username">
|
<el-form-item label="账号" prop="username">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="loginForm.username"
|
v-model="loginForm.username"
|
||||||
placeholder="请输入账号/手机号/邮箱"
|
placeholder="请输入账号"
|
||||||
clearable
|
clearable
|
||||||
>
|
/>
|
||||||
<template #prefix><i class="fa fa-user-o" /></template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="password">
|
<el-form-item label="密码" prop="password">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="loginForm.password"
|
v-model="loginForm.password"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="请输入密码"
|
placeholder="请输入密码"
|
||||||
show-password
|
show-password
|
||||||
>
|
/>
|
||||||
<template #prefix><i class="fa fa-lock-o" /></template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<div class="login-options">
|
<div class="login-options">
|
||||||
@@ -88,177 +110,238 @@ async function handleLogin() {
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
@click="handleLogin"
|
@click="handleLogin"
|
||||||
>
|
>
|
||||||
<i class="fa fa-sign-in login-btn-icon" />
|
登录
|
||||||
登 录
|
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<footer>© 2026 远光软件</footer>
|
||||||
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.login-page {
|
.login-page {
|
||||||
min-height: 100vh;
|
height: 100vh;
|
||||||
display: flex;
|
height: 100dvh;
|
||||||
align-items: center;
|
display: grid;
|
||||||
justify-content: center;
|
grid-template-columns: minmax(0, 58fr) minmax(500px, 42fr);
|
||||||
padding: 16px;
|
overflow: hidden;
|
||||||
background-color: #f8fafc;
|
background: #fcfcfe;
|
||||||
/* Beautiful light mesh gradient for AI platform */
|
}
|
||||||
background-image:
|
|
||||||
radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
|
.login-visual {
|
||||||
radial-gradient(at 80% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
|
min-height: 0;
|
||||||
radial-gradient(at 40% 60%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
|
height: 100%;
|
||||||
radial-gradient(at 90% 80%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
|
|
||||||
background-size: 100% 100%;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #121127;
|
||||||
|
background-image: url('@/assets/login-hero-flow.png');
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add some dynamic floating orbs for extra premium feel */
|
.login-visual::after {
|
||||||
.login-page::before,
|
|
||||||
.login-page::after {
|
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border-radius: 50%;
|
inset: 0;
|
||||||
filter: blur(60px);
|
background: linear-gradient(180deg, rgba(12, 12, 35, 0.2), transparent 36%, rgba(12, 12, 35, 0.2));
|
||||||
z-index: 0;
|
pointer-events: none;
|
||||||
animation: float 20s infinite ease-in-out alternate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-page::before {
|
.login-visual-content {
|
||||||
width: 400px;
|
min-height: 0;
|
||||||
height: 400px;
|
height: 100%;
|
||||||
background: rgba(99, 102, 241, 0.1);
|
|
||||||
top: -100px;
|
|
||||||
left: -100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-page::after {
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: rgba(236, 72, 153, 0.08);
|
|
||||||
bottom: -150px;
|
|
||||||
right: -150px;
|
|
||||||
animation-delay: -10s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes float {
|
|
||||||
0% { transform: translate(0, 0) rotate(0deg); }
|
|
||||||
100% { transform: translate(50px, 50px) rotate(10deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-card {
|
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
width: 100%;
|
display: flex;
|
||||||
max-width: 440px;
|
flex-direction: column;
|
||||||
/* Glassmorphism */
|
padding: clamp(80px, 10vh, 132px) clamp(56px, 6vw, 112px) clamp(56px, 7vh, 84px);
|
||||||
background: rgba(255, 255, 255, 0.7);
|
|
||||||
backdrop-filter: blur(24px);
|
|
||||||
-webkit-backdrop-filter: blur(24px);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.8);
|
|
||||||
border-radius: 24px;
|
|
||||||
padding: 48px 40px;
|
|
||||||
box-shadow:
|
|
||||||
0 20px 40px -10px rgba(0, 0, 0, 0.05),
|
|
||||||
0 1px 3px rgba(0, 0, 0, 0.02),
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 1);
|
|
||||||
/* Entrance animation */
|
|
||||||
transform: translateY(30px);
|
|
||||||
opacity: 0;
|
|
||||||
animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slideUpFade {
|
.login-visual-copy {
|
||||||
to {
|
max-width: 680px;
|
||||||
transform: translateY(0);
|
margin-top: clamp(80px, 11vh, 136px);
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-header {
|
h1 {
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 40px;
|
|
||||||
|
|
||||||
.login-logo {
|
|
||||||
width: 56px;
|
|
||||||
height: 56px;
|
|
||||||
object-fit: contain;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-title {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 700;
|
|
||||||
letter-spacing: -0.5px;
|
|
||||||
margin: 0 0 8px;
|
|
||||||
/* Gradient text */
|
|
||||||
background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
-webkit-text-fill-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-subtitle {
|
|
||||||
font-size: 15px;
|
|
||||||
color: #64748b;
|
|
||||||
font-weight: 500;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
font-size: clamp(38px, 3.8vw, 62px);
|
||||||
|
line-height: 1.2;
|
||||||
|
letter-spacing: -0.035em;
|
||||||
|
font-weight: 700;
|
||||||
|
text-wrap: balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 22px 0 0;
|
||||||
|
color: rgba(226, 232, 240, 0.76);
|
||||||
|
font-size: clamp(17px, 1.5vw, 24px);
|
||||||
|
line-height: 1.6;
|
||||||
|
letter-spacing: 0.01em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom Input Styling */
|
.login-visual-footer {
|
||||||
:deep(.el-form-item) {
|
width: min(100%, 640px);
|
||||||
|
margin-top: auto;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr auto 1fr auto 1fr;
|
||||||
|
align-items: center;
|
||||||
|
gap: 24px;
|
||||||
|
color: rgba(226, 232, 240, 0.72);
|
||||||
|
font-size: 16px;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
|
||||||
|
span:nth-child(3),
|
||||||
|
span:nth-child(5) {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
span:nth-child(even) {
|
||||||
|
color: rgba(199, 210, 254, 0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-panel {
|
||||||
|
min-height: 0;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 120px clamp(48px, 5vw, 88px) 96px;
|
||||||
|
border-left: 1px solid #e8eaf1;
|
||||||
|
background: #fcfcfe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-lockup {
|
||||||
|
position: absolute;
|
||||||
|
top: 42px;
|
||||||
|
right: clamp(36px, 4vw, 64px);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-logo-crop {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
img {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-logo-crop-mark {
|
||||||
|
width: 40px;
|
||||||
|
height: 38px;
|
||||||
|
|
||||||
|
img {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-logo-crop-wordmark {
|
||||||
|
width: 96px;
|
||||||
|
height: 25px;
|
||||||
|
|
||||||
|
img {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form-wrap {
|
||||||
|
width: min(100%, 480px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-heading {
|
||||||
|
margin-bottom: 42px;
|
||||||
|
|
||||||
|
> span {
|
||||||
|
display: block;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
|
color: #4f46e5;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
color: #17182c;
|
||||||
|
font-size: clamp(38px, 3vw, 48px);
|
||||||
|
line-height: 1.15;
|
||||||
|
letter-spacing: -0.035em;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 14px 0 0;
|
||||||
|
color: #8a93a6;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-form-item) {
|
||||||
|
margin-bottom: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-form-item__label) {
|
||||||
|
height: auto;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 0;
|
||||||
|
color: #272a3a;
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.4;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-input__wrapper) {
|
:deep(.el-input__wrapper) {
|
||||||
background-color: rgba(255, 255, 255, 0.6) !important;
|
min-height: 54px;
|
||||||
border-radius: 12px !important;
|
padding: 0 18px;
|
||||||
box-shadow: 0 0 0 1px rgba(203, 213, 225, 0.5) inset !important;
|
border-radius: 8px;
|
||||||
padding: 0 16px;
|
background: #fff;
|
||||||
transition: all 0.3s ease;
|
box-shadow: 0 0 0 1px #cfd4df inset;
|
||||||
|
transition: box-shadow 160ms ease, background-color 160ms ease;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba(255, 255, 255, 0.9) !important;
|
box-shadow: 0 0 0 1px #aeb6c6 inset;
|
||||||
box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6) inset !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.is-focus {
|
&.is-focus {
|
||||||
background-color: #ffffff !important;
|
box-shadow: 0 0 0 1px #4f46e5 inset, 0 0 0 3px rgba(79, 70, 229, 0.12);
|
||||||
box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2) inset, 0 0 0 1px #4f46e5 inset !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-input__inner) {
|
:deep(.el-input__inner) {
|
||||||
height: 48px;
|
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #1e293b;
|
color: #1e293b;
|
||||||
&::placeholder {
|
|
||||||
color: #94a3b8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-input__prefix) {
|
&::placeholder {
|
||||||
color: #94a3b8;
|
color: #a4acba;
|
||||||
font-size: 16px;
|
}
|
||||||
margin-right: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-options {
|
.login-options {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 28px;
|
margin: -2px 0 30px;
|
||||||
margin-top: -8px;
|
|
||||||
|
|
||||||
:deep(.el-checkbox__label) {
|
:deep(.el-checkbox__label) {
|
||||||
color: #64748b;
|
color: #556070;
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-link) {
|
:deep(.el-link) {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #4f46e5;
|
color: #4f46e5;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #4338ca;
|
color: #4338ca;
|
||||||
}
|
}
|
||||||
@@ -267,30 +350,227 @@ async function handleLogin() {
|
|||||||
|
|
||||||
.login-btn {
|
.login-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 48px;
|
height: 54px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
border-radius: 12px;
|
border-radius: 8px;
|
||||||
border: none;
|
border: none;
|
||||||
background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
|
background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
|
box-shadow: 0 10px 22px rgba(79, 70, 229, 0.18);
|
||||||
transition: all 0.3s ease;
|
transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||||
|
|
||||||
.login-btn-icon {
|
|
||||||
margin-right: 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
|
box-shadow: 0 14px 26px rgba(79, 70, 229, 0.24);
|
||||||
background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
|
background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
transform: translateY(1px);
|
transform: translateY(0);
|
||||||
box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
|
box-shadow: 0 6px 14px rgba(79, 70, 229, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-panel footer {
|
||||||
|
position: absolute;
|
||||||
|
right: clamp(36px, 4vw, 64px);
|
||||||
|
bottom: 34px;
|
||||||
|
color: #9aa2b2;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1440px) {
|
||||||
|
.login-page {
|
||||||
|
grid-template-columns: minmax(0, 55fr) minmax(500px, 45fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-content {
|
||||||
|
padding-inline: clamp(52px, 5vw, 72px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-copy {
|
||||||
|
max-width: 580px;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: clamp(42px, 3.6vw, 52px);
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: clamp(16px, 1.45vw, 20px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-panel {
|
||||||
|
padding-inline: clamp(44px, 4.2vw, 64px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form-wrap {
|
||||||
|
max-width: 440px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1180px) {
|
||||||
|
.login-page {
|
||||||
|
grid-template-columns: minmax(0, 52fr) minmax(470px, 48fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-content {
|
||||||
|
padding-inline: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-copy h1 {
|
||||||
|
font-size: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-footer {
|
||||||
|
gap: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-height: 820px) and (min-width: 901px) {
|
||||||
|
.login-visual {
|
||||||
|
background-position: center 54%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-content {
|
||||||
|
padding-top: 48px;
|
||||||
|
padding-bottom: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-copy {
|
||||||
|
max-width: 560px;
|
||||||
|
margin-top: clamp(52px, 9vh, 72px);
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: clamp(38px, 3.4vw, 46px);
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 14px;
|
||||||
|
font-size: clamp(15px, 1.35vw, 18px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual-footer {
|
||||||
|
gap: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-panel {
|
||||||
|
padding-top: 78px;
|
||||||
|
padding-bottom: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-lockup {
|
||||||
|
top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-heading {
|
||||||
|
margin-bottom: 26px;
|
||||||
|
|
||||||
|
> span {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-form-item) {
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-form-item__label) {
|
||||||
|
margin-bottom: 7px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
min-height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-options {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-btn {
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-panel footer {
|
||||||
|
bottom: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.login-page {
|
||||||
|
display: block;
|
||||||
|
height: auto;
|
||||||
|
min-height: 100vh;
|
||||||
|
min-height: 100dvh;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-visual {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-panel {
|
||||||
|
height: auto;
|
||||||
|
min-height: 100vh;
|
||||||
|
min-height: 100dvh;
|
||||||
|
padding: 116px 32px 84px;
|
||||||
|
border-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-panel footer {
|
||||||
|
right: 50%;
|
||||||
|
transform: translateX(50%);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 560px) {
|
||||||
|
.login-panel {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 100px 24px 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-lockup {
|
||||||
|
top: 28px;
|
||||||
|
right: 24px;
|
||||||
|
transform: scale(0.88);
|
||||||
|
transform-origin: top right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-heading {
|
||||||
|
margin-bottom: 32px;
|
||||||
|
|
||||||
|
> span {
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-form-item) {
|
||||||
|
margin-bottom: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-options {
|
||||||
|
margin-bottom: 26px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user