From 7c416605fc5953c8777b3685e014cf874c08eecf Mon Sep 17 00:00:00 2001 From: Luke Oliff Date: Tue, 5 Dec 2023 15:16:20 +0000 Subject: [PATCH] fix: Multiple post-release bug fixes (#217) * fix: remove unnecessary complexity from close event (#214) * fix: add missing type to channel interface (#215) * fix: mistyped definition for alternative confidence on live event (#216) --- src/lib/types/LiveTranscriptionEvent.ts | 2 +- src/lib/types/SyncPrerecordedResponse.ts | 1 + src/packages/LiveClient.ts | 11 ----------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/lib/types/LiveTranscriptionEvent.ts b/src/lib/types/LiveTranscriptionEvent.ts index 31d07ac7..c4f5e534 100644 --- a/src/lib/types/LiveTranscriptionEvent.ts +++ b/src/lib/types/LiveTranscriptionEvent.ts @@ -8,7 +8,7 @@ export interface LiveTranscriptionEvent { channel: { alternatives: { transcript: string; - confidence: boolean; + confidence: number; words: { word: string; start: number; diff --git a/src/lib/types/SyncPrerecordedResponse.ts b/src/lib/types/SyncPrerecordedResponse.ts index be53c667..81d0a6cc 100644 --- a/src/lib/types/SyncPrerecordedResponse.ts +++ b/src/lib/types/SyncPrerecordedResponse.ts @@ -18,6 +18,7 @@ interface Channel { search?: Search[]; alternatives: Alternative[]; detected_language?: string; + language_confidence?: number; } interface Entity { diff --git a/src/packages/LiveClient.ts b/src/packages/LiveClient.ts index ebc1e861..2522e4f1 100644 --- a/src/packages/LiveClient.ts +++ b/src/packages/LiveClient.ts @@ -35,17 +35,6 @@ export class LiveClient extends AbstractWsClient { }; this._socket.onclose = (event: any) => { - /** - * changing the event.target to any to access the private _req - * property that isn't available on the WebSocket.CloseEvent type - **/ - const newTarget: any = event.target; - - if (newTarget["_req"]) { - const dgErrorIndex = newTarget["_req"].res.rawHeaders.indexOf("dg-error"); - event.reason = newTarget["_req"].res.rawHeaders[dgErrorIndex + 1]; - } - this.emit(LiveTranscriptionEvents.Close, event); };