blob: b6c7320ce1a7f78a8151409123fdd4c46fab240a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Client -> Server messages
export type StartMessage = {
type: "start";
sampleRate: number;
channels: number;
encoding: "pcm32f" | "pcm16";
contractId?: string;
authToken?: string;
};
export type StopMessage = {
type: "stop";
reason?: string;
};
export type ClientMessage = StartMessage | StopMessage;
// Server -> Client messages
export type ReadyMessage = {
type: "ready";
sessionId: string;
};
export type TranscriptMessage = {
type: "transcript";
speaker: string;
start: number;
end: number;
text: string;
isFinal: boolean;
};
export type ErrorMessage = {
type: "error";
code: string;
message: string;
};
export type StoppedMessage = {
type: "stopped";
reason: string;
};
export type TranscriptSavedMessage = {
type: "transcriptSaved";
fileId: string;
contractId: string;
};
export type ServerMessage =
| ReadyMessage
| TranscriptMessage
| ErrorMessage
| StoppedMessage
| TranscriptSavedMessage;
// Transcript entry for display
export interface TranscriptEntry {
id: string;
speaker: string;
start: number;
end: number;
text: string;
isFinal: boolean;
}
|