fix: load api_config before generate_pdf call in export_pdf
This commit is contained in:
@@ -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 "(无)")
|
||||
|
||||
Reference in New Issue
Block a user