refactor(chat/shipping): 重构发货通知模块为统一UI State驱动模式
- 重构发货通知的状态与动作获取逻辑:移除从聊天文本解析HXOPS_SHIPPING_ACTIONS注释的旧逻辑,改为统一从后端shipping_ui_state获取任务状态、动作按钮与工作流步骤 - 新增SSE实时推送shipping_ui_state事件,支持前端即时更新聊天气泡与工作台的状态与按钮 - 优化路由与登录流程:调整根路径重定向逻辑,退出登录时跳转到登录页;移除chat路由不必要的props传参;将原路由守卫中的根路径判断迁移到路由配置中 - 完善库存RPA与本地导入流程:新增本地库存文件托管接口,优化RPA回调的文件落盘与任务关联逻辑 - 新增多组单元测试覆盖焦点切换、决策处理、SSE同步等核心场景 - 修复多语言显示逻辑,使用te方法判断翻译key是否存在,避免缺失翻译时的渲染异常 - 新增reparse_inventory菜单动作,支持静默重新解析库存且不追加额外聊天消息 - 重构工作流步骤渲染函数,优先使用后端返回的步骤数据, fallback到本地推导的旧逻辑 - 清理后端旧的chat-actions API接口,将相关逻辑迁移到统一的ui_state接口中
This commit is contained in:
commit
9c036c825b
39 files changed
+3114
-456
No files matched your search
@@ -7,7 +7,7 @@
|
||||
import { BusinessError, requestJson } from '@/shared/api/client';
|
||||
import type {
|
||||
ShippingBatchSummary,
|
||||
ShippingChatActionsResponse,
|
||||
ShippingBatchUiState,
|
||||
ShippingConversationWorkspace,
|
||||
ShippingDecisionResponse,
|
||||
ShippingInventoryUploadResponse,
|
||||
@@ -17,6 +17,7 @@ import type {
|
||||
ShippingTaskCreateResponse,
|
||||
ShippingTaskDetail,
|
||||
ShippingTaskSummary,
|
||||
ShippingTaskUiState,
|
||||
} from '../types/shipping.api.types';
|
||||
|
||||
type ShippingApiStatusPayload = {
|
||||
@@ -75,10 +76,16 @@ export const listShippingChatAgents = () => requestJson<ShippingChatAgentOption[
|
||||
|
||||
/** 获取批次详情、批次任务列表与当前焦点任务。 */
|
||||
export const getWorkspaceShippingBatch = (batchNo: string) =>
|
||||
requestJson<ShippingBatchSummary & { tasks?: ShippingTaskSummary[]; focus_task?: ShippingTaskSummary | null }>(
|
||||
requestJson<ShippingBatchUiState>(
|
||||
`/api/workspace/shipping-batches/${encodeURIComponent(batchNo)}`,
|
||||
);
|
||||
|
||||
/** 获取批次级 UI State,供工作台、步骤条和任务卡片统一消费。 */
|
||||
export const getWorkspaceShippingBatchUiState = (batchNo: string) =>
|
||||
requestJson<ShippingBatchUiState>(
|
||||
`/api/workspace/shipping-batches/${encodeURIComponent(batchNo)}/ui-state`,
|
||||
);
|
||||
|
||||
/** 获取一个 Agent 会话下的多批次执行工作台快照。 */
|
||||
export const getWorkspaceShippingConversationBatches = (conversationId: string) =>
|
||||
requestJson<ShippingConversationWorkspace>(
|
||||
@@ -95,16 +102,14 @@ export const getWorkspaceShippingBatchFocusTask = (batchNo: string) =>
|
||||
export const getWorkspaceShippingTask = (taskNo: string) =>
|
||||
requestJson<ShippingTaskDetail>(`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}`);
|
||||
|
||||
/** 获取单票任务 UI State,后续 Chat 按钮与顶部步骤条统一读取此状态。 */
|
||||
export const getWorkspaceShippingTaskUiState = (taskNo: string) =>
|
||||
requestJson<ShippingTaskUiState>(`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/ui-state`);
|
||||
|
||||
/** 生成任务导出文件的前端下载 URL。 */
|
||||
export const workspaceShippingExportUrl = (taskNo: string) =>
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/export`;
|
||||
|
||||
/** 获取聊天气泡动作按钮、检查点和 human options。 */
|
||||
export const getShippingChatActions = (taskNo: string) =>
|
||||
requestJson<ShippingChatActionsResponse>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/chat-actions`,
|
||||
);
|
||||
|
||||
/**
|
||||
* 上传库存 Excel,并由后端完成解析与 schema preview 生成。
|
||||
* @param taskNo - 发货任务编号
|
||||
@@ -425,8 +430,8 @@ export const SHIPPING_NOTICE_AGENT_NAME = '货代发货通知 Agent';
|
||||
|
||||
export type {
|
||||
ShippingBatchSummary,
|
||||
ShippingBatchUiState,
|
||||
ShippingChatAction,
|
||||
ShippingChatActionsResponse,
|
||||
ShippingConversationBatch,
|
||||
ShippingConversationWorkspace,
|
||||
ShippingConversationWorkspaceSummary,
|
||||
@@ -440,4 +445,6 @@ export type {
|
||||
ShippingTaskCreateResponse,
|
||||
ShippingTaskDetail,
|
||||
ShippingTaskSummary,
|
||||
ShippingTaskUiState,
|
||||
ShippingWorkflowStep,
|
||||
} from '../types/shipping.api.types';
|
||||
Reference in new issue
Block a user