File tree Expand file tree Collapse file tree 7 files changed +21
-10
lines changed Expand file tree Collapse file tree 7 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 1
1
import {
2
2
LiveTranscriptionOptions ,
3
3
PrerecordedTranscriptionOptions ,
4
- TranscriptionResponse ,
4
+ PrerecordedTranscriptionResponse ,
5
5
TranscriptionSource ,
6
6
} from "../types" ;
7
7
import { LiveTranscription } from "./liveTranscription" ;
@@ -18,7 +18,7 @@ export class Transcriber {
18
18
async preRecorded (
19
19
source : TranscriptionSource ,
20
20
options ?: PrerecordedTranscriptionOptions
21
- ) : Promise < TranscriptionResponse > {
21
+ ) : Promise < PrerecordedTranscriptionResponse > {
22
22
return await preRecordedTranscription (
23
23
this . _credentials ,
24
24
this . _apiUrl || "" ,
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export class LiveTranscription extends EventEmitter {
18
18
`wss://${ apiUrl } /v1/listen?${ querystring . stringify ( options ) } ` ,
19
19
{
20
20
headers : {
21
- Authorization : `Basic ${ credentials } ` ,
21
+ Authorization : `token ${ credentials } ` ,
22
22
"User-Agent" : userAgent ( ) ,
23
23
} ,
24
24
}
@@ -40,7 +40,7 @@ export class LiveTranscription extends EventEmitter {
40
40
} ;
41
41
42
42
this . _socket . onmessage = ( m ) => {
43
- this . emit ( LiveTranscriptionEvents . TranscriptReceived , m ) ;
43
+ this . emit ( LiveTranscriptionEvents . TranscriptReceived , m . data ) ;
44
44
} ;
45
45
}
46
46
Original file line number Diff line number Diff line change 1
1
import querystring from "querystring" ;
2
2
import {
3
- TranscriptionResponse ,
4
3
PrerecordedTranscriptionOptions ,
4
+ PrerecordedTranscriptionResponse ,
5
5
TranscriptionSource ,
6
6
UrlSource ,
7
7
} from "../types" ;
@@ -25,7 +25,7 @@ export const preRecordedTranscription = async (
25
25
apiUrl : string ,
26
26
source : TranscriptionSource ,
27
27
options ?: PrerecordedTranscriptionOptions
28
- ) : Promise < TranscriptionResponse > => {
28
+ ) : Promise < PrerecordedTranscriptionResponse > => {
29
29
const transcriptionOptions = { ...{ } , ...options } ;
30
30
31
31
if (
@@ -35,7 +35,7 @@ export const preRecordedTranscription = async (
35
35
throw new Error ( "DG: Mimetype must be provided if the source is a Buffer" ) ;
36
36
}
37
37
38
- return await _request < TranscriptionResponse > (
38
+ return await _request < PrerecordedTranscriptionResponse > (
39
39
"POST" ,
40
40
apiKey ,
41
41
apiUrl ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export type Channel = {
8
8
/**
9
9
* Searched terms & results
10
10
*/
11
- search : Array < Search > ;
11
+ search ? : Array < Search > ;
12
12
alternatives : Array < {
13
13
/**
14
14
* Text of speech identified by API
Original file line number Diff line number Diff line change @@ -3,13 +3,14 @@ export * from "./hit";
3
3
export * from "./key" ;
4
4
export * from "./keyResponse" ;
5
5
export * from "./liveTranscriptionOptions" ;
6
+ export * from "./liveTranscriptionResponse" ;
6
7
export * from "./member" ;
7
8
export * from "./metadata" ;
8
9
export * from "./prerecordedTranscriptionOptions" ;
10
+ export * from "./prerecordedTranscriptionResponse" ;
9
11
export * from "./project" ;
10
12
export * from "./projectResponse" ;
11
13
export * from "./search" ;
12
- export * from "./transcriptionResponse" ;
13
14
export * from "./transcriptionSource" ;
14
15
export * from "./usageCallback" ;
15
16
export * from "./usageField" ;
Original file line number Diff line number Diff line change
1
+ import { Channel } from "./channel" ;
2
+
3
+ export type LiveTranscriptionResponse = {
4
+ channel_index : Array < number > ;
5
+ duration : number ;
6
+ start : number ;
7
+ is_final : boolean ;
8
+ speech_final : boolean ;
9
+ channel : Channel ;
10
+ } ;
Original file line number Diff line number Diff line change 1
1
import { Metadata } from "./metadata" ;
2
2
import { Channel } from "./channel" ;
3
3
4
- export type TranscriptionResponse = {
4
+ export type PrerecordedTranscriptionResponse = {
5
5
request_id ?: string ;
6
6
metadata ?: Metadata ;
7
7
results ?: {
You can’t perform that action at this time.
0 commit comments