1. 模型对比页面完善,包括bug修复,支持markdown展示
This commit is contained in:
@@ -230,6 +230,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
console.log('>>> model-compare-chat.html 脚本开始加载');
|
||||
// 动态获取 API 基础地址
|
||||
const getApiBase = () => {
|
||||
const protocol = window.location.protocol;
|
||||
@@ -263,6 +264,9 @@
|
||||
|
||||
// 页面初始化函数
|
||||
async function initPage() {
|
||||
console.log('>>> chat initPage 开始执行');
|
||||
console.log('document.readyState:', document.readyState);
|
||||
|
||||
try {
|
||||
// 获取URL参数
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
@@ -281,11 +285,10 @@
|
||||
}
|
||||
|
||||
// 立即初始化(支持通过 fetch 加载的页面)
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initPage);
|
||||
} else {
|
||||
initPage();
|
||||
}
|
||||
// 延迟执行,确保 DOM 完全准备好
|
||||
setTimeout(() => {
|
||||
initPage().catch(err => console.error('initPage 执行失败:', err));
|
||||
}, 50);
|
||||
|
||||
// 加载对比任务数据
|
||||
async function loadCompareTask() {
|
||||
@@ -406,7 +409,7 @@
|
||||
if (startBtn) startBtn.addEventListener('click', startGeneration);
|
||||
}
|
||||
|
||||
// 开始生成回答 - 跳转到结果页面
|
||||
// 开始生成回答 - 直接跳转到结果页面,由结果页面调用API
|
||||
function startGeneration() {
|
||||
const userQuestion = document.getElementById('userQuestion').value.trim();
|
||||
|
||||
@@ -419,10 +422,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到结果页面
|
||||
// 直接跳转到结果页面,不在这里等待API结果
|
||||
// 结果页面会自动调用API并显示加载状态
|
||||
const taskName = compareTaskData?.model_name || '对比任务';
|
||||
const encodedQuestion = encodeURIComponent(userQuestion);
|
||||
window.location.href = `main.html?page=model-compare-result&taskId=${compareTaskId}&taskName=${encodeURIComponent(taskName)}&question=${encodedQuestion}`;
|
||||
window.location.href = `main.html?page=model-compare-result&taskId=${compareTaskId}&taskName=${encodeURIComponent(taskName)}&question=${encodedQuestion}&real=1`;
|
||||
}
|
||||
|
||||
// 返回
|
||||
|
||||
Reference in New Issue
Block a user