feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估
- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。 - 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。 - 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。 - 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。 - 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
1 parent
cef3d5b26a
commit
3a9fbac2fc
226 files changed
+25010
-2098
No files matched your search
@@ -213,6 +213,7 @@ def test_workspace_submit_decision_updates_reference_context_last_action(app, cl
|
||||
)
|
||||
db.session.add_all([batch, task])
|
||||
db.session.commit()
|
||||
actor_user_id = int(user.id)
|
||||
|
||||
res = client.post(
|
||||
"/api/workspace/shipping-tasks/SN-WS-CONFIRM-001/submit-decision",
|
||||
@@ -221,9 +222,10 @@ def test_workspace_submit_decision_updates_reference_context_last_action(app, cl
|
||||
)
|
||||
|
||||
assert res.status_code == 200
|
||||
data = res.get_json()
|
||||
data = _unwrap_ok(res)
|
||||
assert data["status"] in {"ok", "running"}
|
||||
with app.app_context():
|
||||
from app.models import ShippingAuditEvent
|
||||
task = ShippingTask.query.filter_by(task_no="SN-WS-CONFIRM-001").one()
|
||||
event = (
|
||||
ShippingTaskEvent.query.filter_by(task_id=task.id, event_type="parse_confirmed")
|
||||
@@ -233,6 +235,23 @@ def test_workspace_submit_decision_updates_reference_context_last_action(app, cl
|
||||
assert event is not None
|
||||
assert event.detail_json["action"] == "confirm"
|
||||
assert event.detail_json["source"] == "workspace_api"
|
||||
# 关键断言:工作台决策须带操作人、前后快照,并双写统一审计。
|
||||
assert event.actor_id == actor_user_id
|
||||
assert isinstance(event.before_json, dict)
|
||||
assert isinstance(event.after_json, dict)
|
||||
audit = (
|
||||
ShippingAuditEvent.query.filter_by(
|
||||
aggregate_type='shipping_task',
|
||||
aggregate_id='SN-WS-CONFIRM-001',
|
||||
action='confirm_parse',
|
||||
)
|
||||
.order_by(ShippingAuditEvent.id.desc())
|
||||
.first()
|
||||
)
|
||||
assert audit is not None
|
||||
assert int(audit.actor_id or 0) == actor_user_id
|
||||
assert audit.before_snapshot_json is not None
|
||||
assert audit.after_snapshot_json is not None
|
||||
|
||||
inputs = dify_inputs.build_dify_chat_inputs("conv-ws-confirm-001")
|
||||
runtime_context = json.loads(inputs["agent_runtime_context"])
|
||||
@@ -289,7 +308,7 @@ def test_workspace_switch_focus_updates_reference_context(app, client):
|
||||
)
|
||||
|
||||
assert res.status_code == 200
|
||||
data = res.get_json()
|
||||
data = _unwrap_ok(res)
|
||||
assert data["batch"]["current_focus_task_no"] == "SN-WS-FOCUS-002"
|
||||
with app.app_context():
|
||||
target = ShippingTask.query.filter_by(task_no="SN-WS-FOCUS-002").one()
|
||||
|
||||
Reference in new issue
Block a user