refactor: 架构重组 — doc/bot → core/infra,新增 Agent 调度模块
- src/doc/ 拆分为 src/core/extraction/, matching/, validation/(核心业务逻辑) - src/bot/ 重命名为 src/infra/browser/(浏览器自动化基础设施) - fill_consumable_doc.py → src/infra/documents/consumable.py - 新增 Agent 调度模块:coordinator.py, events.py, session.py,重构 orchestrator.py - 更新 AGENTS.md、README.md 及所有子目录 README
This commit is contained in:
24
config/README.md
Normal file
24
config/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
last_reviewed: 2026-06-15
|
||||
---
|
||||
|
||||
# config — 配置文件目录
|
||||
|
||||
## 文件
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `validation_rules.json` | 声明式校验规则配置:定义差旅和普通报销的必填字段、数组元素校验规则和自定义校验函数 |
|
||||
|
||||
## validation_rules.json 结构
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "1.0",
|
||||
"custom_checks": { ... },
|
||||
"travel": { "fields": [...], "arrays": [...] },
|
||||
"normal": { "fields": [...], "arrays": [...] }
|
||||
}
|
||||
```
|
||||
|
||||
校验引擎 `src/core/validation/validator.py` 在启动时读取此文件,若文件不存在则使用内置默认规则。
|
||||
135
config/validation_rules.json
Normal file
135
config/validation_rules.json
Normal file
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"custom_checks": {
|
||||
"is_valid_date": "检查日期格式是否为 YYYY-MM-DD",
|
||||
"is_positive_number": "检查是否为正数(整数或浮点数)",
|
||||
"is_positive_integer": "检查是否为正整数"
|
||||
},
|
||||
"travel": {
|
||||
"description": "差旅报销校验规则",
|
||||
"fields": [
|
||||
{
|
||||
"path": ["basic_info", "travel_purpose"],
|
||||
"required": true,
|
||||
"check_empty": true,
|
||||
"description": "出差事由"
|
||||
},
|
||||
{
|
||||
"path": ["basic_info", "travel_location"],
|
||||
"required": true,
|
||||
"check_empty": true,
|
||||
"description": "出差地点"
|
||||
},
|
||||
{
|
||||
"path": ["basic_info", "start_date"],
|
||||
"required": true,
|
||||
"check_empty": true,
|
||||
"custom_check": "is_valid_date",
|
||||
"description": "出差开始日期"
|
||||
},
|
||||
{
|
||||
"path": ["basic_info", "end_date"],
|
||||
"required": true,
|
||||
"check_empty": true,
|
||||
"custom_check": "is_valid_date",
|
||||
"description": "出差结束日期"
|
||||
}
|
||||
],
|
||||
"arrays": [
|
||||
{
|
||||
"path": ["reimbursement_details", "transport_fee"],
|
||||
"min_items": 1,
|
||||
"description": "交通费用明细",
|
||||
"element_fields": [
|
||||
{"path": ["vehicle_type"], "required": true, "check_empty": true, "description": "交通工具类型"},
|
||||
{"path": ["start_date"], "required": true, "check_empty": true, "custom_check": "is_valid_date", "description": "出发日期"},
|
||||
{"path": ["end_date"], "required": true, "check_empty": true, "custom_check": "is_valid_date", "description": "到达日期"},
|
||||
{"path": ["departure_place"], "required": true, "check_empty": true, "description": "出发地"},
|
||||
{"path": ["arrival_place"], "required": true, "check_empty": true, "description": "目的地"},
|
||||
{"path": ["amount"], "required": true, "check_empty": true, "custom_check": "is_positive_number", "description": "金额"},
|
||||
{"path": ["bill_count"], "required": true, "check_empty": true, "custom_check": "is_positive_integer", "description": "票据张数"},
|
||||
{"path": ["remark"], "required": true, "check_empty": false, "description": "备注说明"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": ["payment_methods"],
|
||||
"min_items": 1,
|
||||
"description": "支付方式记录",
|
||||
"element_fields": [
|
||||
{"path": ["card_date"], "required": true, "check_empty": true, "custom_check": "is_valid_date", "description": "刷卡日期"},
|
||||
{"path": ["card_amount"], "required": true, "check_empty": true, "custom_check": "is_positive_number", "description": "支付金额"},
|
||||
{"path": ["merchant"], "required": true, "check_empty": true, "description": "商户名称"},
|
||||
{"path": ["remark"], "required": true, "check_empty": false, "description": "备注"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": ["subsidy_list"],
|
||||
"min_items": 1,
|
||||
"description": "补助清单",
|
||||
"element_fields": [
|
||||
{"path": ["person_id"], "required": true, "check_empty": true, "description": "人员工号"},
|
||||
{"path": ["person_name"], "required": true, "check_empty": true, "description": "人员姓名"},
|
||||
{"path": ["start_date"], "required": true, "check_empty": true, "custom_check": "is_valid_date", "description": "补助开始日期"},
|
||||
{"path": ["end_date"], "required": true, "check_empty": true, "custom_check": "is_valid_date", "description": "补助结束日期"},
|
||||
{"path": ["days"], "required": true, "check_empty": true, "custom_check": "is_positive_integer", "description": "补助天数"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": ["attachments"],
|
||||
"min_items": 0,
|
||||
"description": "附件列表",
|
||||
"element_fields": [
|
||||
{"path": ["filename"], "required": true, "check_empty": true, "description": "文件名"},
|
||||
{"path": ["attachment_type"], "required": true, "check_empty": true, "description": "附件类型"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"normal": {
|
||||
"description": "普通报销校验规则",
|
||||
"fields": [
|
||||
{
|
||||
"path": ["basic_info", "reimbursement_description"],
|
||||
"required": true,
|
||||
"check_empty": true,
|
||||
"description": "报销事由"
|
||||
},
|
||||
{
|
||||
"path": ["reimbursement_details", "total_invoices"],
|
||||
"required": true,
|
||||
"check_empty": true,
|
||||
"custom_check": "is_positive_integer",
|
||||
"description": "发票总数"
|
||||
},
|
||||
{
|
||||
"path": ["reimbursement_details", "total_amount"],
|
||||
"required": true,
|
||||
"check_empty": true,
|
||||
"custom_check": "is_positive_number",
|
||||
"description": "总金额"
|
||||
}
|
||||
],
|
||||
"arrays": [
|
||||
{
|
||||
"path": ["payment_methods"],
|
||||
"min_items": 1,
|
||||
"description": "支付方式记录",
|
||||
"element_fields": [
|
||||
{"path": ["card_date"], "required": true, "check_empty": true, "custom_check": "is_valid_date", "description": "刷卡日期"},
|
||||
{"path": ["card_amount"], "required": true, "check_empty": true, "custom_check": "is_positive_number", "description": "支付金额"},
|
||||
{"path": ["merchant"], "required": true, "check_empty": true, "description": "商户名称"},
|
||||
{"path": ["remark"], "required": true, "check_empty": false, "description": "备注"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": ["attachments"],
|
||||
"min_items": 0,
|
||||
"description": "附件列表",
|
||||
"element_fields": [
|
||||
{"path": ["filename"], "required": true, "check_empty": true, "description": "文件名"},
|
||||
{"path": ["attachment_type"], "required": true, "check_empty": true, "description": "附件类型"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user