Initial commit: yu-zhi-ran platform with automation integration

This commit is contained in:
lt
2026-04-19 14:05:09 +08:00
commit 3cb2df51c8
209 changed files with 80379 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
"""
配置加载模块
"""
import yaml
from pathlib import Path
CONFIG_DIR = Path(__file__).parent
def load_wecom_config():
"""加载企业微信和内容配置"""
config_path = CONFIG_DIR / "wecom_config.yaml"
with open(config_path, 'r', encoding='utf-8') as f:
return yaml.safe_load(f)
def load_sources_config():
"""加载信息源配置"""
config_path = CONFIG_DIR / "sources.yaml"
with open(config_path, 'r', encoding='utf-8') as f:
return yaml.safe_load(f)
def load_app_config():
"""加载应用主配置"""
config_path = CONFIG_DIR / "app_config.yaml"
if config_path.exists():
with open(config_path, 'r', encoding='utf-8') as f:
return yaml.safe_load(f)
return {}
# 便捷导入
__all__ = ['load_wecom_config', 'load_sources_config', 'load_app_config']
+96
View File
@@ -0,0 +1,96 @@
# 信息源配置(可持续性相关)
sustainability_sources:
# 中文信息源(国内可持续性实践)优先使用
chinese:
- name: "新华网-环保频道"
type: "rss"
url: "http://www.xinhuanet.com/energy/rss.xml"
update_frequency: "daily"
credibility: "high"
focus: "国内环保政策"
- name: "人民网-生态环境频道"
type: "rss"
url: "http://env.people.com.cn/rss/150323.xml"
update_frequency: "daily"
credibility: "high"
focus: "生态环境新闻"
- name: "中国环境新闻"
type: "web"
base_url: "http://www.cenews.com.cn/"
update_frequency: "daily"
credibility: "high"
focus: "环境新闻"
- name: "国家发改委-低碳政策"
type: "web"
base_url: "https://www.ndrc.gov.cn"
credibility: "high"
focus: "政策动态"
# 备用全球信息源(API替代RSS
english_api:
- name: "UN Environment Programme"
type: "api"
url: "https://www.unep.org/news-and-stories"
update_frequency: "weekly"
credibility: "high"
focus: "全球环境政策"
- name: "World Economic Forum Sustainability"
type: "api"
url: "https://www.weforum.org/topics/sustainability/"
update_frequency: "weekly"
credibility: "high"
focus: "可持续商业"
# 本地案例库(保底数据源)
local:
- name: "宇之然本地案例库"
type: "local"
file: "strategy/全球案例数据库-v1.md"
update_frequency: "weekly"
credibility: "medium"
focus: "全球-本土案例"
- name: "历史选题库"
type: "local"
file: "automation/data/sustainability_topics.json"
update_frequency: "daily"
credibility: "medium"
focus: "复用已有选题"
# 案例验证要求
validation:
require_at_least_2_sources: true # 至少2个来源交叉验证
prefer_official_data: true # 优先政府/官方数据
min_data_points: 3 # 最少3个数据点
# 选题优先级权重
topic_priority:
audience_match: 0.3 # 受众匹配度(26-35岁城市焦虑青年)
data_availability: 0.25 # 数据可得性
uniqueness: 0.2 # 独特性(避免同质化)
executability: 0.15 # 可执行性(有MVP行动)
brand_fit: 0.1 # 品牌契合度(科技向善+回归本真)
# 可持续性子领域分类
sustainability_categories:
- "城市农业"
- "零浪费生活"
- "低碳出行"
- "循环消费"
- "能源效率"
- "可持续饮食"
- "环保科技产品"
# 内容合规检查清单
compliance:
avoid:
- "医疗建议(除非有资质)"
- "金融投资建议"
- "政策敏感话题"
- "未经证实的数据"
- "过度标题党"
required:
- "至少3个可靠引用"
- "数据标注来源"
- "包含MVP行动"
- "中性客观语气"
+108
View File
@@ -0,0 +1,108 @@
# 企业微信推送配置
wecom:
# 推送目标:用户 WangLiuTong
target_user: "WangLiuTong"
# 推送格式
message_template:
header: "【宇之然自动推送】"
footer: "详情请查看项目目录"
max_length: 2000 # 企业微信消息长度限制
# 推送内容类型
allowed_content_types:
- "选题发现"
- "案例更新"
- "文章发布"
- "系统状态"
# 图片规格配置(三种平台)
image_specs:
zhihu:
width: 1200
height: 675 # 16:9
format: "png"
quality: 85
banner_size: "封面图: 1200x675, 正文内嵌: 900xauto"
wechat:
width: 900
height: 1200 # 3:4 (移动端竖屏)
format: "png"
quality: 85
banner_size: "封面图: 900x383, 正文内嵌: 自适应宽度(最大900)"
xiaohongshu:
width: 1200
height: 1600 # 3:4
format: "png"
quality: 90
banner_size: "封面图: 1200x1600, 详图文: 1200x1600"
# HTML模板路径
templates:
base: "automation/templates/base.html"
zhihu: "automation/templates/zhihu.html"
wechat: "automation/templates/wechat.html"
xiaohongshu: "automation/templates/xiaohongshu.html"
# 输出目录结构
output:
daily_drafts: "automation/data/drafts/drafts_{{DATE}}/"
published_releases: "automation/data/published/releases_{{DATE}}/"
images: "automation/images/generated/{{DATE}}/"
logs: "automation/logs/"
# 内容创作规则
content_rules:
zhihu:
max_length: 3000
min_length: 1500
requires_tags: true
tag_count: 3-5
requires_summary: true
summary_length: 100-200
wechat:
max_length: 2500
min_length: 800
requires_cover_image: true
requires_abstract: true
abstract_length: 50-200
allow_emoji: true
xiaohongshu:
max_length: 1000
min_length: 500
requires_multiple_images: true # 小红书图文笔记
image_count: 3-9
requires_hashtags: true
hashtag_count: 5-10
tone: "生活化、亲切、有价值"
# 企业微信推送模板
notification_templates:
sustainability_task_complete: |
【可持续性内容收集完成】
时间: {{TIME}}
新增选题数: {{TOPIC_COUNT}}
新增案例数: {{CASE_COUNT}}
信息源: {{SOURCE_COUNT}}个
详情: {{DETAILS_LINK}}
content_creation_complete: |
【内容创作完成】
时间: {{TIME}}
选题: {{TOPIC_TITLE}}
平台版本: 知乎、公众号、小红书
图片数: {{IMAGE_COUNT}}
文件位置: {{OUTPUT_DIR}}
状态: {{STATUS}}
system_error: |
【定时任务异常】
任务: {{TASK_NAME}}
错误: {{ERROR}}
时间: {{TIME}}
请检查日志: {{LOG_PATH}}