feat(shipping-notice): 添加识别定义和规则集管理功能,支持客户和站点的可配置识别规则
This commit is contained in:
1 parent
88408490d7
commit
34d489a2d1
167 files changed
+10365
-7978
No files matched your search
@@ -72,3 +72,7 @@ class AgentHandler:
|
||||
) -> Iterator[str]:
|
||||
"""上游 error/message_end/workflow_finished 后执行领域收口并追加 SSE 行。"""
|
||||
return iter(())
|
||||
|
||||
def should_recover_upstream_error(self, ctx: ChatStreamContext, event_data: dict[str, Any]) -> bool:
|
||||
"""业务事实已持久化时,允许把上游 SSE error 收口为正常终态。"""
|
||||
return False
|
||||
@@ -414,3 +414,19 @@ class ShippingNoticeHandler(AgentHandler):
|
||||
yield self._format_sse(extraction_event)
|
||||
if event:
|
||||
yield self._format_sse(event)
|
||||
|
||||
def should_recover_upstream_error(self, ctx: ChatStreamContext, event_data: dict[str, Any]) -> bool:
|
||||
"""
|
||||
判断 Dify 流错误能否按已持久化的订单抽取结果正常收口。
|
||||
|
||||
核心逻辑:仅处理当前订单抽取请求;Tool 已写入 completed/partially_completed 时,
|
||||
网络断流不应覆盖订单事实或向前端显示失败。仍为 extracting/failed 的请求维持原错误语义。
|
||||
"""
|
||||
if str(event_data.get('event') or '').strip() != 'error':
|
||||
return False
|
||||
state_event = self.build_order_extraction_state_event(ctx)
|
||||
return bool(
|
||||
state_event
|
||||
and state_event.get('terminal') is True
|
||||
and state_event.get('status') in {'completed', 'partially_completed'}
|
||||
)
|
||||
Reference in new issue
Block a user