Skip to content

Commit

Permalink
fix: Multiple post-release bug fixes (#217)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
lukeocodes authored Dec 5, 2023
1 parent 2734f69 commit 7c41660
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/lib/types/LiveTranscriptionEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface LiveTranscriptionEvent {
channel: {
alternatives: {
transcript: string;
confidence: boolean;
confidence: number;
words: {
word: string;
start: number;
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/SyncPrerecordedResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface Channel {
search?: Search[];
alternatives: Alternative[];
detected_language?: string;
language_confidence?: number;
}

interface Entity {
Expand Down
11 changes: 0 additions & 11 deletions src/packages/LiveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down

0 comments on commit 7c41660

Please sign in to comment.