refactor(agent, shipping): 简化代理模型并完善订单抽取业务
- 移除 Agent 的 exposure_mode 与 internal_executor 相关逻辑,清理关联的过滤、序列化代码 - 删除废弃的 AgentRuntimeBinding 模型及其依赖 - 新增订单抽取上传批次、请求快照等数据库迁移与业务逻辑 - 修复附件完整性检测、订单抽取状态映射问题 - 更新多语言错误文案与前端单元测试配置 - 清理平台配置中不再使用的暴露模式配置
This commit is contained in:
1 parent
1f3ecb87b7
commit
61ac6403c4
159 files changed
+12883
-5099
No files matched your search
@@ -971,6 +971,17 @@ def workspace_create_shipping_order_extraction_run():
|
||||
code='SHIPPING_NOTICE.ORDER_EXTRACTION_AGENT_INVALID',
|
||||
) from exc
|
||||
conversation_id = str(body.get('conversation_id') or '').strip()
|
||||
upload_batch_id = str(body.get('upload_batch_id') or '').strip()
|
||||
if not upload_batch_id:
|
||||
raise ValidationError(
|
||||
'upload_batch_id is required',
|
||||
code='SHIPPING_NOTICE.UPLOAD_BATCH_REQUIRED',
|
||||
)
|
||||
if len(upload_batch_id) > 36:
|
||||
raise ValidationError(
|
||||
'upload_batch_id is too long',
|
||||
code='SHIPPING_NOTICE.UPLOAD_BATCH_INVALID',
|
||||
)
|
||||
intake_nos = body.get('intake_nos')
|
||||
if not isinstance(intake_nos, list):
|
||||
raise ValidationError(
|
||||
@@ -987,6 +998,7 @@ def workspace_create_shipping_order_extraction_run():
|
||||
agent_id=agent_id,
|
||||
conversation_id=conversation_id,
|
||||
intake_nos=intake_nos,
|
||||
upload_batch_id=upload_batch_id,
|
||||
)
|
||||
db.session.commit()
|
||||
return ok(
|
||||
@@ -1017,6 +1029,15 @@ def workspace_list_shipping_order_extraction_progress_events(run_no: str):
|
||||
return _ok({'items': list_user_order_extraction_progress_events(user_id=user.id, run_no=run_no)})
|
||||
|
||||
|
||||
@workspace_shipping_notice_bp.route('/shipping-notice/order-extraction-runs/<run_no>/documents', methods=['GET'])
|
||||
def workspace_list_shipping_order_extraction_documents(run_no: str):
|
||||
"""返回当前用户一次订单抽取的按 PDF 归并详情。"""
|
||||
user = _require_user()
|
||||
from app.services.shipping_notice.order_extraction_run_service import list_user_order_extraction_documents
|
||||
|
||||
return _ok({'items': list_user_order_extraction_documents(user_id=user.id, run_no=run_no)})
|
||||
|
||||
|
||||
@workspace_shipping_notice_bp.route('/shipping-notice/order-extraction-runs/<run_no>/seen', methods=['POST'])
|
||||
def workspace_mark_shipping_order_extraction_run_seen(run_no: str):
|
||||
"""确认当前用户已加载终态订单识别卡片;仅用于会话待查看提醒,不改变业务结果。"""
|
||||
@@ -1103,12 +1124,23 @@ def workspace_create_shipping_notice_intake():
|
||||
if not asset_no:
|
||||
raise ValidationError('asset_no is required')
|
||||
conversation_id = str(body.get('conversation_id') or '').strip() or None
|
||||
upload_batch_id = str(body.get('upload_batch_id') or '').strip()
|
||||
if not upload_batch_id:
|
||||
raise ValidationError(
|
||||
'upload_batch_id is required',
|
||||
code='SHIPPING_NOTICE.UPLOAD_BATCH_REQUIRED',
|
||||
)
|
||||
if len(upload_batch_id) > 36:
|
||||
raise ValidationError(
|
||||
'upload_batch_id is too long',
|
||||
code='SHIPPING_NOTICE.UPLOAD_BATCH_INVALID',
|
||||
)
|
||||
from app.services.shipping_notice.intake_service import create_shipping_notice_intake
|
||||
|
||||
data = create_shipping_notice_intake(
|
||||
user_id=user.id,
|
||||
asset_no=asset_no,
|
||||
conversation_id=conversation_id,
|
||||
upload_batch_id=upload_batch_id,
|
||||
)
|
||||
return ok(data, request_id=getattr(g, 'request_id', None), status=202)
|
||||
|
||||
|
||||
Reference in new issue
Block a user