|
|
|
@ -33,8 +33,8 @@
|
|
|
|
|
padding: 15px;
|
|
|
|
|
min-height: 300px;
|
|
|
|
|
max-height: 400px;
|
|
|
|
|
min-width: 600px; /* Added to ensure sufficient width */
|
|
|
|
|
width: calc(100% - 20px); /* Ensure it takes full available width minus margin */
|
|
|
|
|
min-width: 600px;
|
|
|
|
|
width: calc(100% - 20px);
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
background-color: #f8f9fa;
|
|
|
|
|
font-family: 'Courier New', monospace;
|
|
|
|
@ -60,6 +60,46 @@
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 新增示例问题区域样式 */
|
|
|
|
|
.example-questions {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
padding: 15px;
|
|
|
|
|
background: #f8f9fa;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.example-questions h3 {
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.example-group {
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.example-group h4 {
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.example-questions ul {
|
|
|
|
|
list-style: none;
|
|
|
|
|
padding-left: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.example-questions li {
|
|
|
|
|
padding: 5px 10px;
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
background: #e9ecef;
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.example-questions li:hover {
|
|
|
|
|
background: #dee2e6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 保留原有按钮样式 */
|
|
|
|
|
#submitBtn {
|
|
|
|
|
background-color: #007bff;
|
|
|
|
|
color: white;
|
|
|
|
@ -108,11 +148,6 @@
|
|
|
|
|
background-color: #45a049;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#saveWordBtn::before {
|
|
|
|
|
content: "\1F4C4"; /* Word文档图标 */
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status {
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
@ -176,38 +211,32 @@
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
async function saveToWord() {
|
|
|
|
|
const htmlContent = document.getElementById('dataArea').innerHTML;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch('/api/save-word', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ html_content: htmlContent })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!response.ok) throw new Error('请求失败');
|
|
|
|
|
|
|
|
|
|
const blob = await response.blob();
|
|
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
|
|
const a = document.createElement('a');
|
|
|
|
|
a.href = url;
|
|
|
|
|
a.download = '小学数学问答.docx';
|
|
|
|
|
document.body.appendChild(a);
|
|
|
|
|
a.click();
|
|
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
|
a.remove();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
alert('保存失败: ' + error.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<!-- 新增示例问题区域 -->
|
|
|
|
|
<div class="example-questions">
|
|
|
|
|
<h3>示例问题</h3>
|
|
|
|
|
<div class="example-group">
|
|
|
|
|
<h4>知识库中包含的内容:</h4>
|
|
|
|
|
<ul>
|
|
|
|
|
<li onclick="fillQuestion('小学数学中有哪些模型?')">小学数学中有哪些模型?</li>
|
|
|
|
|
<li onclick="fillQuestion('帮我写一下 “如何理解点、线、面、体、角”的教学设计')">帮我写一下 "如何理解点、线、面、体、角"的教学设计</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="example-group">
|
|
|
|
|
<h4>知识库中不包含的内容:</h4>
|
|
|
|
|
<ul>
|
|
|
|
|
<li onclick="fillQuestion('你知道黄海是谁吗?')">你知道黄海是谁吗?</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
// 新增填充问题的函数
|
|
|
|
|
function fillQuestion(question) {
|
|
|
|
|
document.getElementById('questionInput').value = question;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保留原有JavaScript函数
|
|
|
|
|
let textBuffer = '';
|
|
|
|
|
|
|
|
|
|
function clearAll() {
|
|
|
|
@ -217,7 +246,6 @@
|
|
|
|
|
document.getElementById('status').className = 'status';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function submitQuestion() {
|
|
|
|
|
const question = document.getElementById('questionInput').value.trim();
|
|
|
|
|
if (!question) {
|
|
|
|
@ -270,6 +298,34 @@
|
|
|
|
|
submitBtn.textContent = '提问';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function saveToWord() {
|
|
|
|
|
const htmlContent = document.getElementById('dataArea').innerHTML;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch('/api/save-word', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ html_content: htmlContent })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!response.ok) throw new Error('请求失败');
|
|
|
|
|
|
|
|
|
|
const blob = await response.blob();
|
|
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
|
|
const a = document.createElement('a');
|
|
|
|
|
a.href = url;
|
|
|
|
|
a.download = '小学数学问答.docx';
|
|
|
|
|
document.body.appendChild(a);
|
|
|
|
|
a.click();
|
|
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
|
a.remove();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
alert('保存失败: ' + error.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
</html>
|