-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-full-pipeline.js
More file actions
73 lines (58 loc) · 2.34 KB
/
test-full-pipeline.js
File metadata and controls
73 lines (58 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const { RecordingManager } = require('./dist/recording.js');
const { ModularTranscriptionService } = require('./dist/transcription-router.js');
const fs = require('fs');
async function testFullPipeline() {
console.log('🚀 Starting full end-to-end test...\n');
const mgr = new RecordingManager();
let transcriptionService = null;
try {
// Step 1: Record audio
console.log('📝 Step 1: Recording audio for 5 seconds...');
await mgr.startRecording();
await new Promise(resolve => setTimeout(resolve, 5000));
const audioPath = await mgr.stopRecording();
console.log(`✓ Recording saved to: ${audioPath}\n`);
// Verify file
const size = fs.statSync(audioPath).size;
console.log(`📊 Audio file size: ${size} bytes`);
if (size < 100) {
throw new Error('Audio file is too small - recording failed');
}
console.log('✓ Audio file is valid\n');
// Step 2: Initialize transcription service
console.log('⚙️ Step 2: Initializing transcription service...');
transcriptionService = new ModularTranscriptionService();
await transcriptionService.initialize();
console.log('✓ Transcription service initialized\n');
// Step 3: Transcribe
console.log('🔄 Step 3: Transcribing audio with Parakeet...');
const startTime = Date.now();
const result = await transcriptionService.transcribe(audioPath, {
routingPreferences: {
priority: 'balance',
platform: 'desktop',
language: 'en'
}
});
const duration = Date.now() - startTime;
console.log(`✓ Transcription complete in ${duration}ms\n`);
// Debug: log the result object
console.log('DEBUG - Full result object:');
console.log(result);
console.log('\nDEBUG - Result keys:', Object.keys(result));
// Display results
console.log('\n📋 RESULTS:');
console.log('═'.repeat(60));
console.log(`Transcribed Text: "${result.text}"`);
console.log(`Model Used: ${result.modelUsed}`);
console.log(`Confidence: ${(result.confidence * 100).toFixed(1)}%`);
console.log(`Processing Time: ${result.duration}ms`);
console.log('═'.repeat(60));
console.log('\n✅ FULL PIPELINE TEST PASSED!');
} catch (error) {
console.error('\n❌ ERROR:', error.message);
console.error('\nStack:', error.stack);
process.exit(1);
}
}
testFullPipeline();