main
HuangHai 4 weeks ago
parent d5adc3690d
commit 68c3ee4cb0

@ -73,6 +73,21 @@
background-color: #0056b3;
}
#clearBtn {
background-color: #6c757d;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
#clearBtn:hover {
background-color: #5a6268;
}
.status {
text-align: center;
margin-bottom: 20px;
@ -132,6 +147,7 @@
<div class="input-area">
<input type="text" id="questionInput" placeholder="请输入您的问题,例如:小学数学的学习方法">
<button id="submitBtn" onclick="submitQuestion()">提问</button>
<button id="clearBtn" onclick="clearAll()">清空</button>
</div>
</div>
@ -139,6 +155,13 @@
let eventSource = null;
let textBuffer = '';
function clearAll() {
document.getElementById('dataArea').innerHTML = '等待问题...';
document.getElementById('questionInput').value = '';
document.getElementById('status').textContent = '准备就绪';
document.getElementById('status').className = 'status';
}
function submitQuestion() {
const question = document.getElementById('questionInput').value.trim();
if (!question) {
@ -159,7 +182,7 @@
submitBtn.textContent = '处理中...';
// 更新状态
statusDiv.textContent = '正在连接...';
statusDiv.textContent = '生成中...';
statusDiv.className = 'status connecting';
// 使用fetch发送POST请求并获取完整响应

Loading…
Cancel
Save