feat: 平台配置表扩展配图/字数字段,微信公众号正文插入配图,合规检查从DB读规则

- PlatformConfig模型新增requires_image、image_count_min/max、image_width/height、min_words/max_words
- schemas.py同步PlatformConfigBase/Create/Update/Response新字段
- initial_data.py为三大平台填充初始值(微信需配图、字数800-1500等)
- database.py添加新列ALTER TABLE迁移
- platforms.html重写编辑弹窗(正确字段名+配图/字数设置)
- writer.py微信公众号文章正文h1后插入<img>占位
- compliance_checker.py接受platform_config参数,从DB读取规则替代硬编码
- compliance_optimizer.py启动时加载DB平台配置传入checker
This commit is contained in:
Yuzhiran Dev
2026-05-17 23:08:43 +08:00
parent 5674114599
commit 41b0f694ee
9 changed files with 174 additions and 51 deletions
+14
View File
@@ -263,6 +263,13 @@ class PlatformConfigBase(BaseModel):
compliance_rules: Dict[str, Any] = {}
default_format: Optional[str] = None
is_active: bool = True
requires_image: bool = False
image_count_min: int = 0
image_count_max: int = 0
image_width: int = 0
image_height: int = 0
min_words: int = 0
max_words: int = 0
class PlatformConfigCreate(PlatformConfigBase):
@@ -278,6 +285,13 @@ class PlatformConfigUpdate(BaseModel):
compliance_rules: Optional[Dict[str, Any]] = None
default_format: Optional[str] = None
is_active: Optional[bool] = None
requires_image: Optional[bool] = None
image_count_min: Optional[int] = None
image_count_max: Optional[int] = None
image_width: Optional[int] = None
image_height: Optional[int] = None
min_words: Optional[int] = None
max_words: Optional[int] = None
class PlatformConfigResponse(PlatformConfigBase):