mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-06 13:54:10 +08:00
fix: 修复语音消息取错、时长精度与转写不刷新
- 时长解析:改取 <voicemsg voicelength>(毫秒),不再误取 length(SILK 字节数) - 时长显示:四舍五入对齐微信口径,有原生时长时不被解码时长覆盖 - 转写:重新识别改为强制重算,跳过身份级缓存短路(音频级缓存仍生效) - 日报:语音累计秒数显示取整,不再出现小数
This commit is contained in:
@@ -4,7 +4,10 @@ import {
|
||||
getSummaryDateRangeAt,
|
||||
parseGroupDailyReport
|
||||
} from '../../src/renderer/src/utils/group-report'
|
||||
import { summaryContent } from '../../src/renderer/src/utils/group-report-facts'
|
||||
import {
|
||||
buildGroupReportFacts,
|
||||
summaryContent
|
||||
} from '../../src/renderer/src/utils/group-report-facts'
|
||||
import { summarySender } from '../../src/renderer/src/utils/group-report-facts'
|
||||
import { selectHeroParticipantNames } from '../../src/shared/group-report'
|
||||
import type { GroupReportMetadata } from '../../src/shared/group-report'
|
||||
@@ -62,6 +65,37 @@ describe('group report parsing', () => {
|
||||
expect(summaryContent(message)).toContain('今晚八点确认发布。')
|
||||
})
|
||||
|
||||
it('rounds accumulated voice seconds in the facts summary', async () => {
|
||||
// 语音时长是 <voicemsg voicelength>(毫秒)换算来的小数秒(1600ms → 1.6)。
|
||||
// 累加必须保留原始精度(否则多条累积会越差越多),但展示给用户的文案要取整。
|
||||
const messages: Message[] = [
|
||||
{
|
||||
id: 'voice-a',
|
||||
from: 'member',
|
||||
type: '语音',
|
||||
datetime: '2026-08-06 10:00:00',
|
||||
content: '[语音]',
|
||||
isSender: false,
|
||||
contentData: { type: 'voice', duration: 1.979 }
|
||||
},
|
||||
{
|
||||
id: 'voice-b',
|
||||
from: 'member',
|
||||
type: '语音',
|
||||
datetime: '2026-08-06 10:00:05',
|
||||
content: '[语音]',
|
||||
isSender: false,
|
||||
contentData: { type: 'voice', duration: 5.379 }
|
||||
}
|
||||
]
|
||||
|
||||
const snapshot = await buildGroupReportFacts(messages, null, true, 'compact')
|
||||
|
||||
// 1.979 + 5.379 = 7.358 → 文案必须显示整数
|
||||
expect(snapshot.factsPrompt).toContain('累计 7 秒')
|
||||
expect(snapshot.factsPrompt).not.toContain('7.358')
|
||||
})
|
||||
|
||||
it('includes a voice transcript when legacy cached messages have no contentData', () => {
|
||||
const message: Message = {
|
||||
id: 'voice-legacy',
|
||||
|
||||
Reference in New Issue
Block a user