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
@@ -68,17 +68,30 @@ export type ShippingInventoryValidationBatch = {
|
||||
runs: ShippingInventoryConfigurationTest[];
|
||||
};
|
||||
|
||||
export type ShippingOrderExtractionDiagnosticAutoFreezePolicy = {
|
||||
mode: string;
|
||||
enabled: boolean;
|
||||
selected_profile_code?: string | null;
|
||||
qualification_status?: string | null;
|
||||
customer_scope_status?: string | null;
|
||||
business_scenario_status?: string | null;
|
||||
customer_confirmation_required: boolean;
|
||||
evaluated_from_run: boolean;
|
||||
blocking_reason_codes: string[];
|
||||
};
|
||||
|
||||
export type ShippingOrderExtractionDiagnosticRun = {
|
||||
run_no: string; status: string; phase: string; conversation_id: string; workflow_run_id?: string | null;
|
||||
attempt_count: number; current_stage_code?: string | null; created_at?: string | null; started_at?: string | null;
|
||||
finished_at?: string | null; error_code?: string | null; durations_ms: Record<string, number | null>;
|
||||
run_no: string; status: string; phase: string; conversation_id: string;
|
||||
attempt_count: number; current_event_code?: string | null; created_at?: string | null; started_at?: string | null;
|
||||
candidate_materialized_at?: string | null; finished_at?: string | null; error_code?: string | null; durations_ms: Record<string, number | null>;
|
||||
result_counts: Record<string, number>;
|
||||
auto_freeze_policy: ShippingOrderExtractionDiagnosticAutoFreezePolicy;
|
||||
};
|
||||
export type ShippingOrderExtractionDiagnosticDetail = {
|
||||
run: ShippingOrderExtractionDiagnosticRun;
|
||||
job_attempts: Array<{ job_id: number; status: string; attempts: number; max_attempts: number; created_at?: string | null; started_at?: string | null; finished_at?: string | null; duration_ms?: number | null }>;
|
||||
units: Array<{ unit_id: number; position: number; unit_type: string; document_type: string; status: string; attempt_count: number; duration_ms?: number | null; error_code?: string | null; route_decisions: Array<{ attempt_no: number; execution_mode: 'deterministic' | 'dify' | 'blocked'; match_status: string; selected_profile_code?: string | null; selected_profile_version?: number | null; auto_create_approved?: boolean | null; candidate_count: number; table_count: number; approved_table_count: number; candidates: Array<{ profile_code: string; version: number; score: number; hard_match: boolean; reason_codes: string[]; missing_required_anchor_ids?: string[] }>; fallback_reason_codes: string[] }> }>;
|
||||
progress_events: Array<{ event_type: string; node_type?: string | null; stage_code?: string | null; status?: string | null; workflow_run_id?: string | null; node_execution_id?: string | null; occurred_at?: string | null }>;
|
||||
units: Array<{ unit_id: number; position: number; unit_type: string; document_type: string; status: string; attempt_count: number; duration_ms?: number | null; error_code?: string | null; route_decisions: Array<{ attempt_no: number; execution_mode: 'deterministic' | 'review_required' | 'skipped'; match_status: string; selected_profile_code?: string | null; selected_profile_version?: number | null; auto_create_approved?: boolean | null; candidate_count: number; table_count: number; approved_table_count: number; candidates: Array<{ profile_code: string; version: number; score: number; hard_match: boolean; reason_codes: string[]; missing_required_anchor_ids?: string[] }>; fallback_reason_codes: string[] }> }>;
|
||||
progress_events: Array<{ sequence_no: number; visibility: 'workspace' | 'admin'; event_code: string; status?: string | null; unit_id?: number | null; document_id?: number | null; reason_code?: string | null; summary?: Record<string, unknown> | null; occurred_at?: string | null }>;
|
||||
};
|
||||
export const listShippingOrderExtractionDiagnosticRuns = (page = 1, pageSize = 25, status = '') => {
|
||||
const params = new URLSearchParams({ page: String(page), page_size: String(pageSize) });
|
||||
@@ -429,7 +442,6 @@ export interface AdminAgentRegistrySchema {
|
||||
runtime_providers: string[];
|
||||
conversation_modes: string[];
|
||||
dify_app_types: string[];
|
||||
exposure_modes: string[];
|
||||
suggested_questions_styles: string[];
|
||||
default_capabilities: Record<string, boolean>;
|
||||
tool_run_progress_defaults: {
|
||||
@@ -451,14 +463,6 @@ export interface AdminAgentRegistrySchema {
|
||||
default_intent_routes?: string[];
|
||||
progress_contract?: Record<string, unknown> | null;
|
||||
handler_config_schema?: Record<string, unknown>;
|
||||
required_runtime_capabilities?: Record<string, {
|
||||
label?: string;
|
||||
required?: boolean;
|
||||
allowed_runtime_providers?: string[];
|
||||
allowed_dify_app_types?: string[];
|
||||
allowed_exposure_modes?: string[];
|
||||
allowed_effective_roles?: string[];
|
||||
}>;
|
||||
}>;
|
||||
handler_config_schemas: Record<string, unknown>;
|
||||
content_profile_keys: string[];
|
||||
@@ -501,30 +505,11 @@ export interface AdminContentProfileOption {
|
||||
export const listAdminContentProfiles = () =>
|
||||
requestJson<AdminContentProfileOption[]>('/api/admin/agents/content-profiles', auth());
|
||||
|
||||
export const listAdminAgents = (scope?: 'applications' | 'executors') => requestJson<any[]>(
|
||||
`/api/admin/agents${scope ? `?scope=${scope}` : ''}`,
|
||||
auth(),
|
||||
);
|
||||
export const listAdminAgents = () => requestJson<any[]>('/api/admin/agents', auth());
|
||||
export const createAdminAgent = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/agents', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const updateAdminAgent = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const listAdminAgentRuntimeBindings = (agentId: number) =>
|
||||
requestJson<import('@/features/admin/types/agent.types').AgentRuntimeBindingRow[]>(
|
||||
`/api/admin/agents/${agentId}/runtime-bindings`, auth(),
|
||||
);
|
||||
export const listApprovedOrderExtractionQualityBatches = (ownerAgentId: number) =>
|
||||
requestJson<import('@/features/admin/types/agent.types').OrderExtractionQualityBatchOption[]>(
|
||||
`/api/admin/shipping-notice/order-extraction-quality-batches?owner_agent_id=${ownerAgentId}`, auth(),
|
||||
);
|
||||
export const saveAdminAgentRuntimeBinding = (
|
||||
agentId: number,
|
||||
capabilityCode: string,
|
||||
payload: { provider_agent_id: number; enabled: boolean; config: Record<string, unknown> },
|
||||
) => requestJson<import('@/features/admin/types/agent.types').AgentRuntimeBindingRow>(
|
||||
`/api/admin/agents/${agentId}/runtime-bindings/${capabilityCode}`,
|
||||
{ method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) },
|
||||
);
|
||||
export const deleteAdminAgent = (id: number) =>
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
|
||||
Reference in new issue
Block a user