feat(shipping-notice): 添加订单抽取功能,支持异步运行和管理,优化相关数据模型和处理逻辑
This commit is contained in:
1 parent
34d489a2d1
commit
ce26d6d0c4
144 files changed
+12241
-4233
No files matched your search
@@ -9,6 +9,7 @@ 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
|
||||
|
||||
@@ -106,6 +107,38 @@ 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):
|
||||
|
||||
Reference in new issue
Block a user