fix(ai): recognize conversational document filters
This commit is contained in:
@@ -153,6 +153,29 @@ test('AI document query combines natural-language filters', () => {
|
||||
assert.match(buildAiDocumentQueryConditionSummary(intent), /金额:不少于1000元/)
|
||||
})
|
||||
|
||||
test('AI document query recognizes colloquial travel city filtering commands', () => {
|
||||
const intent = resolveAiDocumentQueryIntent('出差上海的单据请筛选一下', { today })
|
||||
const records = filterAiDocumentQueryRecords(claims, intent)
|
||||
|
||||
assert.equal(intent?.source, 'accessible')
|
||||
assert.equal(intent?.expenseTypeFilter?.label, '差旅费')
|
||||
assert.equal(intent?.keywordFilter?.label, '上海')
|
||||
assert.deepEqual(
|
||||
records.map((record) => record.documentNo),
|
||||
['CL-20260221001', 'AP-20260220001']
|
||||
)
|
||||
})
|
||||
|
||||
test('AI document query recognizes quoted keywords generated by the guided query flow', () => {
|
||||
const intent = resolveAiDocumentQueryIntent(
|
||||
'帮我查询地点或事由包含“上海电力”的报销单据状态,筛选最近的 5 条记录',
|
||||
{ today }
|
||||
)
|
||||
|
||||
assert.equal(intent?.documentType, 'reimbursement')
|
||||
assert.equal(intent?.keywordFilter?.label, '上海电力')
|
||||
})
|
||||
|
||||
test('AI document query filters draft candidates by relative day', () => {
|
||||
const intent = resolveAiDocumentQueryIntent('我的 3天前 草稿单据', { today: '2026-06-24' })
|
||||
const records = filterAiDocumentQueryRecords([
|
||||
|
||||
@@ -181,6 +181,14 @@ test('assistant session scope guard keeps business boundaries isolated', () => {
|
||||
resolveAssistantScopeGuard('帮我查询待我审核的单据', SESSION_TYPE_EXPENSE).targetSessionType,
|
||||
SESSION_TYPE_APPROVAL
|
||||
)
|
||||
assert.equal(
|
||||
resolveAssistantScopeGuard('出差上海的单据请筛选一下', SESSION_TYPE_EXPENSE),
|
||||
null
|
||||
)
|
||||
assert.equal(
|
||||
resolveAssistantScopeGuard('出差上海的单据请筛选一下', SESSION_TYPE_APPLICATION).targetSessionType,
|
||||
SESSION_TYPE_EXPENSE
|
||||
)
|
||||
assert.equal(
|
||||
resolveAssistantScopeGuard('差旅住宿标准是多少', SESSION_TYPE_EXPENSE).targetSessionType,
|
||||
SESSION_TYPE_KNOWLEDGE
|
||||
@@ -414,6 +422,7 @@ test('guided reimbursement interrupts suspicious questions before expensive flow
|
||||
const state = selectGuidedExpenseType(createGuidedReimbursementState(), 'transport')
|
||||
assert.equal(shouldConfirmGuidedInterruption('送客户去机场', state), false)
|
||||
assert.equal(shouldConfirmGuidedInterruption('帮我查询一下上周的报销状态?', state), true)
|
||||
assert.equal(shouldConfirmGuidedInterruption('出差上海的单据请筛选一下', state), true)
|
||||
assert.deepEqual(
|
||||
buildGuidedInterruptionActions().map((action) => action.action_type),
|
||||
[GUIDED_ACTION_CONTINUE_FILLING, GUIDED_ACTION_PROCESS_INTERRUPTION]
|
||||
|
||||
Reference in New Issue
Block a user