This commit is contained in:
2025-09-05 07:52:23 +08:00
parent 3d5b4ddcf1
commit b45b93402b
2 changed files with 4 additions and 1 deletions

View File

@@ -56,6 +56,9 @@ async def generate_dao_xue_an(request: Request):
save_dir = os.path.join(project_root, "static", "teacherHelpergenerated_files") save_dir = os.path.join(project_root, "static", "teacherHelpergenerated_files")
os.makedirs(save_dir, exist_ok=True) os.makedirs(save_dir, exist_ok=True)
# 获取难度参数(默认为"默认难度"
difficulty = params.get("difficulty", "默认难度")
# 生成唯一文件名 # 生成唯一文件名
timestamp = datetime.now().strftime("%Y%m%d%H%M%S") timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
@@ -65,7 +68,7 @@ async def generate_dao_xue_an(request: Request):
temp_md_path = temp_md.name temp_md_path = temp_md.name
# 使用Pandoc转换为Word # 使用Pandoc转换为Word
docx_filename = f"导学案_{timestamp}.docx" docx_filename = f"导学案_{difficulty}_{timestamp}.docx"
docx_path = os.path.join(save_dir, docx_filename) docx_path = os.path.join(save_dir, docx_filename)
try: try: