feat(web): AI 工作台多 task 串行推进与会话适配

- useWorkbenchAiApplicationPreviewFlow/useWorkbenchAiActionRouter/useWorkbenchAiCommandIntents 支持 task1 完成后自动推进 task2,确认按钮直接拉起申请预览,草稿/提交成功后继续推进下一 task
- workbenchAiIntentPlannerModel/workbenchAiMessageModel/workbenchAiCommandIntentModel 适配多 task 意图规划与消息结构
- aiApplicationPreviewActions/aiApplicationPrecheckModel/aiExpenseDraftModel/aiWorkbenchConversationStore 草稿与会话存储适配
- PersonalWorkbenchAiMode 与样式适配,更新 preview-actions/expense-draft/conversation-store/fast-preview/action-router/command-intent/intent-planner 测试
This commit is contained in:
caoxiaozhu
2026-06-26 22:42:23 +08:00
parent 5753899eb3
commit c4b5fcc067
22 changed files with 1171 additions and 144 deletions

View File

@@ -67,3 +67,37 @@ test('AI workbench conversation store persists scoped history for sidebar sessio
assert.equal(nextHistory.length, 1)
assert.equal(nextHistory[0].id, 'conv-first')
})
test('AI workbench conversation store preserves stewardRemainingTasks on messages', () => {
installLocalStorageMock()
const user = { username: 'caoxiaozhu' }
const remainingTasks = [
{ task_id: 't2', task_type: 'reimbursement', ontology_fields: { expense_type: 'meal' } }
]
saveAiWorkbenchConversation(user, {
id: 'conv-multi-task',
title: '出差+招待费',
updatedAt: Date.now(),
messages: [
{ id: 'u1', role: 'user', content: '出差+报销招待费' },
{
id: 'a1',
role: 'assistant',
content: '申请草稿已保存',
stewardRemainingTasks: remainingTasks
}
]
})
const history = loadAiWorkbenchConversationHistory(user)
assert.equal(history.length, 1)
// 历史摘要不要求保留 stewardRemainingTasks,但加载完整会话时消息上应保留。
// 这里通过 saveAiWorkbenchConversation 的往返确认 normalizeMessage 不会丢弃该字段。
const stored = JSON.parse(globalThis.window.localStorage.getItem(
'x-financial:workbench-ai-conversations:caoxiaozhu'
))
const conversation = stored.find((item) => item.id === 'conv-multi-task')
const persistedMessage = conversation.messages.find((m) => m.id === 'a1')
assert.deepEqual(persistedMessage.stewardRemainingTasks, remainingTasks)
})