feat(shipping-notice): 添加识别定义和规则集管理功能,支持客户和站点的可配置识别规则
This commit is contained in:
1 parent
88408490d7
commit
34d489a2d1
167 files changed
+10365
-7978
No files matched your search
@@ -30,3 +30,29 @@ def test_shipping_handler_builds_ui_state_event(app):
|
||||
)
|
||||
event = handler.build_ui_state_event(ctx)
|
||||
assert event is None or event.get('event') == 'shipping_ui_state'
|
||||
|
||||
|
||||
def test_shipping_handler_recovers_only_persisted_extraction_terminal(monkeypatch):
|
||||
"""已持久化的部分完成订单应覆盖 SSE 断流,进行态仍须保留失败语义。"""
|
||||
load_handlers()
|
||||
handler = get_handler('shipping_notice')
|
||||
assert handler is not None
|
||||
ctx = ChatStreamContext(
|
||||
query='extract orders',
|
||||
display_query='extract orders',
|
||||
user=SimpleNamespace(id=1),
|
||||
agent=SimpleNamespace(agent_code='shipping_notice'),
|
||||
session=SimpleNamespace(session_id='conv-1'),
|
||||
external_conversation_id=None,
|
||||
request_id='req-1',
|
||||
)
|
||||
|
||||
monkeypatch.setattr(handler, 'build_order_extraction_state_event', lambda _ctx: {
|
||||
'status': 'partially_completed', 'terminal': True,
|
||||
})
|
||||
assert handler.should_recover_upstream_error(ctx, {'event': 'error'}) is True
|
||||
|
||||
monkeypatch.setattr(handler, 'build_order_extraction_state_event', lambda _ctx: {
|
||||
'status': 'extracting', 'terminal': False,
|
||||
})
|
||||
assert handler.should_recover_upstream_error(ctx, {'event': 'error'}) is False
|
||||
Reference in new issue
Block a user