refactor(agent, shipping): 简化代理模型并完善订单抽取业务

- 移除 Agent 的 exposure_mode 与 internal_executor 相关逻辑,清理关联的过滤、序列化代码
- 删除废弃的 AgentRuntimeBinding 模型及其依赖
- 新增订单抽取上传批次、请求快照等数据库迁移与业务逻辑
- 修复附件完整性检测、订单抽取状态映射问题
- 更新多语言错误文案与前端单元测试配置
- 清理平台配置中不再使用的暴露模式配置
This commit is contained in:
hugo committed 2026-07-28 20:25:48 +08:00
1 parent 1f3ecb87b7
commit 61ac6403c4
159 files changed
+12883 -5099

No files matched your search

@@ -35,7 +35,6 @@ MIGRATED_EXTRA_REGISTRY_KEYS = frozenset({
'runtime_provider',
'conversation_mode',
'dify_app_type',
'exposure_mode',
'iframe_url',
'category',
'sub_category',
@@ -151,7 +150,6 @@ def validate_agent_payload(
valid_runtime_providers = get_platform_enum_set('runtime_providers')
valid_conversation_modes = get_platform_enum_set('conversation_modes')
valid_dify_app_types = get_platform_enum_set('dify_app_types')
valid_exposure_modes = get_platform_enum_set('exposure_modes')
valid_suggested_styles = get_platform_enum_set('suggested_questions_styles')
dify_required_providers = get_dify_required_providers()
@@ -177,26 +175,6 @@ def validate_agent_payload(
if dify_app_type not in valid_dify_app_types:
dify_app_type = 'chatflow'
exposure_mode = _strip(data.get('exposure_mode')) or (
getattr(agent, 'exposure_mode', None) if agent else 'workspace'
) or 'workspace'
if exposure_mode not in valid_exposure_modes:
raise ValidationError(f'无效的 exposure_mode: {exposure_mode}')
existing_exposure = _strip(getattr(agent, 'exposure_mode', None) if agent else '')
if agent is not None and existing_exposure and exposure_mode != existing_exposure:
raise ValidationError(
'应用与内部执行器不可互相转换',
code='AGENT.EXPOSURE_ROLE_IMMUTABLE',
)
# 新建内部执行器统一使用 Dify Workflow;历史内部记录保留原组合以兼容旧数据。
if exposure_mode == 'internal' and agent is None:
if runtime_provider != 'dify' or dify_app_type != 'workflow':
raise ValidationError(
'新建内部执行器必须使用 runtime_provider=dify 与 dify_app_type=workflow',
code='AGENT.INTERNAL_EXECUTOR_CONFIG_INVALID',
)
dify_app_id = _strip(data.get('dify_app_id')) or (agent.dify_app_id if agent else '')
if runtime_provider in dify_required_providers and not dify_app_id:
raise ValidationError('runtime_provider 含 dify 时 dify_app_id 必填')
@@ -282,7 +260,6 @@ def validate_agent_payload(
'runtime_provider': runtime_provider,
'conversation_mode': conversation_mode,
'dify_app_type': dify_app_type,
'exposure_mode': exposure_mode,
'iframe_url': iframe_url or None,
'category': _strip(data.get('category')) or None,
'sub_category': _strip(data.get('sub_category')) or None,
@@ -308,7 +285,7 @@ def apply_agent_payload(agent: Agent, normalized: dict[str, Any]) -> None:
"""
column_fields = (
'name', 'description', 'icon_url', 'is_active', 'is_aggregate', 'dify_app_id', 'api_base_url', 'type',
'agent_code', 'runtime_provider', 'conversation_mode', 'dify_app_type', 'exposure_mode', 'iframe_url',
'agent_code', 'runtime_provider', 'conversation_mode', 'dify_app_type', 'iframe_url',
'category', 'sub_category', 'sort_order', 'welcome_message', 'suggested_questions_style',
'suggested_questions', 'capabilities', 'file_upload_policy', 'bound_schedule_task_id',
'handler_config',