feat: 完善差旅票据行程提取与费用明细回填逻辑
增强文档智能识别的票据场景关键词和字段提取能力,优化 会话关联草稿报销单的解析路径,修复费用明细合并和票据 去重边界问题,前端改进报销创建和审批详情交互,补充单 元测试覆盖。
This commit is contained in:
@@ -178,3 +178,42 @@ def test_review_next_step_blocked_returns_reasons_and_removes_next_step_action(
|
||||
"所属部门未完善" in str(item.get("content") or "")
|
||||
for item in review_payload["risk_briefs"]
|
||||
)
|
||||
|
||||
|
||||
def test_conversation_hydration_does_not_reuse_review_type_for_fresh_expense_prompt() -> None:
|
||||
session_factory = build_session_factory()
|
||||
with session_factory() as db:
|
||||
service = AgentConversationService(db)
|
||||
conversation = service.get_or_create_conversation(
|
||||
conversation_id="conv-review-type-lock",
|
||||
user_id="emp-review-type@example.com",
|
||||
source="user_message",
|
||||
context_json={
|
||||
"session_type": "expense",
|
||||
"draft_claim_id": "claim-old",
|
||||
"attachment_names": ["old-train-ticket.pdf"],
|
||||
"attachment_count": 1,
|
||||
"review_form_values": {
|
||||
"expense_type": "差旅费",
|
||||
"business_location": "北京",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
fresh_context = service.hydrate_context_json(
|
||||
conversation=conversation,
|
||||
context_json={},
|
||||
message="业务发生时间:2026-02-20 至 2026-02-23,去上海支持上海电力部署项目,申请报销",
|
||||
)
|
||||
continued_context = service.hydrate_context_json(
|
||||
conversation=conversation,
|
||||
context_json={},
|
||||
message="继续补充酒店发票",
|
||||
)
|
||||
|
||||
assert "draft_claim_id" not in fresh_context
|
||||
assert "attachment_names" not in fresh_context
|
||||
assert "review_form_values" not in fresh_context
|
||||
assert fresh_context["conversation_state"]["review_form_values"]["expense_type"] == "差旅费"
|
||||
assert continued_context["draft_claim_id"] == "claim-old"
|
||||
assert continued_context["review_form_values"]["expense_type"] == "差旅费"
|
||||
|
||||
Reference in New Issue
Block a user