diff --git a/dsRag/Start.py b/dsRag/Start.py index 71540369..1a0c069a 100644 --- a/dsRag/Start.py +++ b/dsRag/Start.py @@ -74,15 +74,14 @@ class SaveWordRequest(BaseModel): @app.post("/api/save-word") async def save_to_word(request: Request): - temp_html = None output_file = None try: # Parse request data try: data = await request.json() - html_content = data.get('html_content', '') - if not html_content: - raise ValueError("Empty HTML content") + markdown_content = data.get('markdown_content', '') + if not markdown_content: + raise ValueError("Empty MarkDown content") except Exception as e: logger.error(f"Request parsing failed: {str(e)}") raise HTTPException(status_code=400, detail=f"Invalid request: {str(e)}") @@ -90,7 +89,7 @@ async def save_to_word(request: Request): # 创建临时Markdown文件 temp_md = os.path.join(tempfile.gettempdir(), uuid.uuid4().hex + ".md") with open(temp_md, "w", encoding="utf-8") as f: - f.write(html_content) + f.write(markdown_content) # 使用pandoc转换 output_file = os.path.join(tempfile.gettempdir(), "【理想大模型】问答.docx") diff --git a/dsRag/Test/input.md b/dsRag/Test/input.md index d0dff46f..481ffa9f 100644 --- a/dsRag/Test/input.md +++ b/dsRag/Test/input.md @@ -1,27 +1,169 @@ -# 数学公式示例 +# 小学数学中有哪些模型? -## 基础公式 +## 什么是模型? -这是一个行内公式示例:$E=mc^2$ +在《义务教育数学课程标准》中提到的模型思想,强调的是用数学的语言讲述现实世界中的故事。模型不仅仅是数学算式或应用题,它是解决一类具有实际背景问题的数学方法。 -## 复杂公式 +--- -块级公式示例: +## 常见的小学数学模型 -$$\int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}$$ +### 总量模型(加法模型) -## 矩阵示例 +总量模型讨论的是**总量与部分量之间的关系**,其基本形式为: -$$\begin{pmatrix} -1 & 2 \\ -3 & 4 -\end{pmatrix}$$ +``` -## 方程组 +总量 = 部分量 + 部分量 -$$ -\begin{cases} -x + y = 5 \\ -2x - y = 1 -\end{cases} -$$ \ No newline at end of file +``` + +这种模型适用于解决涉及“总和”的问题,例如: + +- 图书室各类图书的总数 + +- 多件商品的总花费 + +也可以通过变换得到: + +``` + +部分量 = 总量 - 部分量 + +``` + +--- + +### 路程模型(乘法模型) + +路程模型描述的是**距离、速度与时间的关系**,其基本形式为: + +``` + +距离 = 速度 × 时间 + +``` + +这个模型不仅适用于路程问题,还可以推广到: + +- 总价 = 单价 × 数量 + +- 总数 = 行数 × 列数 + +也可以通过逆运算得到: + +``` + +速度 = 距离 ÷ 时间 + +时间 = 距离 ÷ 速度 + +``` + +#### 教学片段:通过速度理解路程模型 + +教师可通过情境引导学生思考如何比较两个人的速度快慢,从而引入速度概念: + +> 情境:小丽和小强上学所花时间不同,谁走得更快? + +引导学生理解: + +- 速度不仅与时间有关,还与距离有关 + +- 速度 = 距离 ÷ 时间 + +并通过单位换算帮助学生掌握速度单位(如千米/时、米/秒)。 + +![图片描述](./Images/MATH_1_13.jpeg) + +接着通过实际例子让学生计算速度: + +![图片描述](./Images/MATH_1_14.png) + +并进一步让学生讲述与速度有关的故事,结合生活经验理解模型。 + +--- + +### 植树模型 + +植树模型是在**直线或平面上按规律植树的问题**,主要探讨: + +- 洞的数量与植树数量之间的关系 + +- 间隔与棵树的关系 + +适用于现实生活中的资源分布问题,如: + +- 在一条道路上设立加油站 + +- 在一个区域设置商业点 + +小学阶段主要研究**直线上的植树问题**。 + +--- + +### 工程模型(归一问题) + +工程模型用于解决**多个团队合作完成任务的时间问题**,其核心是将整个工程看作“1”,然后根据各自效率进行分配。 + +例如: + +- 甲单独完成需要A天,则每天完成1/A + +- 乙单独完成需要B天,则每天完成1/B + +- 合作完成所需时间为:1 ÷ (1/A + 1/B) + +也可扩展为: + +- 注水与放水问题 + +- 多个工程队合作的情况 + +--- + +## 模型的变化与组合使用 + +模型不是孤立使用的,可以通过组合来解决更复杂的问题: + +例如: + +- 总量模型与路程模型结合使用 + +- 引入方程作为工具求解复杂关系 + +![图片描述](./Images/MATH_1_16.png) + +![图片描述](./Images/MATH_1_17.png) + +教师可以提出问题让学生解释这些算式的意义,并通过小组讨论讲述与模型相关的故事。 + +--- + +## 教学设计分析 + +对于小学生来说,理解抽象的数学模型有一定难度。因此教学应注重: + +- **创设真实情境** + +- **利用缺失信息引发思考** + +- **通过变化帮助学生感悟模型的一般性** + +比如,从“速度”入手理解路程模型,有助于学生真正掌握三者之间的关系,而不是仅仅记忆公式。 + +--- + +## 结语 + +小学数学中的模型包括但不限于: + +- 总量模型 + +- 路程模型 + +- 植树模型 + +- 工程模型 + +这些模型不仅是解决问题的工具,更是培养学生**发现问题、提出问题、分析问题、解决问题能力**的重要途径。通过“综合与实践”类的教学活动,可以帮助学生积累数学活动经验,形成初步的模型思想。 \ No newline at end of file diff --git a/dsRag/Test/output.docx b/dsRag/Test/output.docx index 789f4583..d3f102da 100644 Binary files a/dsRag/Test/output.docx and b/dsRag/Test/output.docx differ diff --git a/dsRag/Test/测试.bat b/dsRag/Test/测试.bat new file mode 100644 index 00000000..71309fb9 --- /dev/null +++ b/dsRag/Test/测试.bat @@ -0,0 +1 @@ +pandoc input.md -o output.docx --resource-path=static --from=markdown+hard_line_breaks --to=docx --standalone --verbose \ No newline at end of file diff --git a/dsRag/static/ai.html b/dsRag/static/ai.html index d5ff28af..347a3476 100644 --- a/dsRag/static/ai.html +++ b/dsRag/static/ai.html @@ -281,7 +281,9 @@ .then(data => { loader.style.display = 'none'; if (data && data.data) { - document.getElementById('answerArea').innerHTML = marked.parse(data.data); + const markdownContent = marked.parse(data.data); + document.getElementById('answerArea').innerHTML = markdownContent; + localStorage.setItem('lastMarkdownContent', data.data); } else { alert('服务器返回了无效数据'); } @@ -300,10 +302,10 @@ } function saveToWord() { - const htmlContent = document.getElementById('answerArea').innerHTML; + const markdownContent = localStorage.getItem('lastMarkdownContent') || ''; const checkboxes = document.querySelectorAll('input[name="tags"]:checked'); - if (!htmlContent) { + if (!markdownContent) { alert('没有内容可保存!'); return; } @@ -313,7 +315,6 @@ return; } - const selectTags = Array.from(checkboxes).map(cb => cb.value); const loader = document.getElementById('loader'); loader.style.display = 'block'; @@ -324,8 +325,7 @@ 'Content-Type': 'application/json' }, body: JSON.stringify({ - html_content: htmlContent, - tags: selectTags + markdown_content: markdownContent }) }) .then(response => response.blob())