diff --git a/packages/parser/src/formats/shuakami-qq-exporter-chunked.test.ts b/packages/parser/src/formats/shuakami-qq-exporter-chunked.test.ts index a2a23ac0..6de679d4 100644 --- a/packages/parser/src/formats/shuakami-qq-exporter-chunked.test.ts +++ b/packages/parser/src/formats/shuakami-qq-exporter-chunked.test.ts @@ -15,22 +15,29 @@ describe('shuakami-qq-exporter chunked parser', () => { try { mkdirSync(chunksDir) - writeFileSync( - manifestPath, - JSON.stringify({ - metadata: { name: 'QQChatExporter', version: '0.1.0' }, - chatInfo: { name: 'Test Group', type: 'group', selfUin: '100' }, - statistics: { totalMessages: 2 }, - chunked: { - format: 'jsonl', - chunksDir: 'chunks', - chunkFileExt: '.jsonl', - maxMessagesPerChunk: 50000, - maxBytesPerChunk: 52428800, - chunks: [{ relativePath: 'chunks/c000001.jsonl', count: 2 }], - }, - }) - ) + const manifest = JSON.stringify({ + metadata: { name: 'QQChatExporter', version: '0.1.0' }, + chatInfo: { name: 'Test Group', type: 'group', selfUin: '100' }, + statistics: { + totalMessages: 2, + senders: Array.from({ length: 1000 }, (_, index) => ({ + uid: `u_${index}`, + name: `Member ${index} ${'x'.repeat(80)}`, + messageCount: 1, + percentage: 0.1, + })), + }, + chunked: { + format: 'jsonl', + chunksDir: 'chunks', + chunkFileExt: '.jsonl', + maxMessagesPerChunk: 50000, + maxBytesPerChunk: 52428800, + chunks: [{ relativePath: 'chunks/c000001.jsonl', count: 2 }], + }, + }) + assert.ok(manifest.indexOf('"chunked"') > 64 * 1024) + writeFileSync(manifestPath, manifest) writeFileSync( join(chunksDir, 'c000001.jsonl'), [ diff --git a/packages/parser/src/formats/shuakami-qq-exporter-chunked.ts b/packages/parser/src/formats/shuakami-qq-exporter-chunked.ts index 4bc198d0..46c1f562 100644 --- a/packages/parser/src/formats/shuakami-qq-exporter-chunked.ts +++ b/packages/parser/src/formats/shuakami-qq-exporter-chunked.ts @@ -50,6 +50,7 @@ export const feature: FormatFeature = { signatures: { // V5 使用 metadata.format,0.1.x 将格式标识移至 chunked.format。 head: [/"format"\s*:\s*"chunked-jsonl"/, /"chunked"\s*:\s*\{[^{}]*"format"\s*:\s*"jsonl"/], + filename: [/^manifest\.json$/i], requiredFields: ['metadata', 'chatInfo'], }, }