feat: 회의 파일 가져오기와 입력 엔진 배포 보완
This commit is contained in:
parent
5a8c5cd792
commit
b3519e5da7
54 changed files with 1129 additions and 116 deletions
47
apps/desktop/tests/integration/meeting-import-media.test.ts
Normal file
47
apps/desktop/tests/integration/meeting-import-media.test.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { execFile } from 'child_process'
|
||||
import fs from 'fs'
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import { promisify } from 'util'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { getMeetingModeService } from '../../src/main/services/MeetingModeService'
|
||||
import { getSTTManager } from '../../src/main/services/stt/STTManager'
|
||||
import { getLicenseService } from '../../src/main/services/LicenseService'
|
||||
import { getFfmpegPath } from '../../src/main/utils/paths'
|
||||
import { localAudioPath } from '../../src/main/services/sync/audio-sync'
|
||||
import { useRedHarness } from '../red/harness'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
useRedHarness()
|
||||
|
||||
const sources = new Set<string>()
|
||||
afterEach(() => {
|
||||
for (const source of sources) fs.rmSync(source, { force: true })
|
||||
sources.clear()
|
||||
})
|
||||
|
||||
describe.each(['mp3', 'm4a'])('실제 %s 녹음 파일 가져오기', (extension) => {
|
||||
it('ffmpeg 변환 후 회의와 재생용 WAV를 만든다', async () => {
|
||||
const source = path.join(os.tmpdir(), `d3ro-meeting-media-${process.pid}-${Date.now()}.${extension}`)
|
||||
sources.add(source)
|
||||
await execFileAsync(getFfmpegPath(), [
|
||||
'-f', 'lavfi', '-i', 'sine=frequency=440:duration=1', '-y', source,
|
||||
])
|
||||
vi.spyOn(getLicenseService(), 'canUse').mockReturnValue({ allowed: true, reason: 'ok' })
|
||||
vi.spyOn(getSTTManager(), 'transcribe').mockResolvedValue({
|
||||
text: `${extension} 회의 발언`,
|
||||
segments: [{ text: `${extension} 회의 발언`, start: 0, end: 1, confidence: 1 }],
|
||||
})
|
||||
|
||||
const detail = await getMeetingModeService().importRecording(source, 'ko')
|
||||
|
||||
expect(detail.rawTranscript).toBe(`[00:00] ${extension} 회의 발언`)
|
||||
expect(detail.durationMs).toBeGreaterThan(0)
|
||||
const audioPath = localAudioPath('meeting', detail.id)
|
||||
expect(audioPath).not.toBeNull()
|
||||
const wav = fs.readFileSync(audioPath!)
|
||||
expect(wav.subarray(0, 4).toString('ascii')).toBe('RIFF')
|
||||
expect(wav.subarray(8, 12).toString('ascii')).toBe('WAVE')
|
||||
getMeetingModeService().deleteSession(detail.id)
|
||||
}, 30_000)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue