1. 我的模型添加成功
2. 评估维度页面创建成功
This commit is contained in:
@@ -23,7 +23,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>
|
||||
|
||||
@@ -117,7 +117,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>
|
||||
|
||||
@@ -120,7 +120,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>
|
||||
|
||||
@@ -122,7 +122,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>
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -5,17 +5,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>添加评测维度 / 远光软件微调平台</title>
|
||||
<script src="../lib/tailwindcss/tailwind.js"></script>
|
||||
<script>
|
||||
if (typeof console !== 'undefined' && console.warn) {
|
||||
const originalWarn = console.warn;
|
||||
console.warn = function(...args) {
|
||||
if (args[0] && args[0].includes && args[0].includes('cdn.tailwindcss.com')) {
|
||||
return;
|
||||
}
|
||||
originalWarn.apply(console, args);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<link href="../lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
|
||||
<style>
|
||||
/* 侧边栏滑块动画 */
|
||||
@@ -216,7 +205,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>
|
||||
@@ -467,15 +456,13 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 使用 IIFE 避免全局变量污染
|
||||
(function() {
|
||||
// API 基础地址 - 优先使用 main.html 中定义的全局变量
|
||||
const getApiBase = () => {
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
return `${protocol}//${hostname}:7861/api`;
|
||||
};
|
||||
const API_BASE = typeof window.API_BASE !== 'undefined' ? window.API_BASE : getApiBase();
|
||||
// API 基础地址 - 使用 config.yaml 中的 app.port (7861)
|
||||
const getApiBase = () => {
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
return `${protocol}//${hostname}:7861/api`;
|
||||
};
|
||||
const API_BASE = getApiBase();
|
||||
|
||||
// 加载评测模型列表(用途为 evaluation 的模型)
|
||||
async function loadEvalModels() {
|
||||
@@ -1317,7 +1304,7 @@
|
||||
}
|
||||
this._onConfirm = null;
|
||||
};
|
||||
})();
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 自定义消息弹窗 -->
|
||||
|
||||
@@ -126,7 +126,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>
|
||||
|
||||
@@ -114,7 +114,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>
|
||||
|
||||
@@ -107,7 +107,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>
|
||||
@@ -306,8 +306,10 @@
|
||||
</main>
|
||||
|
||||
<script>
|
||||
console.log('[DEBUG] model-manage.html 脚本开始加载');
|
||||
// 使用 IIFE 避免全局变量污染
|
||||
(function() {
|
||||
console.log('[DEBUG] model-manage.html IIFE 开始执行');
|
||||
// API 基础地址 - 优先使用 main.html 中定义的全局变量
|
||||
const getApiBase = () => {
|
||||
const protocol = window.location.protocol;
|
||||
@@ -722,7 +724,11 @@
|
||||
}
|
||||
|
||||
// 页面加载时初始化
|
||||
loadModels();
|
||||
try {
|
||||
loadModels();
|
||||
} catch (e) {
|
||||
console.error('初始化失败:', e);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user