feat: 完善差旅票据行程提取与费用明细回填逻辑

增强文档智能识别的票据场景关键词和字段提取能力,优化
会话关联草稿报销单的解析路径,修复费用明细合并和票据
去重边界问题,前端改进报销创建和审批详情交互,补充单
元测试覆盖。
This commit is contained in:
caoxiaozhu
2026-05-21 14:24:51 +08:00
parent b183b0bd5e
commit f28d7e6d16
24 changed files with 1565 additions and 433 deletions

View File

@@ -72,6 +72,24 @@ 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_labels_train_ticket_date_as_train_departure_time() -> None:
insight = build_document_insight(
filename="铁路电子客票.pdf",
summary="铁路电子客票",
text=(
"中国铁路电子客票 开票日期 2026-02-18 "
"G456 上海虹桥-武汉 2026-02-20 08:30开 票价:¥354.00"
),
)
assert insight.document_type == "train_ticket"
assert any(
field.key == "date" and field.label == "列车出发时间" and field.value == "2026-02-20 08:30"
for field in insight.fields
)
assert not any(field.label == "开票日期" for field in insight.fields)
def test_document_intelligence_service_keeps_rule_fields_without_model_correction() -> None:
engine = create_engine(
"sqlite+pysqlite:///:memory:",