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:
@@ -3,6 +3,7 @@ import test from 'node:test'
|
||||
|
||||
import {
|
||||
applyAiExpenseAnswer,
|
||||
buildAiExpenseDraftPrefillValues,
|
||||
buildAiExpenseStepPrompt,
|
||||
buildAiExpenseSummary,
|
||||
createAiExpenseDraft,
|
||||
@@ -71,3 +72,41 @@ test('summary lists every filled field and the linked application', () => {
|
||||
assert.match(summary, /AP-202606-001/)
|
||||
assert.match(summary, /85元/)
|
||||
})
|
||||
|
||||
test('buildAiExpenseDraftPrefillValues maps task ontology fields onto draft fields', () => {
|
||||
const values = buildAiExpenseDraftPrefillValues({
|
||||
expense_type: 'meal',
|
||||
amount: '2000元',
|
||||
time_range: '昨天',
|
||||
reason: '客户招待',
|
||||
location: '上海',
|
||||
unrelated_field: 'ignore me'
|
||||
})
|
||||
assert.equal(values.amount, '2000元')
|
||||
assert.equal(values.time_range, '昨天')
|
||||
assert.equal(values.reason, '客户招待')
|
||||
assert.equal(values.location, '上海')
|
||||
assert.equal(values.unrelated_field, undefined)
|
||||
})
|
||||
|
||||
test('createAiExpenseDraft with prefillValues skips already filled steps', () => {
|
||||
const draft = createAiExpenseDraft('meal', '业务招待费', {
|
||||
amount: '2000元',
|
||||
reason: '客户招待'
|
||||
})
|
||||
// reason 已填,跳到下一个未填字段 time_range
|
||||
assert.equal(draft.values.amount, '2000元')
|
||||
assert.equal(draft.values.reason, '客户招待')
|
||||
assert.equal(draft.stepKey, 'time_range')
|
||||
})
|
||||
|
||||
test('createAiExpenseDraft with all prefillValues lands on summary', () => {
|
||||
const draft = createAiExpenseDraft('meal', '业务招待费', {
|
||||
reason: '客户招待',
|
||||
time_range: '昨天',
|
||||
location: '上海',
|
||||
amount: '2000元',
|
||||
attachments: '稍后上传'
|
||||
})
|
||||
assert.ok(isAiExpenseDraftComplete(draft))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user