后端拆分风险规则生成为解释器、语义分析、本体对齐等子模块, 优化模板执行和流程图生成,完善员工种子数据和导入逻辑,增强 报销单权限策略和草稿持久化,前端新增预算中心视图和趋势图 组件,重构审计页面和风险规则测试对话框交互,完善文档中心 和报销创建页面细节,补充单元测试覆盖。
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import assert from 'node:assert/strict'
|
||
import test from 'node:test'
|
||
|
||
import {
|
||
mergeComposerPrefill,
|
||
resolveSuggestedActionPrefill
|
||
} from '../src/utils/assistantSuggestedActionPrefill.js'
|
||
|
||
test('suggested action prefill uses backend prompt payload', () => {
|
||
assert.equal(
|
||
resolveSuggestedActionPrefill({
|
||
action_type: 'prefill_composer',
|
||
payload: {
|
||
application_field: 'time',
|
||
prompt_prefill: '申请时间段:'
|
||
}
|
||
}),
|
||
'申请时间段:'
|
||
)
|
||
})
|
||
|
||
test('suggested action prefill falls back to application field templates', () => {
|
||
assert.equal(
|
||
resolveSuggestedActionPrefill({
|
||
action_type: 'prefill_composer',
|
||
payload: { application_field: 'amount' }
|
||
}),
|
||
'用户预估费用:'
|
||
)
|
||
assert.equal(
|
||
resolveSuggestedActionPrefill({
|
||
action_type: 'ask_clarification',
|
||
payload: { application_field: 'amount' }
|
||
}),
|
||
''
|
||
)
|
||
})
|
||
|
||
test('composer prefill appends to existing draft without duplication', () => {
|
||
assert.equal(mergeComposerPrefill('', '事由:'), '事由:')
|
||
assert.equal(mergeComposerPrefill('地点:上海', '事由:'), '地点:上海\n事由:')
|
||
assert.equal(mergeComposerPrefill('地点:上海\n事由:', '事由:'), '地点:上海\n事由:')
|
||
})
|