|
|
|
@ -84,16 +84,6 @@
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.loader {
|
|
|
|
|
border: 4px solid #f3f3f3;
|
|
|
|
|
border-top: 4px solid #3498db;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
width: 30px;
|
|
|
|
|
height: 30px;
|
|
|
|
|
animation: spin 2s linear infinite;
|
|
|
|
|
margin: 20px auto;
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes spin {
|
|
|
|
|
0% {
|
|
|
|
@ -193,8 +183,7 @@
|
|
|
|
|
|
|
|
|
|
<div class="input-area">
|
|
|
|
|
<label for="questionInput"></label><textarea id="questionInput" placeholder="请输入您的问题..."></textarea>
|
|
|
|
|
|
|
|
|
|
<div class="examples">
|
|
|
|
|
<div class="examples">
|
|
|
|
|
<div class="example-category">
|
|
|
|
|
<h3>知识库内问题示例:</h3>
|
|
|
|
|
<div class="example-list">
|
|
|
|
@ -239,13 +228,12 @@
|
|
|
|
|
<button id="clearBtn" onclick="clearAll()"><span class="icon">🗑️</span>清空</button>
|
|
|
|
|
<button id="saveWordBtn" onclick="saveToWord()"><span class="icon">📄</span>保存为Word</button>
|
|
|
|
|
|
|
|
|
|
<div class="loader" id="loader"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
// 禁用所有按钮
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
|
const buttons = document.querySelectorAll('button');
|
|
|
|
|
buttons.forEach(btn => btn.disabled = true);
|
|
|
|
|
});
|
|
|
|
@ -294,11 +282,9 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const selectedDocs = Array.from(checkboxes).map(cb => cb.value);
|
|
|
|
|
const loader = document.getElementById('loader');
|
|
|
|
|
const answerArea = document.getElementById('answerArea');
|
|
|
|
|
|
|
|
|
|
answerArea.innerHTML = '';
|
|
|
|
|
loader.style.display = 'block';
|
|
|
|
|
|
|
|
|
|
const data = {
|
|
|
|
|
query: question,
|
|
|
|
@ -321,10 +307,7 @@
|
|
|
|
|
|
|
|
|
|
function processChunk() {
|
|
|
|
|
return reader.read().then(({done, value}) => {
|
|
|
|
|
if (done) {
|
|
|
|
|
loader.style.display = 'none';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (done) return;
|
|
|
|
|
|
|
|
|
|
buffer += decoder.decode(value, {stream: true});
|
|
|
|
|
const lines = buffer.split('\n');
|
|
|
|
@ -356,7 +339,6 @@
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
console.error('Error:', error);
|
|
|
|
|
loader.style.display = 'none';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -380,9 +362,6 @@
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loader = document.getElementById('loader');
|
|
|
|
|
|
|
|
|
|
loader.style.display = 'block';
|
|
|
|
|
|
|
|
|
|
fetch('/api/save-word', {
|
|
|
|
|
method: 'POST',
|
|
|
|
@ -395,7 +374,6 @@
|
|
|
|
|
})
|
|
|
|
|
.then(response => response.blob())
|
|
|
|
|
.then(blob => {
|
|
|
|
|
loader.style.display = 'none';
|
|
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
|
|
const a = document.createElement('a');
|
|
|
|
|
a.href = url;
|
|
|
|
@ -406,7 +384,6 @@
|
|
|
|
|
document.body.removeChild(a);
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
loader.style.display = 'none';
|
|
|
|
|
console.error('Error:', error);
|
|
|
|
|
alert('保存失败,请稍后再试!');
|
|
|
|
|
});
|
|
|
|
|