fix(conversation): drop the utterance when the user cancels while it is still being transcribed
Cancel only aborted an in-flight LLM response, which does not exist yet during STT, so the cancelled speech was answered a few seconds later. A turn counter bumped by cancel/stop now discards the late transcript.
This commit is contained in:
parent
7384ba98ba
commit
3851c2a09a
2 changed files with 26 additions and 2 deletions
|
|
@ -140,6 +140,24 @@ describe('VoiceConversationService — 오류 경로가 세션을 굳히지 않
|
|||
expect(conversationErrors()).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('전사 중에 취소하면 취소한 발화를 LLM 에 보내지 않고 계속 듣는다', async () => {
|
||||
let finish: (value: { text: string }) => void = () => undefined
|
||||
mocks.transcribe.mockImplementation(() => new Promise((resolve) => { finish = resolve }))
|
||||
const service = getVoiceConversationService()
|
||||
await service.startSession()
|
||||
feedAudio(32_000)
|
||||
|
||||
const pending = service.finishListening()
|
||||
await Promise.resolve()
|
||||
service.cancelResponse()
|
||||
finish({ text: '취소한 말' })
|
||||
await pending
|
||||
|
||||
expect(mocks.chatStream).not.toHaveBeenCalled()
|
||||
expect(service.state).toBe('listening')
|
||||
expect(service.getHistory()).toEqual([])
|
||||
})
|
||||
|
||||
it('LLM 이 실패하면 listening 으로 돌아가고 llm 오류 하나만 알린다(stt 로 다시 알리지 않는다)', async () => {
|
||||
mocks.transcribe.mockResolvedValue({ text: '안녕' })
|
||||
mocks.chatStream.mockImplementation(() => failing())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue