fix: save watermark_text in update_api_config

This commit is contained in:
hmo
2026-04-27 20:22:45 +08:00
parent ec5bb62ad4
commit abfe1c2192
2 changed files with 3 additions and 4 deletions
+1
View File
@@ -73,6 +73,7 @@ def update_api_config():
"model": data.get("model", "doubao-seed-2.0-pro"),
"temperature": float(data.get("temperature", 0.7)),
"prompt_template": data.get("prompt_template", ""),
"watermark_text": data.get("watermark_text", ""),
}
save_api_config(config, current_app.config)
+2 -4
View File
@@ -275,7 +275,6 @@ def generate_pdf(plan_id, student_name, content, output_dir, rendered_report=Non
if not watermark_text:
return
if not CHINESE_FONT_OK:
print(f"[WATERMARK] Skipping watermark - CHINESE_FONT_OK=False, FONT_PATH={FONT_PATH}")
return
c.saveState()
try:
@@ -287,9 +286,8 @@ def generate_pdf(plan_id, student_name, content, output_dir, rendered_report=Non
c.rotate(45)
# 绘制水印文字(居中)
c.drawCentredString(0, 0, watermark_text)
print(f"[WATERMARK] Drawn: {watermark_text}")
except Exception as e:
print(f"[WATERMARK] Error: {e}")
except Exception:
pass
c.restoreState()
doc.build(pdf.elements, onFirstPage=draw_watermark, onLaterPages=draw_watermark)