fix: load api_config before generate_pdf call in export_pdf

This commit is contained in:
hmo
2026-04-27 20:17:20 +08:00
parent c8d77187d1
commit 994e97fec1
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -626,6 +626,10 @@ def export_pdf(plan_id):
except:
pass
# 获取API配置(水印文本等)
from app.config import load_api_config
api_config = load_api_config(current_app.config)
# 如果有模板,先渲染
rendered_report = None
if report_template:
@@ -650,6 +654,7 @@ def export_pdf(plan_id):
rendered_report = rendered_report.replace("{ai_report}", "(未生成AI报告)")
problem_tags = ""
for problem in content.get('problems', []):
problem_tags += f"- **{problem.get('name', '')}** ({problem.get('severity', '')})\n"
rendered_report = rendered_report.replace("{problem_tags}", problem_tags or "(无)")