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

@@ -102,4 +102,72 @@ describe('useChatShippingRefresh', () => {
expect(messages.value[0].shipping_ui_state?.task_no).toBe('SN-FOCUS-B');
expect(messages.value[0].shipping_actions?.map((item) => item.id)).toEqual(['generate_excel']);
});
it('treats backend ui_state.action_buttons as the only button source when api refresh succeeds', async () => {
getWorkspaceShippingTaskUiState.mockResolvedValue({
task_no: 'SN-SOURCE-001',
batch_no: 'SB-SOURCE-001',
checkpoint: 'ready_export',
process_status: 'matched',
review_status: null,
pending_human_reason: null,
match_status: 'fulfillable',
current_step: null,
steps: [],
summary: {
title: '可生成发货文件',
message: '库存匹配已满足发货条件,可以生成发货文件。',
error_message: null,
},
action_buttons: [
{
id: 'download_excel',
label: '下载发货文件',
message: '请下载发货文件',
variant: 'primary',
},
],
updated_at: '2026-07-03T10:00:00+08:00',
});
const messages = ref([
{
role: 'assistant' as const,
content: '请使用下方按钮继续。',
shipping_actions: [
{
id: 'legacy-local-action',
label: '旧按钮',
message: '旧按钮',
variant: 'secondary' as const,
},
],
shipping_ui_state: {
action_buttons: [
{
id: 'legacy-ui-state-action',
label: '旧状态按钮',
message: '旧状态按钮',
variant: 'secondary' as const,
},
],
},
},
]);
const { refreshShippingActions } = createShippingActionsRefresher({
isShippingNoticeAgent: computed(() => true),
messages,
conversationId: ref('conv-source'),
isThinking: ref(false),
history: ref([]),
resolvedShippingTaskId: ref('SN-SOURCE-001'),
shippingTaskIdFromQuery: computed(() => ''),
getActiveBatchTaskId: () => 'SN-SOURCE-001',
});
await refreshShippingActions();
expect(messages.value[0].shipping_actions?.map((item) => item.id)).toEqual(['download_excel']);
expect(messages.value[0].shipping_ui_state?.action_buttons?.map((item) => item.id)).toEqual(['download_excel']);
});
});