feat: 知识库更新,优化批量语音转写 - 合并索引 - 增加会话级批量转写处理 - 补充语音转写回归测试

This commit is contained in:
电摇小子
2026-08-06 20:31:08 +08:00
parent a0e8ab278f
commit 0ec2e6a0be
34 changed files with 2589 additions and 53 deletions
+58
View File
@@ -215,6 +215,64 @@ describe('knowledge sqlite', () => {
store.close()
})
it('marks voice Evidence and reports scoped transcript coverage without indexing error text', async () => {
const root = makeRoot()
const store = new KnowledgeStore(root, FIXTURE_ACCOUNT_A, fts)
await store.index({
conversations: [
{
conversationId: 'voice-coverage',
completeSnapshot: true,
messages: [
{
accountId: FIXTURE_ACCOUNT_A,
conversationId: 'voice-coverage',
messageId: 'voice-ready',
createTime: Date.UTC(2026, 7, 5, 9),
senderName: '成员甲',
kind: 'voice',
text: '[语音消息]',
voiceTranscript: '语音里确认今天去健身。',
voiceTranscriptState: 'transcribed'
},
{
accountId: FIXTURE_ACCOUNT_A,
conversationId: 'voice-coverage',
messageId: 'voice-failed',
createTime: Date.UTC(2026, 7, 5, 10),
senderName: '成员乙',
kind: 'voice',
text: '[语音消息]',
voiceTranscriptState: 'failed'
}
]
}
],
chunker: DEFAULT_KNOWLEDGE_CHUNKER
})
const result = store.searchWithStatus({
accountId: FIXTURE_ACCOUNT_A,
text: '去健身',
terms: ['去健身'],
conversationIds: ['voice-coverage'],
limit: 10
})
expect(result.evidence[0]).toMatchObject({
messageId: 'voice-ready',
sourceKind: 'voice'
})
expect(result.voiceCoverage).toEqual({
voiceMessageCount: 2,
transcribedVoiceCount: 1,
failedVoiceCount: 1,
voiceCoverageComplete: false
})
expect(result.evidence[0].text).not.toContain('失败')
store.close()
})
it('keeps conversation, sender and time filters when a participant question has no topic terms', async () => {
const root = makeRoot()
const store = new KnowledgeStore(root, FIXTURE_ACCOUNT_A, fts)