核心特性:自动变量识别
变量配置(VARIABLE_DEFAULTS):
# 基础变量
city: '青岛市'
period: '早上'
season: '夏天'
# 程序相关
program_id: '1'
program_name_map: {全局定义,支持字符串和对象两种访问}
# 推荐类型
recommend_type: 'POPULAR' # POPULAR / CUSTOM
rerank_reason: 'PIN_CONSECUTIVE' # PIN_CONSECUTIVE / PIN_WEEKLY
# 人气统计
count: 150
user_count: 50
user_proportion: 60
# 天气
weather: '小雪'
wd_link: '1'
washdry: '_wd'
# 季节
time_term: '立春'
filter_rule_code: 'time_season_in'
# 关怀
care: {
night_dry: {active: 1, display_name: '夜间烘'},
wind_cruise: {active: 1, display_name: '延取防皱'}
}
# 干衣机参数
changed_params_dry: {
DryLevel: '3', # 1潮湿 2即熨 3即穿 4储藏 5特干
DryTemp: '2', # 0冷风 1低温 2中温 3高温
FanLevel: '2'
}
# 洗衣机参数
changed_params_wash: {
setTemp: 40,
speed: 12,
spinTime: 3,
washTime: 45
}
预览API返回格式:
{
"success": true,
"result": "渲染后的文本",
"error": "",
"context_used": {
"program_id": "1",
"period": "早上",
"city": "青岛市"
}
}
蓝色收缩导航:
模板列表:
预览弹窗:
新增/编辑弹窗:
已导入105个模板:
# 测试预览API
py test_preview_api.py
# 结果:
# 测试1: 简单模板 ✅
# {'success': True, 'result': '哈喽,小优来啦!', 'error': '', 'context_used': {}}
# 测试2: 带变量的模板 ✅
# 成功: True
# 结果: 早上好呀,为你推荐棉麻程序!
# 使用的变量: ['program_id', 'period']
x11_template_vue/
├── backend/
│ ├── app/
│ │ ├── services/
│ │ │ └── renderer.py # ✨ 重写:自动变量识别
│ │ └── main.py # 修改:预览接口
│ └── data/
│ └── templates.json # 105个模板
├── frontend/
│ └── src/
│ └── App.vue # ✨ 重写:管理系统UI
├── scripts/
│ └── import_templates.py # 模板导入脚本
└── test_preview_api.py # 预览API测试