refactor(server): user_agent/steward/ocr 等服务重构并适配关联任务

- user_agent 拆分 application/locations/knowledge/response/review 四个子模块,接入申请位置语义与关联草稿分支
- steward planner/runtime/slot/plan_builder 决策链路重构,travel_reimbursement_calculator/orchestrator_expense_query 适配
- ocr/document_preview/document_intelligence/receipt_folder 复用预览与资产缓存,expense_claim_draft_flow/application_handoff 适配
- pyproject.toml 新增依赖,paddleocr bootstrap 脚本与 server_start.sh 调整
- 更新差旅/交通/通信等财务规则表,同步 document_intelligence/ocr/receipt_folder/user_agent 等测试
This commit is contained in:
caoxiaozhu
2026-06-24 10:42:24 +08:00
parent 332f77389d
commit 0264a4b5b4
41 changed files with 1273 additions and 182 deletions

View File

@@ -84,6 +84,33 @@ def test_document_intelligence_prefers_train_ticket_for_railway_e_ticket_invoice
assert any(field.label == "金额" and field.value == "354元" for field in insight.fields)
def test_document_intelligence_train_ticket_uses_railway_merchant_not_invoice_title() -> None:
insight = build_document_insight(
filename="2月20_武汉-上海.pdf",
summary="电子发票(铁路电子客票);发票监;统一 制",
text=(
"电子发票(铁路电子客票)\n"
"发票号码:26429165800002785705 湖北\n"
"开票日期:2026年05月18日\n"
"武汉站 G458 上海虹桥站\n"
"Wuhan Shanghaihongqiao\n"
"2026年02月20日 07:55开 06车01B号 二等座\n"
"票价:¥354.00\n"
"4201061987****1615 曹笑竹\n"
"电子客票号:6580061086021391007342026\n"
"购买方名称:曹笑竹 统一社会信用代码:\n"
"买票请到12306 发货请到95306\n"
"中国铁路祝您旅途愉快"
),
)
assert insight.document_type == "train_ticket"
fields = {field.label: field.value for field in insight.fields}
assert fields["商户"] == "中国铁路"
assert fields["金额"] == "354元"
assert fields["列车出发时间"] == "2026-02-20 07:55"
def test_document_intelligence_recovers_train_ticket_from_english_station_ocr_text() -> None:
insight = build_document_insight(
filename="2月20_武汉-上海.pdf",