mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-21 21:47:00 +08:00
fix: 修复语音文件缺失误报
批量语音读取失败时,并行回退到兼容的单条读取接口,避免批量接口异常导致全部语音被误判为缺失。 增量合并恢复可播放语音或转写后,清理矛盾的媒体及转写错误状态,并补充批量回退与增量合并回归测试。
This commit is contained in:
@@ -275,6 +275,8 @@ const mergeArchiveMessage = (previous: Message, current: Message): Message => {
|
||||
if (!current.exportMediaUrl && !current.voiceDataUrl && previous.exportMediaError) {
|
||||
merged.exportMediaError = previous.exportMediaError
|
||||
}
|
||||
if (merged.voiceDataUrl) delete merged.exportMediaError
|
||||
if (merged.voiceTranscript) delete merged.voiceTranscriptError
|
||||
return merged
|
||||
}
|
||||
|
||||
|
||||
@@ -102,11 +102,12 @@ export class VoiceService {
|
||||
candidates: this.buildCandidates(reference.sessionId)
|
||||
}))
|
||||
)
|
||||
const failed: Array<{ index: number; reference: VoiceReference }> = []
|
||||
for (const [{ index, reference }, source] of missing.map(
|
||||
(item, sourceIndex) => [item, sources[sourceIndex]] as const
|
||||
)) {
|
||||
if (!source?.success || !source.hex) {
|
||||
results[index] = { success: false, error: source?.error || '获取语音数据失败' }
|
||||
failed.push({ index, reference })
|
||||
continue
|
||||
}
|
||||
const silkData = this.decodeVoiceBlob(source.hex)
|
||||
@@ -137,6 +138,19 @@ export class VoiceService {
|
||||
}
|
||||
}
|
||||
}
|
||||
const retried = await Promise.all(
|
||||
failed.map(({ reference }) =>
|
||||
this.resolveVoice(
|
||||
reference.sessionId,
|
||||
reference.localId,
|
||||
reference.createTime,
|
||||
reference.svrId
|
||||
)
|
||||
)
|
||||
)
|
||||
failed.forEach(({ index }, retryIndex) => {
|
||||
results[index] = retried[retryIndex]
|
||||
})
|
||||
return results as Array<{ success: boolean; data?: string; error?: string }>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user