fix: 修复语音文件缺失误报

批量语音读取失败时,并行回退到兼容的单条读取接口,避免批量接口异常导致全部语音被误判为缺失。

增量合并恢复可播放语音或转写后,清理矛盾的媒体及转写错误状态,并补充批量回退与增量合并回归测试。
This commit is contained in:
Nanin
2026-08-12 22:30:11 +08:00
parent 8fac752e2b
commit daeba3388d
4 changed files with 71 additions and 1 deletions
@@ -494,6 +494,29 @@ describe('media export flow', () => {
])
})
it('clears stale missing errors when an incremental merge restores playable voice data', async () => {
const { mergeHtmlArchiveMessages } = await import('../../src/main/export-service')
const previous = message({
id: 'voice-incremental',
type: '语音',
voiceDataUrl: 'voices/existing.wav',
voiceTranscript: '已有转写',
voiceTranscriptError: '旧转写错误'
})
const current = message({
id: 'voice-incremental',
type: '语音',
exportMediaError: '语音文件缺失:获取语音数据失败'
})
const [merged] = mergeHtmlArchiveMessages([previous], [current])
expect(merged.voiceDataUrl).toBe('voices/existing.wav')
expect(merged.voiceTranscript).toBe('已有转写')
expect(merged.exportMediaError).toBeUndefined()
expect(merged.voiceTranscriptError).toBeUndefined()
})
it('uses the customized file name as the HTML archive title', async () => {
const { runExport } = await import('../../src/main/export-service')
const win = { isDestroyed: () => true, webContents: { send: vi.fn() } }