1. 我的模型添加成功

2. 评估维度页面创建成功
This commit is contained in:
2026-01-29 16:39:21 +08:00
parent e494c4ce50
commit 49393fefa0
9 changed files with 46 additions and 38 deletions

View File

@@ -200,7 +200,7 @@
</a>
</div>
<div class="nav-item-wrapper">
<a href="model-manage.html" data-page="my-models" class="nav-link flex items-center px-4 py-2.5 hover:bg-[#001529]/20 transition-colors">
<a href="main.html?page=my-models" data-page="my-models" class="nav-link flex items-center px-4 py-2.5 hover:bg-[#001529]/20 transition-colors">
<i class="fa fa-database w-5 text-center"></i>
<span class="ml-2">我的模型</span>
</a>
@@ -437,16 +437,16 @@
},
'my-models': {
title: '我的模型',
api: 'my-models',
api: 'model-manage/trained-models',
dataPath: 'models', // 特殊处理API返回的是 {data: {models: [...]}} 格式
hasCreate: false,
columns: [
{ title: '模型名称', key: 'name' },
{ title: '类型', key: 'type' },
{ title: '版本', key: 'version' },
{ title: '描述', key: 'description' },
{ title: '训练方法', key: 'train_methods', render: (val) => val && val[0] ? val[0].name : '-' },
{ title: '模型路径', key: 'path', render: (val) => `<span class="text-xs text-gray-500 truncate max-w-xs block" title="${val}">${val}</span>` },
{ title: '创建时间', key: 'create_time', render: (val) => val ? new Date(val).toLocaleString('zh-CN') : '-' }
],
actions: ['deploy', 'eval', 'delete']
actions: ['view', 'delete']
},
'model-eval': {
title: '模型评测',
@@ -607,7 +607,8 @@
'detail': '详情',
'edit': '编辑',
'compare': '开始对话',
'chat': '对话'
'chat': '对话',
'view': '去推理'
};
// 训练进度缓存
@@ -966,7 +967,11 @@
} else if (config.isTools) {
container.innerHTML = renderToolsPage(config);
} else {
const data = await fetchData(`${API_BASE}/${config.api}`);
let data = await fetchData(`${API_BASE}/${config.api}`);
// 如果配置了 dataPath从返回数据中提取指定字段
if (config.dataPath && typeof data === 'object' && data !== null) {
data = data[config.dataPath] || [];
}
currentPageData = data; // 保存当前页面数据
container.innerHTML = renderTablePage(config, data);
@@ -1369,6 +1374,8 @@
onclick = `startCompare(${item.id})`;
} else if (action === 'logs' && config.api === 'fine-tune') {
onclick = `navigateToTrainingLog(${item.id})`;
} else if (action === 'view' && config.api === 'model-manage/trained-models') {
onclick = `viewTrainedModel('${item.name}', '${item.train_methods?.[0]?.name || '-'}', '${item.path || ''}')`;
} else {
onclick = `showMessage('提示', '${actionLabels[action] || action}功能开发中...', 'info')`;
}
@@ -3157,6 +3164,14 @@
document.body.style.overflow = '';
}
// 查看已训练模型详情
window.viewTrainedModel = function(name, method, path) {
const message = '<p class="mb-2">模型名称:' + name + '</p>' +
'<p class="mb-2">训练方法:' + method + '</p>' +
'<p class="text-sm text-gray-500 break-all">路径:' + path + '</p>';
showMessage('模型详情', message, 'info');
};
// 确认弹窗(两个按钮)- 使用 window 确保全局可访问
window.showConfirm = function(title, message, onConfirm, onCancel, type = 'info') {
const modal = document.getElementById('customModal');