feat: initial import (exclude templates and runtime temp files)
This commit is contained in:
392
app/config/xibao_logic.json
Normal file
392
app/config/xibao_logic.json
Normal file
@@ -0,0 +1,392 @@
|
||||
{
|
||||
"template_file": "/opt/xibao-web/templates/黄金三十天喜报模版(余额、保险、理财)(1).pptx",
|
||||
"output_dir": "/opt/xibao-web/app/output",
|
||||
"history_file": "/opt/xibao-web/app/data/generated_history.json",
|
||||
"output_settings": {
|
||||
"auto_export_png": true,
|
||||
"auto_cleanup_pptx": true,
|
||||
"output_pattern": "喜报_{branch}_{index}.png"
|
||||
},
|
||||
"relay_handling": {
|
||||
"enabled": true,
|
||||
"trigger_keyword": "#接龙",
|
||||
"parse_rules": {
|
||||
"skip_lines": [
|
||||
"业绩亮单英雄榜",
|
||||
"例",
|
||||
"保险、余额、基金",
|
||||
"网点+姓名"
|
||||
],
|
||||
"line_pattern": "^\\d+、\\s*"
|
||||
},
|
||||
"dedup": {
|
||||
"enabled": true,
|
||||
"key_fields": [
|
||||
"branch",
|
||||
"amount",
|
||||
"type"
|
||||
],
|
||||
"action_on_new": "delete_old_then_generate"
|
||||
}
|
||||
},
|
||||
"branches": {
|
||||
"allowed": [
|
||||
"四马桥",
|
||||
"仙子脚",
|
||||
"桥头",
|
||||
"鸿雁",
|
||||
"营江路",
|
||||
"柑子园",
|
||||
"潇水南路",
|
||||
"濂溪",
|
||||
"清塘",
|
||||
"祥霖铺",
|
||||
"梅花",
|
||||
"蚣坝",
|
||||
"白马渡"
|
||||
],
|
||||
"alias": {
|
||||
"中心所": "潇水南路",
|
||||
"营江路所": "营江路"
|
||||
},
|
||||
"template_location": {
|
||||
"shape_index": 3,
|
||||
"paragraph_index": 1,
|
||||
"display_format": "{branch}营业所",
|
||||
"company_replacement": "道县"
|
||||
},
|
||||
"shapes": {
|
||||
"四马桥": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"仙子脚": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"桥头": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"鸿雁": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"营江路": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"柑子园": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"潇水南路": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"濂溪": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"清塘": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"祥霖铺": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"梅花": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"蚣坝": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
},
|
||||
"白马渡": {
|
||||
"shape": 0,
|
||||
"paragraphs": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"pages": {
|
||||
"page_0": {
|
||||
"display_name": "三个月定期",
|
||||
"amount_shape": 2,
|
||||
"status_shape": 3,
|
||||
"has_bracket": true
|
||||
},
|
||||
"page_1": {
|
||||
"display_name": "六个月定期",
|
||||
"amount_shape": 2,
|
||||
"status_shape": 3,
|
||||
"has_bracket": true
|
||||
},
|
||||
"page_2": {
|
||||
"display_name": "一年期定期",
|
||||
"amount_shape": 1,
|
||||
"status_shape": 2,
|
||||
"has_bracket": true
|
||||
},
|
||||
"page_3": {
|
||||
"display_name": "期交保险",
|
||||
"amount_shape": 2,
|
||||
"status_shape": 3,
|
||||
"has_bracket": false
|
||||
},
|
||||
"page_4": {
|
||||
"display_name": "趸交保险",
|
||||
"amount_shape": 2,
|
||||
"status_shape": 3,
|
||||
"has_bracket": false
|
||||
},
|
||||
"page_5": {
|
||||
"display_name": "两三年期理财",
|
||||
"display_aliases": [
|
||||
"两三期理财",
|
||||
"两三年期理财"
|
||||
],
|
||||
"amount_shape": 2,
|
||||
"status_shape": 3,
|
||||
"has_bracket": false
|
||||
},
|
||||
"page_6": {
|
||||
"display_name": "资管",
|
||||
"amount_shape": 2,
|
||||
"status_shape": 3,
|
||||
"has_bracket": false
|
||||
},
|
||||
"page_7": {
|
||||
"display_name": "基金/理财",
|
||||
"amount_shape": 2,
|
||||
"status_shape": 3,
|
||||
"has_bracket": false
|
||||
}
|
||||
},
|
||||
"type_matching": {
|
||||
"三个月定期": "page_0",
|
||||
"六个月定期": "page_1",
|
||||
"一年期定期": "page_2",
|
||||
"一年": "page_2",
|
||||
"定期一年": "page_2",
|
||||
"定期": "page_2",
|
||||
"5年交": "page_3",
|
||||
"5年期交": "page_3",
|
||||
"期交": "page_3",
|
||||
"趸交": "page_4",
|
||||
"两三期理财": "page_5",
|
||||
"两三年期理财": "page_5",
|
||||
"理财": "page_5",
|
||||
"资管": "page_6",
|
||||
"基金": "page_7",
|
||||
"保险": "page_3"
|
||||
},
|
||||
"insurance_handling": {
|
||||
"default": "期交",
|
||||
"page": "page_3",
|
||||
"description": "保险默认匹配期交(page_3),如需确认是几年交请手动修正"
|
||||
},
|
||||
"status_extraction": {
|
||||
"description": "从原始语句中提取状态关键词,匹配4字状态词",
|
||||
"valid_status": [
|
||||
"揽收现金",
|
||||
"微信提现",
|
||||
"揽收他行",
|
||||
"他行挖转",
|
||||
"存量提升",
|
||||
"商户提现",
|
||||
"揽收商户",
|
||||
"揽收彩礼",
|
||||
"资金来源",
|
||||
"成功营销"
|
||||
],
|
||||
"extraction_rules": {
|
||||
"揽收他行": [
|
||||
"揽收他行",
|
||||
"他行揽收"
|
||||
],
|
||||
"他行挖转": [
|
||||
"他行挖转",
|
||||
"挖转",
|
||||
"挖他行"
|
||||
],
|
||||
"揽收现金": [
|
||||
"揽收现金"
|
||||
],
|
||||
"微信提现": [
|
||||
"微信提现"
|
||||
],
|
||||
"商户提现": [
|
||||
"商户提现"
|
||||
],
|
||||
"揽收商户": [
|
||||
"揽收商户"
|
||||
],
|
||||
"揽收彩礼": [
|
||||
"揽收彩礼",
|
||||
"礼金"
|
||||
],
|
||||
"存量提升": [
|
||||
"存量提升"
|
||||
],
|
||||
"资金来源": [
|
||||
"资金来源"
|
||||
],
|
||||
"成功营销": [
|
||||
"成功营销"
|
||||
]
|
||||
},
|
||||
"fallback": "成功营销",
|
||||
"priority_order": [
|
||||
"揽收现金",
|
||||
"微信提现",
|
||||
"揽收他行",
|
||||
"他行挖转",
|
||||
"揽收彩礼",
|
||||
"商户提现",
|
||||
"揽收商户",
|
||||
"存量提升",
|
||||
"资金来源",
|
||||
"成功营销"
|
||||
]
|
||||
},
|
||||
"replace_algorithm": {
|
||||
"important": "必须遍历runs逐个处理,保持字体格式不改变",
|
||||
"amount": {
|
||||
"step1": "遍历所有shapes的text_frame",
|
||||
"step2": "遍历每个paragraph的runs",
|
||||
"step3": "判断条件:run.text.strip()是纯数字或纯*",
|
||||
"step4": "只替换该run的text为新金额数字(去掉万)",
|
||||
"step5": "其他runs(文字、单位的万等)保持不变",
|
||||
"condition_digit": "text.strip().isdigit()",
|
||||
"condition_star": "text.strip() == '*'",
|
||||
"example": {
|
||||
"原始runs": [
|
||||
"一年期定期",
|
||||
"14",
|
||||
"万"
|
||||
],
|
||||
"新金额": "30万",
|
||||
"替换后runs": [
|
||||
"一年期定期",
|
||||
"30",
|
||||
"万"
|
||||
],
|
||||
"最终显示": "一年期定期30万"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"description": "根据page和shape索引替换状态",
|
||||
"page_2_status_shape": 2,
|
||||
"page_3_status_shape": 3,
|
||||
"rule": "只替换长度为4的中文字符串(状态词)",
|
||||
"condition": "len(text.strip()) == 4",
|
||||
"valid_status": [
|
||||
"揽收现金",
|
||||
"微信提现",
|
||||
"揽收他行",
|
||||
"他行挖转",
|
||||
"存量提升",
|
||||
"商户提现",
|
||||
"揽收商户",
|
||||
"揽收彩礼",
|
||||
"资金来源",
|
||||
"成功营销"
|
||||
],
|
||||
"note": "不能替换类型关键词如'期交'、'定期'等",
|
||||
"example_with_bracket": {
|
||||
"原始runs": [
|
||||
"(",
|
||||
"成功营销",
|
||||
")"
|
||||
],
|
||||
"新状态": "他行挖转",
|
||||
"替换后runs": [
|
||||
"(",
|
||||
"他行挖转",
|
||||
")"
|
||||
],
|
||||
"最终显示": "(他行挖转)"
|
||||
},
|
||||
"example_without_bracket": {
|
||||
"原始runs": [
|
||||
"成功营销"
|
||||
],
|
||||
"新状态": "他行挖转",
|
||||
"替换后runs": [
|
||||
"他行挖转"
|
||||
],
|
||||
"最终显示": "他行挖转"
|
||||
}
|
||||
},
|
||||
"branch": {
|
||||
"description": "动态替换网点名称",
|
||||
"shape_index": 3,
|
||||
"paragraph_index": 1,
|
||||
"format": "{branch}营业所",
|
||||
"company_replacement": "道县",
|
||||
"note": "替换Shape 3 Paragraph 1的文本为'网点名称+营业所'",
|
||||
"example": {
|
||||
"原始": "仙子脚营业所",
|
||||
"新网点": "白马渡",
|
||||
"替换后": "白马渡营业所"
|
||||
}
|
||||
}
|
||||
},
|
||||
"performance": {
|
||||
"single_generation_mode": true,
|
||||
"max_build_workers": 1,
|
||||
"max_extract_workers": 1,
|
||||
"single_slide_output": true,
|
||||
"generation_strategy": "page_template_cache",
|
||||
"template_cache_min_records": 2,
|
||||
"memory_reclaim": {
|
||||
"enabled": true,
|
||||
"gc_collect": true,
|
||||
"malloc_trim": true
|
||||
},
|
||||
"image_delivery": {
|
||||
"enabled": true,
|
||||
"max_kbps": 0,
|
||||
"chunk_kb": 64
|
||||
}
|
||||
},
|
||||
"workflow": {
|
||||
"step_1": "检测消息是否包含#接龙关键词",
|
||||
"step_1a": "是接龙:解析每行数据,提取网点+金额+类型+状态",
|
||||
"step_1b": "读取history_file获取已生成的数据记录",
|
||||
"step_1c": "对比新旧数据,找出新增的记录",
|
||||
"step_1d": "如果有待删除的旧记录,删除对应的PNG文件",
|
||||
"step_1e": "只对新记录执行生成",
|
||||
"step_2": "遍历输入数据列表",
|
||||
"step_2a": "检查branch是否在allowed_branches中,如不在则跳过",
|
||||
"step_2b": "检查alias,将别名转换为潇水南路",
|
||||
"step_3": "从数据中提取:branch(网点)、amount(金额)、type(类型)",
|
||||
"step_3a": "使用status_extraction从原始语句中提取状态关键词",
|
||||
"step_4": "用type字段从type_matching找到对应page",
|
||||
"step_5": "每条数据重新加载模板(避免状态累积)",
|
||||
"step_6": "调用replace_algorithm.branch修改网点名称",
|
||||
"step_7": "调用replace_algorithm.amount修改金额(只改数字run)",
|
||||
"step_8": "调用replace_algorithm.status修改状态(只改4字状态词)",
|
||||
"step_9": "保存临时PPT,使用PowerPoint导出PNG图片",
|
||||
"step_10": "自动清理临时PPT文件,只保留PNG图片",
|
||||
"step_11": "更新history_file记录已生成的数据",
|
||||
"step_12": "重复步骤2-11直到处理完所有新数据"
|
||||
},
|
||||
"data_format": {
|
||||
"required_fields": [
|
||||
"raw_text"
|
||||
],
|
||||
"parsed_fields": [
|
||||
"branch",
|
||||
"amount",
|
||||
"type",
|
||||
"status"
|
||||
],
|
||||
"branch_filter": {
|
||||
"description": "只允许13个网点,不是则跳过该条数据",
|
||||
"action": "skip"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user