'commit'
This commit is contained in:
@@ -59,6 +59,16 @@ async def generate_dao_xue_an(request: Request):
|
||||
# 获取难度参数(默认为"默认难度")
|
||||
difficulty = params.get("difficulty", "默认难度")
|
||||
|
||||
# 难度级别中英文映射
|
||||
difficulty_map = {
|
||||
"basic": "基础",
|
||||
"intermediate": "提高",
|
||||
"advanced": "进阶",
|
||||
"默认难度": "默认难度"
|
||||
}
|
||||
# 转换为中文难度名称
|
||||
chinese_difficulty = difficulty_map.get(difficulty, difficulty)
|
||||
|
||||
# 生成唯一文件名
|
||||
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
|
||||
@@ -68,7 +78,7 @@ async def generate_dao_xue_an(request: Request):
|
||||
temp_md_path = temp_md.name
|
||||
|
||||
# 使用Pandoc转换为Word
|
||||
docx_filename = f"导学案_{difficulty}_{timestamp}.docx"
|
||||
docx_filename = f"导学案_{chinese_difficulty}_{timestamp}.docx"
|
||||
docx_path = os.path.join(save_dir, docx_filename)
|
||||
|
||||
try:
|
||||
|
Reference in New Issue
Block a user