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:
@@ -81,11 +81,18 @@ def import_initial_data():
|
||||
"icon": "🔍",
|
||||
"default_format": "长文深度分析,1500-3000字,有数据支撑",
|
||||
"compliance_rules": {
|
||||
"max_length": 50000,
|
||||
"requires_authentication": False,
|
||||
"sensitive_words": ["敏感词示例1", "敏感词示例2"]
|
||||
"max_title_len": 100,
|
||||
"allowed_tags": ["科技", "生活", "职场", "教育", "可持续", "AI", "远程工作", "个人成长"],
|
||||
"forbidden_patterns": ["加微信", "私聊", "付费咨询", "点击领取"]
|
||||
},
|
||||
"is_active": True
|
||||
"is_active": True,
|
||||
"requires_image": False,
|
||||
"image_count_min": 0,
|
||||
"image_count_max": 0,
|
||||
"image_width": 0,
|
||||
"image_height": 0,
|
||||
"min_words": 1500,
|
||||
"max_words": 3000
|
||||
},
|
||||
{
|
||||
"platform": "wechat",
|
||||
@@ -93,10 +100,18 @@ def import_initial_data():
|
||||
"icon": "💚",
|
||||
"default_format": "公众号图文,800-1500字,亲切口语化",
|
||||
"compliance_rules": {
|
||||
"max_length": 20000,
|
||||
"requires_authentication": True
|
||||
"max_title_len": 32,
|
||||
"allowed_tags": ["科技", "生活", "职场", "教育", "可持续", "AI", "远程工作", "个人成长"],
|
||||
"forbidden_patterns": ["诱导分享", "朋友圈", "转发群"]
|
||||
},
|
||||
"is_active": True
|
||||
"is_active": True,
|
||||
"requires_image": True,
|
||||
"image_count_min": 1,
|
||||
"image_count_max": 3,
|
||||
"image_width": 1080,
|
||||
"image_height": 1080,
|
||||
"min_words": 800,
|
||||
"max_words": 1500
|
||||
},
|
||||
{
|
||||
"platform": "xiaohongshu",
|
||||
@@ -104,11 +119,18 @@ def import_initial_data():
|
||||
"icon": "📕",
|
||||
"default_format": "图文笔记,300-800字,emoji+标签",
|
||||
"compliance_rules": {
|
||||
"max_length": 1000,
|
||||
"requires_tags": True,
|
||||
"max_tags": 10
|
||||
"max_title_len": 50,
|
||||
"allowed_tags": ["生活方式", "可持续", "AI", "个人成长", "极简", "环保"],
|
||||
"forbidden_patterns": ["私信", "加群", "导流"]
|
||||
},
|
||||
"is_active": True
|
||||
"is_active": True,
|
||||
"requires_image": True,
|
||||
"image_count_min": 3,
|
||||
"image_count_max": 6,
|
||||
"image_width": 1080,
|
||||
"image_height": 1440,
|
||||
"min_words": 300,
|
||||
"max_words": 800
|
||||
}
|
||||
]
|
||||
for p in platforms:
|
||||
|
||||
Reference in New Issue
Block a user