feat: 完善文档中心与报销申请交互及侧边栏重构
后端优化编排器报销查询和本体检测精度,增强报销单草稿保 存和附件回填逻辑,前端重构侧边栏组件支持折叠和图标导 航,完善文档中心状态筛选和详情提示,报销创建和审批详情 页优化会话管理和费用明细交互,新增助手应用服务和预设动 作工具函数,补充单元测试覆盖。
This commit is contained in:
43
web/tests/assistant-suggested-action-prefill.test.mjs
Normal file
43
web/tests/assistant-suggested-action-prefill.test.mjs
Normal file
@@ -0,0 +1,43 @@
|
||||
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事由:')
|
||||
})
|
||||
Reference in New Issue
Block a user