- 新增 PersonalWorkbenchAiMode 组件、AI 侧边栏与 orb 机器人视觉资源 - 新增 aiApplicationDraftModel / aiExpenseDraftModel / aiWorkbenchConversationStore 及业务准入 aiSidebarBusinessAccess,支撑 AI 模式下的申请与报销草稿 - 顶栏、侧边栏、工作台样式重构,适配 AI 模式切换与响应式布局 - 同步 steward plan/off_topic、差旅报销引导流、风险建议卡片等测试
74 lines
2.5 KiB
JavaScript
74 lines
2.5 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import {
|
|
buildStewardPlanMessageText,
|
|
buildStewardSuggestedActions
|
|
} from '../src/views/scripts/stewardPlanModel.js'
|
|
|
|
test('steward plan summary uses warm guidance copy for application flow', () => {
|
|
const message = buildStewardPlanMessageText({
|
|
tasks: [
|
|
{
|
|
task_id: 'task-1',
|
|
task_type: 'expense_application',
|
|
title: '费用申请 差旅',
|
|
assigned_agent: 'application_assistant',
|
|
confirmation_required: true
|
|
}
|
|
],
|
|
next_action: 'confirm_create_application'
|
|
})
|
|
|
|
assert.match(message, /我先帮你把步骤理清楚/)
|
|
assert.match(message, /我先看了一下,你这次主要是 \*\*1 个事项\*\*/)
|
|
assert.match(message, /为了不让步骤混在一起/)
|
|
assert.match(message, /我会请申请助手先把申请单草稿整理出来/)
|
|
assert.match(message, /你看这个顺序是否合适/)
|
|
assert.match(message, /需要补充的信息会在具体步骤里再温和提醒你/)
|
|
assert.doesNotMatch(message, /我会这样推进/)
|
|
assert.doesNotMatch(message, /不会一次性把所有动作都执行掉/)
|
|
assert.doesNotMatch(message, /交给申请助手生成申请单核对结果/)
|
|
})
|
|
|
|
test('steward plan summary guides bare reimbursement intent into scene selection', () => {
|
|
const plan = {
|
|
tasks: [
|
|
{
|
|
task_id: 'task-reim-1',
|
|
task_type: 'reimbursement',
|
|
title: '费用报销 1',
|
|
assigned_agent: 'reimbursement_assistant',
|
|
confirmation_required: true,
|
|
ontology_fields: {
|
|
expense_type: 'other',
|
|
reason: '我要报销'
|
|
},
|
|
missing_fields: ['time_range', 'reason']
|
|
}
|
|
],
|
|
confirmation_groups: [
|
|
{
|
|
confirmation_id: 'confirm-task-reim-1',
|
|
action_type: 'confirm_create_reimbursement_draft',
|
|
target_task_id: 'task-reim-1'
|
|
}
|
|
],
|
|
next_action: 'confirm_task'
|
|
}
|
|
|
|
const message = buildStewardPlanMessageText(plan)
|
|
|
|
assert.match(message, /我来带你发起报销/)
|
|
assert.match(message, /你现在只说了要报销/)
|
|
assert.match(message, /先选报销场景/)
|
|
assert.match(message, /差旅费、交通费、住宿费/)
|
|
assert.doesNotMatch(message, /步骤混在一起/)
|
|
assert.doesNotMatch(message, /核对“费用报销 1”/)
|
|
|
|
const [action] = buildStewardSuggestedActions(plan)
|
|
assert.equal(action.label, '确定,选择报销场景')
|
|
assert.match(action.description, /先进入报销助手选择具体费用类型/)
|
|
assert.equal(action.payload.carry_text, '我要报销')
|
|
})
|