fix: save watermark_text in update_api_config
This commit is contained in:
@@ -73,6 +73,7 @@ def update_api_config():
|
|||||||
"model": data.get("model", "doubao-seed-2.0-pro"),
|
"model": data.get("model", "doubao-seed-2.0-pro"),
|
||||||
"temperature": float(data.get("temperature", 0.7)),
|
"temperature": float(data.get("temperature", 0.7)),
|
||||||
"prompt_template": data.get("prompt_template", ""),
|
"prompt_template": data.get("prompt_template", ""),
|
||||||
|
"watermark_text": data.get("watermark_text", ""),
|
||||||
}
|
}
|
||||||
|
|
||||||
save_api_config(config, current_app.config)
|
save_api_config(config, current_app.config)
|
||||||
|
|||||||
@@ -275,7 +275,6 @@ def generate_pdf(plan_id, student_name, content, output_dir, rendered_report=Non
|
|||||||
if not watermark_text:
|
if not watermark_text:
|
||||||
return
|
return
|
||||||
if not CHINESE_FONT_OK:
|
if not CHINESE_FONT_OK:
|
||||||
print(f"[WATERMARK] Skipping watermark - CHINESE_FONT_OK=False, FONT_PATH={FONT_PATH}")
|
|
||||||
return
|
return
|
||||||
c.saveState()
|
c.saveState()
|
||||||
try:
|
try:
|
||||||
@@ -287,9 +286,8 @@ def generate_pdf(plan_id, student_name, content, output_dir, rendered_report=Non
|
|||||||
c.rotate(45)
|
c.rotate(45)
|
||||||
# 绘制水印文字(居中)
|
# 绘制水印文字(居中)
|
||||||
c.drawCentredString(0, 0, watermark_text)
|
c.drawCentredString(0, 0, watermark_text)
|
||||||
print(f"[WATERMARK] Drawn: {watermark_text}")
|
except Exception:
|
||||||
except Exception as e:
|
pass
|
||||||
print(f"[WATERMARK] Error: {e}")
|
|
||||||
c.restoreState()
|
c.restoreState()
|
||||||
|
|
||||||
doc.build(pdf.elements, onFirstPage=draw_watermark, onLaterPages=draw_watermark)
|
doc.build(pdf.elements, onFirstPage=draw_watermark, onLaterPages=draw_watermark)
|
||||||
|
|||||||
Reference in New Issue
Block a user