This commit is contained in:
2025-09-05 07:05:22 +08:00
parent e5fbdcc76b
commit 4dc5554c0c
6 changed files with 7 additions and 4 deletions

View File

@@ -70,18 +70,17 @@ async def generate_dao_xue_an(request: Request):
try:
yield "data: 正在转换为Word文档...\n\n"
# 执行Pandoc命令
# 恢复Pandoc转换执行代码
result = subprocess.run(
["pandoc", temp_md_path, "-o", docx_path],
capture_output=True,
text=True,
check=True
)
# 清理临时文件
os.unlink(temp_md_path)
logger.info(f"导学案已转换为Word文档: {docx_path}")
# 添加转换完成状态提示
yield "data: Word文档转换完成准备下载...\n\n"
# 修改下载链接为静态文件路径
yield f"data: [下载链接] /static/teacherHelpergenerated_files/{docx_filename}\n\n"
except subprocess.CalledProcessError as e: