1. 模型对比页面完善,包括bug修复,支持markdown展示

This commit is contained in:
2026-01-22 14:09:25 +08:00
parent f126139bbd
commit d7fa8583f7
6 changed files with 452 additions and 54 deletions

View File

@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>模型调优 - 远光软件微调平台</title>
<script src="../lib/tailwindcss/tailwind.js"></script>
<script src="../lib/marked.min.js"></script>
<link href="../lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<style>
.sidebar-section-title {
@@ -568,8 +569,6 @@
// 保存到 sessionStorage当前会话
sessionStorage.setItem('lastPage', defaultPage);
console.log('Page init - URL param:', pageParam, 'saved:', sessionStorage.getItem('lastPage'), 'loading:', defaultPage);
loadPage(defaultPage);
// 更新侧边栏高亮状态
@@ -667,15 +666,15 @@
try {
// 渲染页面
if (config.isExternalPage) {
// 外部页面,直接通过 fetch 加载 HTML
const response = await fetch(`${pageName}.html`);
// 外部页面,直接通过 fetch 加载 HTML(添加时间戳禁用缓存)
const response = await fetch(`${pageName}.html?t=${Date.now()}`);
if (response.ok) {
const html = await response.text();
// 提取脚本内容并执行
const scriptMatch = html.match(/<script>([\s\S]*?)<\/script>/);
// 提取内联脚本内容没有src属性的script标签
const scriptMatch = html.match(/<script\b(?![^>]*\bsrc)[^>]*>([\s\S]*?)<\/script>/);
const scriptContent = scriptMatch ? scriptMatch[1] : '';
// 移除脚本标签后插入HTML
const htmlWithoutScript = html.replace(/<script>[\s\S]*?<\/script>/g, '');
// 移除所有script标签后插入HTML
const htmlWithoutScript = html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g, '');
// 如果有创建配置,添加 Tab 切换和创建按钮
let headerHtml = '';
@@ -710,7 +709,7 @@
container.innerHTML = headerHtml + htmlWithoutScript;
// 执行脚本
if (scriptContent) {
if (scriptContent && scriptContent.trim()) {
try {
eval(scriptContent);
} catch (e) {