fix(speech): count any engine answer as progress while a dictation finishes

This commit is contained in:
Kelvin Amoaba
2026-11-09 19:39:44 +00:00
parent b8e082b011
commit 1e6c7aa738
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -47,16 +47,16 @@ export function waitForSttWorkerStop(args: {
resolve()
}
const onStopped = (message: SttWorkerEvent): void => {
if (message.streamId !== args.streamId) {
return
}
if (message.type === 'stopped') {
if (message.type === 'stopped' && message.streamId === args.streamId) {
receivedStopped = true
finish('stopped')
return
}
// Text for this stream means the engine is still working through it, however long its backlog is.
timeout?.refresh()
// Sessions share one queue, so any answer means the engine is still working toward this stream, not hung.
// A cancel keeps its short deadline.
if (!args.discard) {
timeout?.refresh()
}
}
const onError = (error: Error): void => finish('error', error)
const onExit = (): void => finish('exit')
+1 -1
View File
@@ -6,7 +6,7 @@ const WAV_HEADER_BYTES = 44
const CLOUD_RESPONSE_ALLOWANCE_MS = 30_000
const UPLOAD_BYTES_PER_MS = 125
// A finishing on-device dictation fails once the engine goes this long without text for it.
// A finishing on-device dictation fails once the engine goes this long without answering.
export const LOCAL_DICTATION_STOP_TIMEOUT_MS = 60_000
// How long an on-device model may take to load before its dictation fails.
export const START_DICTATION_TIMEOUT_MS = 60_000