feat: 收敛 AI Search 检索边界与问答体验

This commit is contained in:
电摇小子
2026-08-06 20:29:48 +08:00
parent ad4b3a8074
commit a0e8ab278f
22 changed files with 1897 additions and 127 deletions
+26
View File
@@ -40,6 +40,22 @@ describe('AI search natural-language time ranges', () => {
})
})
it('keeps an explicit UI range above the generic word 最近', () => {
expect(
inferAiSearchTimeRange('我和张三最近聊了什么?', '7d', NOW, {
startTime: Math.floor(NOW.getTime() / 1000) - 7 * 86400,
endTime: undefined,
label: '近 7 天',
reason: '用户在界面选择的时间范围',
source: 'user_selected'
})
).toMatchObject({
label: '近 7 天',
source: 'user_selected',
startTime: Math.floor(NOW.getTime() / 1000) - 7 * 86400
})
})
it('classifies a direct person recap as conversation_recall rather than a topic FTS query', () => {
expect(buildLocalAiSearchPlan('我和张三最近聊了什么?')).toMatchObject({
intent: 'conversation_recall',
@@ -67,6 +83,16 @@ describe('AI search natural-language time ranges', () => {
contactQuery: '技术交流群',
topicQuery: undefined
})
expect(buildLocalAiSearchPlan('技术交流群最近说了什么')).toMatchObject({
intent: 'conversation_name_search',
contactQuery: '技术交流群',
topicQuery: undefined
})
expect(buildLocalAiSearchPlan('技术交流群最近聊了啥')).toMatchObject({
intent: 'conversation_name_search',
contactQuery: '技术交流群',
topicQuery: undefined
})
})
it('matches an explicitly mentioned nickname when the user omits punctuation', () => {