main
HuangHai 4 weeks ago
parent 071c8f2adc
commit 9b670fb398

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>分数与数感解析</title>
</head>
<body>
<h1>分数与数感解析</h1>
<h2>什么是数感?</h2>
<p>数感是《义务教育数学课程标准》提出的十大核心概念之一,指对<strong>数与数量、数量关系及运算结果估计的感悟</strong>。其核心在于:</p>
<ul>
<li><strong>抽象与回归</strong>数是对数量的抽象舍去现实背景同时需建立数与现实背景的联系如100粒黄豆与100匹马的实际差异</li>
<li><strong>现实应用</strong>帮助判断数的实际意义如100元买菜与购房的差异培养对运算结果的直觉如1/2+3/8是否大于1</li>
<li><strong>数学素养</strong>:通过估算数量(如教室人数、场地大小)和选择量纲(如促销让利单位),提升解释现实的能力。</li>
</ul>
<h2>数的运算与扩展</h2>
<p>数的运算基于自然数加法扩展而来:</p>
<ul>
<li><strong>四则运算</strong>:加法衍生减法(逆运算)、乘法(加法重复)、除法(乘法逆运算)。</li>
<li><strong>数集扩张</strong>:为保证运算封闭性,自然数→整数(减法)、整数→有理数(除法)。</li>
<li><strong>符号与模型</strong>:符号表示推动代数发展,加法/乘法模型是小学数学应用问题的核心。</li>
</ul>
<h2>平均数的统计学意义</h2>
<p>平均数在统计学中通过<strong>误差模型</strong>体现其重要性:</p>
<ul>
<li><strong>误差模型</strong>x=μ+ε(观测值=真值+随机误差),多次观测后误差正负抵消,样本平均数≈真值。</li>
<li><strong>无偏估计</strong>:平均数作为真值的估计,满足随机性要求(无系统误差)。</li>
<li><strong>教学渗透</strong>:小学阶段可通过实例渗透数据分析思想(如多次测量取平均)。</li>
</ul>
<p><em>注:以上内容整合自数感、运算及平均数相关理论,强调数学抽象与现实联系的平衡。</em></p>
</body>
</html>

@ -0,0 +1,365 @@
<!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: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
.container {
background: white;
padding: 30px;
margin-right: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
text-align: center;
margin-bottom: 30px;
}
.data-area {
border: 1px solid #ddd;
border-radius: 5px;
padding: 15px;
min-height: 300px;
max-height: 400px;
min-width: 600px;
width: calc(100% - 20px);
overflow-y: auto;
background-color: #f8f9fa;
font-family: 'Courier New', monospace;
font-size: 14px;
line-height: 1.6;
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
margin-bottom: 20px;
margin-right: 20px;
}
.input-area {
display: flex;
gap: 10px;
}
#questionInput {
flex: 1;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
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;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
#submitBtn:hover {
background-color: #0056b3;
}
#clearBtn {
background-color: #f44336;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
#clearBtn:hover {
background-color: #d32f2f;
}
#saveWordBtn {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
display: flex;
align-items: center;
gap: 8px;
}
#saveWordBtn:hover {
background-color: #45a049;
}
.status {
text-align: center;
margin-bottom: 20px;
font-weight: bold;
}
.status.connecting {
color: #ffc107;
}
.status.connected {
color: #28a745;
}
.status.error {
color: #dc3545;
}
.status.completed {
color: #17a2b8;
}
.model {
margin-bottom: 30px;
padding: 15px;
border-left: 4px solid #007bff;
background: #f8f9fa;
word-wrap: break-word;
white-space: pre-wrap;
overflow-wrap: break-word;
}
.model-title {
color: #007bff;
margin-bottom: 15px;
}
.model-definition {
font-weight: bold;
}
.model-expression {
font-family: monospace;
background: #e9ecef;
padding: 5px;
}
/* 更新文档链接样式 */
.doc-links {
display: flex;
flex-direction: row;
gap: 20px;
align-items: center;
margin-bottom: 20px;
}
.doc-links h3 {
margin: 0;
color: #666;
font-size: 16px;
}
.doc-link {
padding: 8px 16px;
background-color: #f0f0f0;
border-radius: 4px;
text-decoration: none;
color: #333;
transition: all 0.3s ease;
}
.doc-link:hover {
background-color: #e0e0e0;
transform: translateY(-2px);
}
</style>
</head>
<body>
<div class="container">
<h1>【小学数学】专用大模型问答</h1>
<div class="doc-links">
<h3>原稿下载:</h3>
<a href="/static/Txt/小学数学教学中的若干问题.docx" class="doc-link">小学数学教学中的若干问题</a>
<a href="/static/Txt/小学数学知识点.docx" class="doc-link">小学数学知识点</a>
</div>
<div id="status" class="status">准备就绪</div>
<div class="data-area" id="dataArea">等待问题...</div>
<div class="input-area">
<input type="text" id="questionInput" placeholder="请输入您的问题,例如:小学数学的学习方法">
<button id="submitBtn" onclick="submitQuestion()">提问</button>
<button id="clearBtn" onclick="clearAll()">清空</button>
<button id="saveWordBtn" onclick="saveToWord()">
<span class="text">保存为Word</span>
</button>
</div>
<!-- 新增示例问题区域 -->
<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() {
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) {
alert('请输入问题!');
return;
}
const statusDiv = document.getElementById('status');
const dataArea = document.getElementById('dataArea');
const submitBtn = document.getElementById('submitBtn');
// 清空之前的数据
dataArea.textContent = '';
textBuffer = '';
// 禁用按钮
submitBtn.disabled = true;
submitBtn.textContent = '处理中...';
// 更新状态
statusDiv.textContent = '生成中...';
statusDiv.className = 'status connecting';
// 使用fetch发送POST请求并获取完整响应
fetch('/api/rag', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({query: question})
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then(data => {
dataArea.innerHTML = data.data;
statusDiv.textContent = '回答完成';
statusDiv.className = 'status completed';
submitBtn.disabled = false;
submitBtn.textContent = '提问';
})
.catch(error => {
console.error('请求错误:', error);
statusDiv.textContent = `请求错误: ${error.message}`;
statusDiv.className = 'status error';
submitBtn.disabled = false;
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>

@ -3,127 +3,67 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小学数学大模型问答</title>
<title>小学数学问答系统</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
font-family: 'Microsoft YaHei', sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
.container {
background: white;
padding: 30px;
margin-right: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
h1 {
color: #333;
text-align: center;
margin-bottom: 30px;
}
.data-area {
border: 1px solid #ddd;
border-radius: 5px;
padding: 15px;
min-height: 300px;
max-height: 400px;
min-width: 600px;
width: calc(100% - 20px);
overflow-y: auto;
background-color: #f8f9fa;
font-family: 'Courier New', monospace;
font-size: 14px;
line-height: 1.6;
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
background-color: white;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
margin-right: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.input-area {
display: flex;
gap: 10px;
background-color: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
#questionInput {
flex: 1;
textarea {
width: 100%;
height: 100px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
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 {
border-radius: 4px;
resize: vertical;
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;
button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s;
margin-right: 10px;
}
#submitBtn:hover {
background-color: #0056b3;
button:hover {
background-color: #45a049;
}
#clearBtn {
background-color: #f44336;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
#clearBtn:hover {
@ -131,234 +71,271 @@
}
#saveWordBtn {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
display: flex;
align-items: center;
gap: 8px;
background-color: #2196F3;
}
#saveWordBtn:hover {
background-color: #45a049;
background-color: #0b7dda;
}
.status {
text-align: center;
margin-bottom: 20px;
font-weight: bold;
.icon {
margin-right: 5px;
}
.status.connecting {
color: #ffc107;
.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;
}
.status.connected {
color: #28a745;
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.status.error {
color: #dc3545;
.doc-links {
display: flex;
gap: 20px;
margin: 20px 0;
align-items: center;
}
.status.completed {
color: #17a2b8;
.doc-link {
padding: 8px 15px;
background-color: #e7f3fe;
border-radius: 4px;
color: #2196F3;
text-decoration: none;
transition: all 0.3s;
}
.model {
margin-bottom: 30px;
padding: 15px;
border-left: 4px solid #007bff;
background: #f8f9fa;
word-wrap: break-word;
white-space: pre-wrap;
overflow-wrap: break-word;
.doc-link:hover {
background-color: #d0e3fa;
}
.model-title {
color: #007bff;
margin-bottom: 15px;
.doc-checkboxes {
display: flex;
gap: 20px;
margin-bottom: 10px;
}
.doc-checkboxes label {
display: flex;
align-items: center;
gap: 5px;
cursor: pointer;
}
.model-definition {
font-weight: bold;
.examples {
margin: 20px 0;
}
.model-expression {
font-family: monospace;
background: #e9ecef;
padding: 5px;
.example-category {
margin-bottom: 15px;
}
/* 更新文档链接样式 */
.doc-links {
display: flex;
flex-direction: row;
gap: 20px;
align-items: center;
margin-bottom: 20px;
.example-category h3 {
margin-bottom: 10px;
color: #333;
}
.doc-links h3 {
margin: 0;
color: #666;
font-size: 16px;
.example-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.doc-link {
padding: 8px 16px;
background-color: #f0f0f0;
.example-item {
padding: 8px 12px;
background-color: #e9f5ff;
border-radius: 4px;
text-decoration: none;
color: #333;
transition: all 0.3s ease;
cursor: pointer;
transition: all 0.2s;
}
.doc-link:hover {
background-color: #e0e0e0;
transform: translateY(-2px);
.example-item:hover {
background-color: #d0e3fa;
}
#questionInput {
height: 40px; /* 固定高度 */
resize: none; /* 禁止调整大小 */
}
#answerArea {
min-height: 240px; /* 12行高度 */
height: auto;
overflow-y: auto; /* 添加滚动条 */
}
</style>
</head>
<body>
<div class="container">
<h1>【小学数学】专用大模型问答</h1>
<div class="doc-links">
<h3>原稿下载:</h3>
<a href="/static/Txt/小学数学教学中的若干问题.docx" class="doc-link">小学数学教学中的若干问题</a>
<a href="/static/Txt/小学数学知识点.docx" class="doc-link">小学数学知识点</a>
</div>
<div id="status" class="status">准备就绪</div>
<div class="data-area" id="dataArea">等待问题...</div>
<div class="input-area">
<input type="text" id="questionInput" placeholder="请输入您的问题,例如:小学数学的学习方法">
<button id="submitBtn" onclick="submitQuestion()">提问</button>
<button id="clearBtn" onclick="clearAll()">清空</button>
<button id="saveWordBtn" onclick="saveToWord()">
<span class="text">保存为Word</span>
</button>
<h1>小学数学问答系统</h1>
<div class="data-area" id="answerArea">
<!-- 回答内容将在这里显示 -->
</div>
<!-- 新增示例问题区域 -->
<div class="example-questions">
<h3>示例问题</h3>
<div class="example-group">
<h4>知识库中包含的内容:</h4>
<ul>
<li onclick="fillQuestion('小学数学中有哪些模型?')">小学数学中有哪些模型?</li>
<li onclick="fillQuestion('帮我写一下 “如何理解点、线、面、体、角”的教学设计')">帮我写一下
"如何理解点、线、面、体、角"的教学设计
</li>
</ul>
<div class="input-area">
<textarea id="questionInput" placeholder="请输入您的问题..."></textarea>
<div class="examples">
<div class="example-category">
<h3>知识库内问题示例:</h3>
<div class="example-list">
<div class="example-item" onclick="fillExample('什么是分数?')">什么是分数?</div>
<div class="example-item" onclick="fillExample('如何计算圆的面积?')">如何计算圆的面积?</div>
<div class="example-item" onclick="fillExample('乘法分配律是什么?')">乘法分配律是什么?</div>
</div>
</div>
<div class="example-category">
<h3>知识库外问题示例:</h3>
<div class="example-list">
<div class="example-item" onclick="fillExample('微积分的基本定理是什么?')">微积分的基本定理是什么?
</div>
<div class="example-item" onclick="fillExample('如何证明勾股定理?')">如何证明勾股定理?</div>
<div class="example-item" onclick="fillExample('线性代数在AI中的应用')">线性代数在AI中的应用</div>
</div>
</div>
</div>
<div class="example-group">
<h4>知识库中不包含的内容:</h4>
<ul>
<li onclick="fillQuestion('你知道黄海是谁吗?')">你知道黄海是谁吗?</li>
</ul>
<div class="doc-links">
<h3>原稿下载:</h3>
<div class="doc-checkboxes">
<label>
<input type="checkbox" name="documents" value="MATH_DATA_1">
小学数学教学中的若干问题
</label>
<label>
<input type="checkbox" name="documents" value="MATH_DATA_2">
小学数学知识点
</label>
</div>
<a href="/static/Txt/小学数学教学中的若干问题.docx" class="doc-link">下载</a>
<a href="/static/Txt/小学数学知识点.docx" class="doc-link">下载</a>
</div>
<button id="submitBtn" onclick="submitQuestion()"><span class="icon">💡</span>提问</button>
<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>
// 新增填充问题的函数
function fillQuestion(question) {
function fillExample(question) {
document.getElementById('questionInput').value = question;
}
// 保留原有JavaScript函数
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();
const checkboxes = document.querySelectorAll('input[name="documents"]:checked');
if (!question) {
alert('请输入问题!');
return;
}
const statusDiv = document.getElementById('status');
const dataArea = document.getElementById('dataArea');
const submitBtn = document.getElementById('submitBtn');
// 清空之前的数据
dataArea.textContent = '';
textBuffer = '';
if (checkboxes.length === 0) {
alert('请至少选择一个原稿!');
return;
}
// 禁用按钮
submitBtn.disabled = true;
submitBtn.textContent = '处理中...';
const selectedDocs = Array.from(checkboxes).map(cb => cb.value);
const loader = document.getElementById('loader');
// 更新状态
statusDiv.textContent = '生成中...';
statusDiv.className = 'status connecting';
loader.style.display = 'block';
// 使用fetch发送POST请求并获取完整响应
fetch('/api/rag', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({query: question})
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
body: JSON.stringify({
query: question,
documents: selectedDocs
})
})
.then(response => response.json()) // 改回使用json()
.then(data => {
dataArea.innerHTML = data.data;
statusDiv.textContent = '回答完成';
statusDiv.className = 'status completed';
submitBtn.disabled = false;
submitBtn.textContent = '提问';
loader.style.display = 'none';
if (data && data.data) {
document.getElementById('answerArea').innerHTML = data.data;
} else {
alert('服务器返回了无效数据');
}
})
.catch(error => {
console.error('请求错误:', error);
statusDiv.textContent = `请求错误: ${error.message}`;
statusDiv.className = 'status error';
submitBtn.disabled = false;
submitBtn.textContent = '提问';
loader.style.display = 'none';
console.error('Error:', error);
alert('请求失败: ' + error.message);
});
}
async function saveToWord() {
const htmlContent = document.getElementById('dataArea').innerHTML;
function clearAll() {
document.getElementById('questionInput').value = '';
document.getElementById('answerArea').innerHTML = '';
document.querySelectorAll('input[name="documents"]').forEach(cb => cb.checked = false);
}
try {
const response = await fetch('/api/save-word', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({html_content: htmlContent})
});
function saveToWord() {
const htmlContent = document.getElementById('answerArea').innerHTML;
const checkboxes = document.querySelectorAll('input[name="documents"]:checked');
if (!response.ok) throw new Error('请求失败');
if (!htmlContent) {
alert('没有内容可保存!');
return;
}
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);
if (checkboxes.length === 0) {
alert('请至少选择一个原稿!');
return;
}
const selectedDocs = Array.from(checkboxes).map(cb => cb.value);
const loader = document.getElementById('loader');
loader.style.display = 'block';
fetch('/api/save-word', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
html_content: htmlContent,
documents: selectedDocs
})
})
.then(response => response.blob())
.then(blob => {
loader.style.display = 'none';
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);
document.body.removeChild(a);
})
.catch(error => {
loader.style.display = 'none';
console.error('Error:', error);
alert('保存失败,请稍后再试!');
});
}
</script>
</body>

Loading…
Cancel
Save