Phase3: 三平台封面图生成

- cover_generator.py: Pillow生成知乎/微信/小红书封面图(渐变背景+标题)
- 知乎 1200×630 蓝调, 微信 900×500 绿调, 小红书 1080×1440 红调
- creator.py 流水线增加 cover_generator 作为最终回退
- db_helper.py 新增 save_cover_to_article
- main.py 挂载 /automation/images 静态目录
- articles.py preview 接口返回 images 字段
- topics.html 预览dialog展示封面图
This commit is contained in:
Yuzhiran Dev
2026-05-20 19:12:58 +08:00
parent 40a77cad2c
commit c8bee712d7
6 changed files with 237 additions and 5 deletions
+7
View File
@@ -95,6 +95,13 @@ app.include_router(platform_config.router)
app.include_router(collector_mgmt.router)
app.include_router(assistant.router)
# 挂载自动生成的图片(必须先于前端根挂载)
PROJECT_ROOT_DIR = Path(__file__).parent.parent.parent.parent
AUTOMATION_IMAGES_DIR = PROJECT_ROOT_DIR / "automation" / "images"
if AUTOMATION_IMAGES_DIR.exists():
app.mount("/automation/images", StaticFiles(directory=str(AUTOMATION_IMAGES_DIR)), name="images")
logger.info(f"Images mounted at /automation/images from {AUTOMATION_IMAGES_DIR}")
# 挂载前端
FRONTEND_DIR = Path(__file__).parent.parent.parent / "frontend"
if FRONTEND_DIR.exists() and (FRONTEND_DIR / "index.html").exists():