模型对比页面优化包括UI

This commit is contained in:
2026-01-21 10:54:19 +08:00
parent 5be838a74e
commit fb136fc778
4 changed files with 471 additions and 430 deletions

View File

@@ -169,10 +169,10 @@
<!-- 侧边导航 -->
<aside class="w-64 text-[#bfcbd9] flex-shrink-0 hidden md:block flex flex-col h-full" style="background-color: #001529;">
<!-- 平台LOGO区域 -->
<div class="p-4 border-b border-[#001529]/30 flex items-center">
<img src="../assets/logo/logo.png" alt="Logo" class="w-6 h-6 object-contain mr-2">
<span class="text-white font-medium">远光软件微调平台</span>
</div>
<div class="pt-5 pb-3 border-b border-[#001529]/30 flex items-center justify-center pl-2">
<img src="../assets/logo/logo.png" alt="Logo" class="w-8 h-8 object-contain mr-2">
<span class="text-white font-medium text-base">远光软件微调平台</span>
</div></parameter>
<!-- 导航主区域 -->
<nav class="flex-1 overflow-y-auto py-2 relative">
@@ -505,6 +505,18 @@
skipFetch: true,
hasCreate: false,
isHardwareMonitor: true
},
'model-compare-chat': {
title: '模型对比',
skipFetch: true,
hasCreate: false,
isExternalPage: true
},
'model-compare-result': {
title: '对比结果',
skipFetch: true,
hasCreate: false,
isExternalPage: true
}
};
@@ -660,7 +672,29 @@
try {
// 渲染页面
if (config.isHardwareMonitor) {
if (config.isExternalPage) {
// 外部页面,直接通过 fetch 加载 HTML
const response = await fetch(`${pageName}.html`);
if (response.ok) {
const html = await response.text();
// 提取脚本内容并执行
const scriptMatch = html.match(/<script>([\s\S]*?)<\/script>/);
const scriptContent = scriptMatch ? scriptMatch[1] : '';
// 移除脚本标签后插入HTML
const htmlWithoutScript = html.replace(/<script>[\s\S]*?<\/script>/g, '');
container.innerHTML = htmlWithoutScript;
// 执行脚本
if (scriptContent) {
try {
eval(scriptContent);
} catch (e) {
console.error('执行脚本失败:', e);
}
}
} else {
throw new Error('页面加载失败');
}
} else if (config.isHardwareMonitor) {
// 硬件监控页面使用模拟数据不调用API
container.innerHTML = renderConfigPage(config, null);
} else if (config.isForm) {
@@ -867,8 +901,8 @@
// 开始模型对比
async function startCompare(id) {
// 跳转到模型对比聊天页面
window.location.href = `model-compare-chat.html?id=${id}`;
// 跳转到模型对比聊天页面(通过主框架加载)
window.location.href = `main.html?page=model-compare-chat&id=${id}`;
}
// 筛选表格