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
@@ -9,7 +9,6 @@ from flask import g, request
|
||||
|
||||
from app.api.admin.blueprint import admin_bp
|
||||
from app.core.decorators import require_admin
|
||||
from app.core.errors import ValidationError
|
||||
from app.core.response import ok
|
||||
from app.services.admin import agent_service
|
||||
|
||||
@@ -69,8 +68,8 @@ def list_agent_intent_routes():
|
||||
@admin_bp.route('/agents', methods=['GET'])
|
||||
@require_admin
|
||||
def list_agents():
|
||||
"""按管理页签返回应用或内部执行器;缺省 scope 保持旧版全部列表兼容。"""
|
||||
return ok(agent_service.list_agents(scope=request.args.get('scope')), request_id=_request_id())
|
||||
"""列出全部应用。"""
|
||||
return ok(agent_service.list_agents(), request_id=_request_id())
|
||||
|
||||
|
||||
@admin_bp.route('/agents', methods=['POST'])
|
||||
@@ -107,38 +106,6 @@ def test_agent(id: int):
|
||||
return ok(payload, request_id=_request_id())
|
||||
|
||||
|
||||
@admin_bp.route('/agents/<int:id>/runtime-bindings', methods=['GET'])
|
||||
@require_admin
|
||||
def list_agent_runtime_bindings(id: int):
|
||||
"""列出入口 Agent 的显式运行能力绑定。"""
|
||||
from app.services.agent_runtime_binding_service import list_runtime_bindings
|
||||
|
||||
return ok(list_runtime_bindings(id), request_id=_request_id())
|
||||
|
||||
|
||||
@admin_bp.route('/agents/<int:id>/runtime-bindings/<path:capability_code>', methods=['PUT'])
|
||||
@require_admin
|
||||
def save_agent_runtime_binding(id: int, capability_code: str):
|
||||
"""保存单个能力 Provider;API Key 仍由 Provider Agent 自身配置管理。"""
|
||||
body = request.get_json(silent=True)
|
||||
if not isinstance(body, dict):
|
||||
raise ValidationError('JSON body must be an object')
|
||||
try:
|
||||
provider_agent_id = int(body.get('provider_agent_id'))
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValidationError('provider_agent_id is required') from exc
|
||||
from app.services.agent_runtime_binding_service import save_runtime_binding, serialize_runtime_binding
|
||||
|
||||
binding = save_runtime_binding(
|
||||
owner_agent_id=id,
|
||||
capability_code=capability_code,
|
||||
provider_agent_id=provider_agent_id,
|
||||
enabled=body.get('enabled') is not False,
|
||||
config=body.get('config'),
|
||||
)
|
||||
return ok(serialize_runtime_binding(binding), request_id=_request_id())
|
||||
|
||||
|
||||
@admin_bp.route('/agents/<int:id>/permissions', methods=['POST'])
|
||||
@require_admin
|
||||
def update_agent_permissions(id: int):
|
||||
|
||||
@@ -223,6 +223,23 @@ def suspend_order_document_profile_auto_freeze_qualification(profile_id: int):
|
||||
return _ok(quality.serialize_qualification(qualification))
|
||||
|
||||
|
||||
@admin_bp.route('/shipping-notice/order-document-profiles/<int:profile_id>/auto-freeze-qualification/scope', methods=['POST'])
|
||||
@require_admin
|
||||
def configure_order_document_profile_auto_freeze_scope(profile_id: int):
|
||||
"""配置模板版本的客户/业务场景自动冻结范围;空列表表示清空授权范围。"""
|
||||
from app.services.shipping_notice import document_profile_quality_service as quality
|
||||
|
||||
data = request.get_json(silent=True) or {}
|
||||
qualification = quality.configure_auto_freeze_qualification_scope(
|
||||
profile_id=profile_id,
|
||||
actor_id=int(_actor_id() or 0),
|
||||
customer_ids=data.get('customer_ids'),
|
||||
business_scenarios=data.get('business_scenarios'),
|
||||
requires_customer_confirmation=bool(data.get('requires_customer_confirmation', True)),
|
||||
)
|
||||
return _ok(quality.serialize_qualification(qualification))
|
||||
|
||||
|
||||
@admin_bp.route('/shipping-notice/order-document-profiles/<int:profile_id>', methods=['DELETE'])
|
||||
@require_admin
|
||||
def delete_order_document_profile(profile_id: int):
|
||||
|
||||
Reference in new issue
Block a user