feat(caption): stream live captions and polish finished lines in context
Replaces the fixed six-second batches with a streaming track per audio source: the uncommitted audio is re-recognised every second and sent as a partial with its agreed (stable) prefix, a short pause finalises the line, and long unbroken speech is committed at Whisper segment boundaries. Idle audio is trimmed so silence cannot produce invented sentences. Finished lines are corrected by the local model against the previous lines and replaced in place; edits that change too much are rejected. The behaviour can be switched off in Settings.
This commit is contained in:
parent
db8d9448a3
commit
39b8e7448e
28 changed files with 827 additions and 217 deletions
|
|
@ -26,6 +26,7 @@ import {
|
|||
SUGGESTION_NO_THINK_PREFIX,
|
||||
SUGGESTION_SYSTEM_PROMPT,
|
||||
} from '../../../src/main/services/llm-prompts'
|
||||
import { buildCaptionRefinePrompt } from '../../../src/main/services/llm-prompts'
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
|
|
@ -248,3 +249,21 @@ describe('buildSuggestionPrompt', () => {
|
|||
expect(text).not.toContain('이미 제안한 문장')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildCaptionRefinePrompt', () => {
|
||||
it('지시문은 시스템 프롬프트에만 두고, 본문에는 앞 문맥 2줄과 다듬을 자막만 넣는다', () => {
|
||||
const { systemPrompt, text } = buildCaptionRefinePrompt({
|
||||
text: '오늘회의는 세시에',
|
||||
previous: ['첫 줄', '둘째 줄', '셋째 줄']
|
||||
})
|
||||
expect(systemPrompt).toContain('뜻을 바꾸거나')
|
||||
expect(text).not.toContain('규칙')
|
||||
expect(text).toContain(['둘째 줄', '셋째 줄'].join('\n'))
|
||||
expect(text).not.toContain('첫 줄')
|
||||
expect(text.endsWith('오늘회의는 세시에')).toBe(true)
|
||||
})
|
||||
|
||||
it('앞 문맥이 없으면 다듬을 자막만 넣는다', () => {
|
||||
expect(buildCaptionRefinePrompt({ text: '안녕', previous: [] }).text).toBe(['[다듬을 자막]', '안녕'].join('\n'))
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue