- ai-chat.html: AI对话咨询页 - ai-tool.html: AI智能推荐页 (需 /api/recommend 路由) - plan.html: 志愿填写助手 - school.html: 查校对比 - major.html: 查专业录取分 - qa.html: 常见问题 - diag.html: 高考诊断 - gaokao-chat-server-v2.py: Flask后端 (port 8080) - scripts/: 数据采集和处理工具
134 lines
5.5 KiB
HTML
134 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>功能自检 - 高考志愿助手</title>
|
|
<style>
|
|
body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;background:#0a0a0f;color:#e0e0e0;padding:30px;line-height:1.8}
|
|
h1{color:#667eea;font-size:1.5rem}
|
|
.test{margin:20px 0;padding:16px;background:rgba(255,255,255,0.05);border-radius:10px;border:1px solid rgba(255,255,255,0.1)}
|
|
.test h3{color:#fff;margin:0 0 10px;font-size:1rem}
|
|
.result{padding:10px;border-radius:6px;margin:8px 0;font-size:0.9rem}
|
|
.ok{background:rgba(74,222,128,0.1);border:1px solid rgba(74,222,128,0.3);color:#4ade80}
|
|
.err{background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.3);color:#ef4444}
|
|
.pending{background:rgba(251,191,36,0.1);border:1px solid rgba(251,191,36,0.3);color:#fbbf24}
|
|
.school-item{padding:6px 0;border-bottom:1px solid rgba(255,255,255,0.05);font-size:0.88rem;color:#ccc}
|
|
button{padding:8px 16px;background:#667eea;color:#fff;border:none;border-radius:6px;cursor:pointer;margin:4px}
|
|
button:hover{opacity:0.85}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>🔧 功能自检</h1>
|
|
|
|
<div class="test">
|
|
<h3>1. 页面基础信息</h3>
|
|
<div id="pageInfo" class="result pending">检测中...</div>
|
|
</div>
|
|
|
|
<div class="test">
|
|
<h3>2. 学校搜索 API</h3>
|
|
<button onclick="testSchool()">测试搜索「郑州大学」</button>
|
|
<div id="schoolResult" class="result pending">点击按钮开始测试</div>
|
|
</div>
|
|
|
|
<div class="test">
|
|
<h3>3. 概率计算 API</h3>
|
|
<button onclick="testProb()">测试 580分 物理类</button>
|
|
<div id="probResult" class="result pending">点击按钮开始测试</div>
|
|
</div>
|
|
|
|
<div class="test">
|
|
<h3>4. AI 对话 API</h3>
|
|
<button onclick="testChat()">测试发送消息</button>
|
|
<div id="chatResult" class="result pending">点击按钮开始测试</div>
|
|
</div>
|
|
|
|
<div class="test">
|
|
<h3>5. CSS 下拉框可见性测试</h3>
|
|
<label style="display:block;margin:10px 0;font-weight:500">科类选择:</label>
|
|
<select style="padding:12px 16px;background:rgba(255,255,255,0.12);border:2px solid rgba(255,255,255,0.3);border-radius:8px;color:#e0e0e0;font-size:1rem;width:100%;max-width:400px">
|
|
<option>物理类(理科)</option>
|
|
<option>历史类(文科)</option>
|
|
</select>
|
|
<div style="margin-top:8px;font-size:0.85rem;color:#888">如果上面这个下拉框的文字和箭头都清晰可见,说明CSS已修复</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('pageInfo').innerHTML =
|
|
'URL: ' + location.href + '<br>' +
|
|
'User Agent: ' + navigator.userAgent.substring(0, 50) + '...<br>' +
|
|
'屏幕宽度: ' + screen.width + 'px';
|
|
|
|
function testSchool(){
|
|
var el = document.getElementById('schoolResult');
|
|
el.className = 'result pending';
|
|
el.textContent = '请求中...';
|
|
var kw = '郑州大学';
|
|
fetch('/api/school/search?q=' + encodeURIComponent(kw) + '&subject=' + encodeURIComponent('物理类'))
|
|
.then(function(r){
|
|
if(!r.ok) throw new Error('HTTP ' + r.status);
|
|
return r.json();
|
|
})
|
|
.then(function(d){
|
|
var schools = d.schools || [];
|
|
if(schools.length === 0){
|
|
el.className = 'result err';
|
|
el.innerHTML = '❌ API返回0条结果。请截图反馈给管理员。';
|
|
return;
|
|
}
|
|
el.className = 'result ok';
|
|
el.innerHTML = '✅ 搜索正常!找到 ' + schools.length + ' 条结果:<br>' +
|
|
schools.slice(0,5).map(function(s){
|
|
return '<div class="school-item">'+s.school+' | '+s.score+'分 | 位次'+Number(s.rank).toLocaleString()+'</div>';
|
|
}).join('');
|
|
})
|
|
.catch(function(e){
|
|
el.className = 'result err';
|
|
el.textContent = '❌ 请求失败: ' + e.message;
|
|
});
|
|
}
|
|
|
|
function testProb(){
|
|
var el = document.getElementById('probResult');
|
|
el.className = 'result pending';
|
|
el.textContent = '请求中...';
|
|
fetch('/api/prob', {
|
|
method:'POST',
|
|
headers:{'Content-Type':'application/json'},
|
|
body:JSON.stringify({score:580, subject:'物理类'})
|
|
})
|
|
.then(function(r){ if(!r.ok) throw new Error('HTTP '+r.status); return r.json(); })
|
|
.then(function(d){
|
|
el.className = 'result ok';
|
|
el.innerHTML = '✅ 正常!rank='+d.rank+'<br>冲:'+d.chong.length+'所 稳:'+d.wen.length+'所 保:'+d.bao.length+'所';
|
|
})
|
|
.catch(function(e){
|
|
el.className = 'result err';
|
|
el.textContent = '❌ 失败: ' + e.message;
|
|
});
|
|
}
|
|
|
|
function testChat(){
|
|
var el = document.getElementById('chatResult');
|
|
el.className = 'result pending';
|
|
el.textContent = '请求中(AI响应需要几秒)...';
|
|
fetch('/chat', {
|
|
method:'POST',
|
|
headers:{'Content-Type':'application/json'},
|
|
body:JSON.stringify({message:'说hello'})
|
|
})
|
|
.then(function(r){ if(!r.ok) throw new Error('HTTP '+r.status); return r.json(); })
|
|
.then(function(d){
|
|
var reply = d.reply || d.message || '';
|
|
el.className = 'result ok';
|
|
el.innerHTML = '✅ AI正常!回复'+reply.length+'字:<br><div style="margin-top:8px;padding:10px;background:rgba(255,255,255,0.04);border-radius:6px;font-size:0.88rem;color:#ccc">'+reply.substring(0,150)+'</div>';
|
|
})
|
|
.catch(function(e){
|
|
el.className = 'result err';
|
|
el.textContent = '❌ 失败: ' + e.message;
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |