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