refactor(agent-runtime, shipping-notice, frontend): 重构上下文体系,修复重试RPA无响应问题

- 替换原有的hxops_context模块为全新的代理运行时上下文平台协议,统一跨业务上下文注入逻辑
- 新增多语言操作繁忙提示文案(覆盖中、繁、英、泰四语),前端绑定页面繁忙状态实现操作阻断
- 调整RPA库存导出重试策略:移除可配置的最大自动重试次数,改为固定单次自动重试,手动重试需用户显式触发
- 优化任务用户态状态展示逻辑,优先展示具体的pending原因而非通用状态文案
- 重构任务焦点切换逻辑,统一事件日志与处理流程,复用switch_batch_focus工具函数
- 修复clearAllHistory函数残留UI问题,确保清空会话后完全复位发货通知相关视图
- 更新OpenAPI文档与静态快照,补充工具使用约束说明
- 新增调试打点日志与问题排查文档,完善全套单元测试与快照校验用例
- 更新RPA脚本的README文档,调整登录方式说明与浏览器 profile 路径配置
- 删除废弃的hxops_context模块,迁移所有相关调用到新的上下文体系
This commit is contained in:
hugo committed 2026-07-03 17:01:42 +08:00
1 parent 60dd0c0f58
commit 8846ce159f
102 files changed
+18289 -9072

No files matched your search

@@ -23,7 +23,9 @@ export interface ShippingUploadHandlerContext {
input: Ref<string>;
shippingAutoFlowRequested: Ref<boolean>;
shippingInventoryPickerRef: Ref<HTMLInputElement | null>;
shippingNoticePickerRef: Ref<HTMLInputElement | null>;
pendingShippingUploadTaskId: Ref<string>;
pendingShippingNoticeTaskId: Ref<string>;
pendingShippingInventoryFile: Ref<File | null>;
resolvedShippingTaskId: Ref<string>;
resolvedShippingBatchNo: Ref<string>;
@@ -175,9 +177,11 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
await uploadInventoryForTask(taskId, file);
return;
}
const activeTaskId = String(ctx.getActiveShippingTaskId() || '').trim().toUpperCase();
if (activeTaskId) {
await handleReplaceNoticeForCurrentTask(activeTaskId, file);
const pendingNoticeTaskId = String(ctx.pendingShippingNoticeTaskId.value || '').trim().toUpperCase();
ctx.pendingShippingNoticeTaskId.value = '';
const targetTaskId = pendingNoticeTaskId || String(ctx.getActiveShippingTaskId() || '').trim().toUpperCase();
if (targetTaskId) {
await handleReplaceNoticeForCurrentTask(targetTaskId, file);
return;
}
const result = await createWorkspaceShippingBatchFromNotices(
@@ -216,7 +220,9 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
const handleShippingAutoUploadNoticeBatch = async (files: File[]) => {
const noticeFiles = files.filter(Boolean);
if (!noticeFiles.length) return;
const activeTaskId = String(ctx.getActiveShippingTaskId() || '').trim().toUpperCase();
const pendingNoticeTaskId = String(ctx.pendingShippingNoticeTaskId.value || '').trim().toUpperCase();
ctx.pendingShippingNoticeTaskId.value = '';
const activeTaskId = pendingNoticeTaskId || String(ctx.getActiveShippingTaskId() || '').trim().toUpperCase();
const singleNoticeFile = noticeFiles[0];
if (noticeFiles.length === 1 && activeTaskId && singleNoticeFile) {
await handleReplaceNoticeForCurrentTask(activeTaskId, singleNoticeFile);
@@ -268,13 +274,30 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
void ctx.refreshShippingActions();
};
const openShippingInventoryPicker = (): boolean => {
const taskId = ctx.getActiveShippingTaskId();
if (!taskId) {
const openShippingInventoryPicker = (taskId?: string): boolean => {
const resolvedTaskId = String(taskId || ctx.getActiveShippingTaskId() || '').trim().toUpperCase();
if (!resolvedTaskId) {
ctx.msg.warning(ctx.t('chat.shippingNoticeMissingTaskId'));
return false;
}
return selectShippingInventoryUploadTask(taskId);
return selectShippingInventoryUploadTask(resolvedTaskId);
};
/**
* 打开发货通知文件选择器,并在需要覆盖既有任务时锁定目标任务。
* 核心逻辑:优先使用显式 taskId 记录待覆盖任务;后续用户选中文件后,自动上传流程会消费该锁定任务而不是回退到最近聊天上下文。
* @param taskId - 可选任务编号;工作台/动作按钮重传时必须显式传入
* @returns 是否成功打开文件选择器
*/
const openShippingNoticePicker = (taskId?: string): boolean => {
const resolvedTaskId = String(taskId || ctx.getActiveShippingTaskId() || '').trim().toUpperCase();
if (!resolvedTaskId) {
ctx.msg.warning(ctx.t('chat.shippingNoticeMissingTaskId'));
return false;
}
ctx.pendingShippingNoticeTaskId.value = resolvedTaskId;
ctx.shippingNoticePickerRef.value?.click();
return true;
};
const handleShippingInventorySelected = async (event: Event) => {
@@ -318,6 +341,7 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
handleShippingAutoUploadFile,
handleShippingAutoUploadNoticeBatch,
openShippingInventoryPicker,
openShippingNoticePicker,
selectShippingInventoryUploadTask,
cancelShippingInventoryTaskSelection,
handleShippingInventorySelected,