@ -254,24 +210,42 @@ Provide constructive feedback that helps the student write like an American stud
-strengths:优点列表
-issues:问题列表
-suggestions:改进建议列表
-next_steps:下一步建议列表
"""
-next_steps:下一步建议列表"""
try:
result=quick_generate(
prompt=prompt,
model=model,
max_tokens=1500,
max_tokens=600,
grade=ctx_info['grade'],
subject=ctx_info['subject'],
topic=ctx_info['topic'],
requirement=f"分析{stage_name}阶段的写作内容",
json_mode=True,
temperature=0.3
json_mode=True,# 启用JSON模式
temperature=0.3# 降低温度以提高准确性
)
# 使用增强的JSON解析
returnrobust_json_parse(result)
# 尝试解析JSON响应
try:
returnjson.loads(result)
exceptjson.JSONDecodeError:
# 如果解析失败,尝试提取JSON部分
importre
json_match=re.search(r'\{.*\}',result,re.DOTALL)
ifjson_match:
try:
returnjson.loads(json_match.group())
exceptjson.JSONDecodeError:
pass
# 如果仍然失败,返回结构化的默认响应
return{
"strengths":["内容已提交"],
"issues":["AI分析格式异常"],
"suggestions":["建议重新分析"],
"next_steps":["继续完善内容"],
"raw_response":result
}
exceptExceptionase:
raiseException(f"分析内容失败: {str(e)}")
@ -366,360 +340,6 @@ Consider how well the student demonstrates understanding of the topic and expres
exceptExceptionase:
raiseException(f"评估文章失败: {str(e)}")
defcheck_grammar(self,content:str,context:Dict,
user_settings:Optional[Dict]=None)->Dict:
"""检查语法错误"""
settings=self._get_ai_settings(user_settings)
model=self._create_llm_model(settings)
# 提取上下文信息
ctx_info=self._extract_context_info(context)
# 根据学科制作不同的提示词
ifctx_info['subject']=='英语':
prompt=f"""As an experienced American English teacher, please conduct a comprehensive grammar check for this {ctx_info['article_type']} written by a {ctx_info['grade']} student.
prompt=f"""As an experienced American English writing instructor, please analyze this {ctx_info['article_type']} and identify basic vocabulary that can be upgraded to more sophisticated alternatives.
"writing_content":"Generative AI are a hot topic. Some peoples thinks it make students lazy. Because they just use AI to do they homework. This is not completely true. Actually, if use correct, AI can helps student learning better. For example, when a student don't understand a concept, they can asks AI for explain. It give instant answer, more better than just search online. But, student must to think by themselves first. Rely on AI too much is bad. It can damaging they ability for independent thinking. So, the key is balance. We should use AI like a tool, not a replacement of our brain. In conclude, AI have both positive and negative affects. It is depend on how we uses it.",
"ai_feedback":"{\"writing_analysis\": {\"strengths\": [\"观点辩证:学生能认识到AI的双面性,既指出过度依赖的危害,也肯定合理使用的价值\", \"结构完整:包含问题提出、正反论证和结论的基本框架\", \"立场明确:最终提出'关键在于平衡'的核心观点\", \"举例具体:用'不理解概念时询问AI'的案例支撑论点\"], \"issues\": [\"论点展开不足:缺乏分论点支撑,正反论证都停留在表面陈述\", \"学术规范缺失:没有明确的主题句和过渡词,段落间逻辑跳跃\", \"语言不地道:存在中式英语表达和语法错误\", \"论证深度不够:未涉及具体研究数据或教育理论支撑\", \"批判性思维薄弱:未分析AI如何具体影响不同学习能力的学生\"], \"suggestions\": [{\"讲解\": \"建立清晰论点结构,使用主题句+支撑句模式\", \"示例\": \"While critics argue that generative AI fosters academic laziness, this perspective overlooks its potential as a cognitive tool when used intentionally. For instance, AI can serve as a 24/7 learning partner that provides customized explanations...\"}, {\"讲解\": \"增加学术过渡词和逻辑连接\", \"示例\": \"Conversely, unmonitored AI use may indeed undermine metacognitive skills. A study by Stanford University found that students who over-relied on AI for problem-solving showed decreased ability to...\"}, {\"讲解\": \"用具体案例替代泛泛而谈\", \"示例\": \"In Mr. Johnson's 8th-grade science class, students using AI for hypothesis refinement scored 23% higher on critical thinking assessments than those using traditional methods...\"}, {\"讲解\": \"强化批判性分析维度\", \"示例\": \"The central dilemma isn't whether to use AI, but how to design usage protocols that maximize its scaffolding function while minimizing dependency. Educators might consider...\"}, {\"讲解\": \"使用更地道的学术表达\", \"示例\": \"Rather than replacing human intellect, generative AI should function as a collaborative tool that amplifies our cognitive capabilities—much like calculators enhanced mathematical reasoning without eliminating the need to understand core principles.\"}], \"next_steps\": [\"学习美国中学议论文的经典五段式结构(引言-论点1-论点2-反论点-结论)\", \"收集关于AI教育影响的具体研究数据和权威来源\", \"练习使用学术过渡词(however, furthermore, consequently等)\", \"阅读《纽约时报》教育版相关文章,观察地道议论文表达\", \"尝试写作时先建立论证大纲,再展开具体段落\"]}}",
"writing_content":"Generative AI, such as large language models, are becoming increasingly popular. They offers students a powerful tool for complete homework and generating ideas. However, its impact on learning ability are a subject of intense debate.\n\nOn one hand, it is argued that AI hinder the development of critical thinking. When a student rely on AI to write essays, they doesn't engage in the rigorous process of research and analysis their own. This lead to a superficial understanding and a failure to develop their own voice. Furthermore, the convenience of AI means that less effort are put into mastering fundamental skills, such as grammar and structuring arguments.",
"ai_feedback":"{\"writing_analysis\": {\"strengths\": [\"能够识别AI对学习的潜在负面影响,特别是批判性思维和基础技能方面,显示出对主题的基本理解\", \"尝试从不同角度展开讨论,体现了初步的论证意识\", \"使用了一些学术写作的基本元素,如'On one hand'这样的过渡词\"], \"issues\": [\"缺乏明确的中心论点(thesis statement),文章方向不清晰\", \"段落缺乏有力的主题句(topic sentence),论证结构松散\", \"语法错误较多,特别是主谓一致问题(如'are'代替'is','doesn't'代替'don't')\", \"论证深度不足,缺乏具体例证和深入分析\", \"语言表达不够地道,有些表达显得生硬或不自然\"], \"suggestions\": [{\"讲解\": \"在开头段落加入清晰的中心论点\", \"示例\": \"While generative AI offers unprecedented convenience for students, its overreliance ultimately undermines the very cognitive skills essential for meaningful learning—critical analysis, original thought, and academic integrity.\"}, {\"讲解\": \"为每个主体段落添加有力的主题句\", \"示例\": \"Perhaps the most significant concern is how AI dependency stunts the growth of critical thinking abilities that form the bedrock of genuine education.\"}, {\"讲解\": \"使用更自然的过渡词和表达方式\", \"示例\": \"Moreover, the instant gratification provided by AI tools creates a dangerous disincentive for developing foundational writing competencies.\"}, {\"讲解\": \"添加具体例证增强说服力\", \"示例\": \"For instance, when a student uses AI to generate a history paper instead of wrestling with primary sources, they miss the opportunity to develop their own historical interpretation and analytical voice—skills that simply cannot be outsourced to an algorithm.\"}, {\"讲解\": \"修正语法错误,使用更地道的表达\", \"示例\": \"This reliance leads to superficial understanding and prevents students from developing their unique academic voice, ultimately creating a generation of passive consumers rather than active creators of knowledge.\"}], \"next_steps\": [\"阅读几篇优秀的美国大学生议论文范文,注意观察其论点陈述和段落结构\", \"练习写作清晰的主题句,确保每个段落都有明确的中心思想\", \"重点复习英语主谓一致和时态等基础语法规则\", \"在论证中添加具体事例、数据或引用,增强说服力\", \"多使用美国学术写作中常见的过渡词和表达方式,如'furthermore', 'conversely', 'in light of this'等\"]}}",