mian.html代码修复

This commit is contained in:
2026-02-02 09:30:26 +08:00
parent 513e96082c
commit 24a05ab7ab

View File

@@ -25,8 +25,6 @@
<script src="../js/components/table.js"></script>
<script src="../js/pages/render.js"></script>
<script src="../js/main.js"></script>
<!-- 常量配置 -->
<script src="../js/config/constants.js"></script>
<link href="../lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="../css/main.css" rel="stylesheet">
</head>
@@ -167,19 +165,12 @@
</div>
<script>
// 加载常量配置
if (typeof window.CONSTANTS === 'undefined') {
// 如果constants.js还未加载使用默认值
window.CONSTANTS = { API_CONFIG: { PORT: 7861, METRICS_INTERVAL: 30000 } };
}
const CONFIG = window.CONSTANTS.API_CONFIG;
// API 基础地址
if (typeof window.getApiBase !== 'function') {
window.getApiBase = () => {
const protocol = window.location.protocol;
const hostname = window.location.hostname;
return `${protocol}//${hostname}:${CONFIG.PORT}/api`;
return `${protocol}//${hostname}:7861/api`;
};
}
if (typeof window.API_BASE === 'undefined') {
@@ -220,7 +211,7 @@
// 页面加载时获取监控数据,并定期刷新
fetchSystemMetrics();
setInterval(fetchSystemMetrics, CONFIG.METRICS_INTERVAL);
setInterval(fetchSystemMetrics, 30000);
// 各功能模块的表格配置
const tableConfigs = {
@@ -574,7 +565,7 @@
progressRefreshTimer = setInterval(() => {
refreshTrainingProgress();
checkAndUpdateTaskStatus();
}, CONFIG.TRAINING_REFRESH_INTERVAL);
}, 5000);
// 更新侧边栏高亮状态
document.querySelectorAll('.nav-link').forEach(link => {
@@ -1316,13 +1307,9 @@
// 渲染工具卡片页面
// 当前页面状态
let currentPage = 'fine-tune';
// 当前页面状态(其他变量在开头已声明)
let currentParentPage = null;
let selectedItems = new Set(); // 存储选中的项ID
let currentPageData = []; // 存储当前页面数据
let modelListCache = []; // 模型列表缓存
let currentModelTab = 'config'; // 模型管理页面当前tab: 'config'=配置模型, 'trained'=训练模型
// 加载模型列表缓存
async function loadModelListCache() {