@eka-care/ekascribe-ts-sdk 1.5.31 → 1.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio-chunker/vad-web.js +4 -0
- package/dist/constants/types.d.ts +7 -0
- package/dist/fetch-client/helper.js +1 -1
- package/dist/fetch-client/index.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -0
- package/dist/store/store.d.ts +4 -1
- package/dist/store/store.js +13 -0
- package/package.json +1 -1
|
@@ -238,10 +238,14 @@ class VadWebClient {
|
|
|
238
238
|
const audioFileManager = EkaScribeStore.audioFileManagerInstance;
|
|
239
239
|
const audioBuffer = EkaScribeStore.audioBufferInstance;
|
|
240
240
|
this.is_vad_loading = true;
|
|
241
|
+
const vadFrameProcessedCallback = EkaScribeStore.vadFrameProcessedCallback;
|
|
241
242
|
const vad = await MicVAD.new({
|
|
242
243
|
frameSamples: this.frame_size,
|
|
243
244
|
preSpeechPadFrames: this.speech_pad_frames,
|
|
244
245
|
onFrameProcessed: (prob, frames) => {
|
|
246
|
+
if (vadFrameProcessedCallback) {
|
|
247
|
+
vadFrameProcessedCallback({ probabilities: prob, frame: frames });
|
|
248
|
+
}
|
|
245
249
|
audioFileManager?.incrementTotalRawSamples(frames);
|
|
246
250
|
audioBuffer?.append(frames);
|
|
247
251
|
// Check if audio chunk needs to be clipped
|
|
@@ -25,6 +25,7 @@ export default async function fetchWrapper(url, options = {}, timeoutMs = API_TI
|
|
|
25
25
|
credentials: 'include',
|
|
26
26
|
});
|
|
27
27
|
if (!response.ok) {
|
|
28
|
+
console.log(response, 'response in fetch wrapper');
|
|
28
29
|
if (onEventCallback) {
|
|
29
30
|
onEventCallback({
|
|
30
31
|
callback_type: CALLBACK_TYPE.AUTHENTICATION_STATUS,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TGetStatusResponse } from './api/transaction/get-voice-api-v3-status';
|
|
2
|
-
import { TEndRecordingResponse, TEventCallback, TGetTransactionHistoryResponse, TPatchTransactionRequest, TPatchVoiceApiV2ConfigRequest, TPatchVoiceApiV3StatusRequest, TPostTransactionResponse, TPostV1ConvertToTemplateRequest, TPostV1TemplateRequest, TPostV1TemplateSectionRequest, TPostV1UploadAudioFilesRequest, TStartRecordingRequest, TVadFramesCallback } from './constants/types';
|
|
2
|
+
import { TEndRecordingResponse, TEventCallback, TGetTransactionHistoryResponse, TPatchTransactionRequest, TPatchVoiceApiV2ConfigRequest, TPatchVoiceApiV3StatusRequest, TPostTransactionResponse, TPostV1ConvertToTemplateRequest, TPostV1TemplateRequest, TPostV1TemplateSectionRequest, TPostV1UploadAudioFilesRequest, TStartRecordingRequest, TVadFrameProcessedCallback, TVadFramesCallback } from './constants/types';
|
|
3
3
|
import { TSearchSessionsByPatientRequest } from './utils/search-sessions-by-patient-name';
|
|
4
4
|
declare class EkaScribe {
|
|
5
5
|
private static instance;
|
|
@@ -44,6 +44,7 @@ declare class EkaScribe {
|
|
|
44
44
|
onUserSpeechCallback(callback: (isSpeech: boolean) => void): void;
|
|
45
45
|
onEventCallback(callback: TEventCallback): void;
|
|
46
46
|
onVadFramesCallback(callback: TVadFramesCallback): void;
|
|
47
|
+
onVadFrameProcessedCallback(callback: TVadFrameProcessedCallback): void;
|
|
47
48
|
configureVadConstants({ pref_length, desp_length, max_length, sr, frame_size, pre_speech_pad_frames, short_thsld, long_thsld, }: {
|
|
48
49
|
pref_length: number;
|
|
49
50
|
desp_length: number;
|
package/dist/index.js
CHANGED
|
@@ -273,6 +273,9 @@ class EkaScribe {
|
|
|
273
273
|
onVadFramesCallback(callback) {
|
|
274
274
|
EkaScribeStore.vadFramesCallback = callback;
|
|
275
275
|
}
|
|
276
|
+
onVadFrameProcessedCallback(callback) {
|
|
277
|
+
EkaScribeStore.vadFrameProcessedCallback = callback;
|
|
278
|
+
}
|
|
276
279
|
configureVadConstants({ pref_length, desp_length, max_length, sr, frame_size, pre_speech_pad_frames, short_thsld, long_thsld, }) {
|
|
277
280
|
return this.vadInstance.configureVadConstants({
|
|
278
281
|
pref_length,
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AudioBufferManager from '../audio-chunker/audio-buffer-manager';
|
|
2
2
|
import AudioFileManager from '../audio-chunker/audio-file-manager';
|
|
3
3
|
import VadWebClient from '../audio-chunker/vad-web';
|
|
4
|
-
import { TEventCallback, TSessionStatus, TVadFramesCallback } from '../constants/types';
|
|
4
|
+
import { TEventCallback, TSessionStatus, TVadFrameProcessedCallback, TVadFramesCallback } from '../constants/types';
|
|
5
5
|
declare class EkaScribeStore {
|
|
6
6
|
private static instance;
|
|
7
7
|
private _txnID;
|
|
@@ -13,6 +13,7 @@ declare class EkaScribeStore {
|
|
|
13
13
|
private _userSpeechCallback;
|
|
14
14
|
private _eventCallback;
|
|
15
15
|
private _vadFramesCallback;
|
|
16
|
+
private _vadFrameProcessedCallback;
|
|
16
17
|
static getInstance(): EkaScribeStore;
|
|
17
18
|
get vadInstance(): VadWebClient | null;
|
|
18
19
|
set vadInstance(value: VadWebClient);
|
|
@@ -32,6 +33,8 @@ declare class EkaScribeStore {
|
|
|
32
33
|
set eventCallback(callback: TEventCallback | null);
|
|
33
34
|
get vadFramesCallback(): TVadFramesCallback | null;
|
|
34
35
|
set vadFramesCallback(callback: TVadFramesCallback | null);
|
|
36
|
+
get vadFrameProcessedCallback(): TVadFrameProcessedCallback | null;
|
|
37
|
+
set vadFrameProcessedCallback(callback: TVadFrameProcessedCallback | null);
|
|
35
38
|
resetStore(): void;
|
|
36
39
|
}
|
|
37
40
|
declare const _default: EkaScribeStore;
|
package/dist/store/store.js
CHANGED
|
@@ -54,6 +54,12 @@ class EkaScribeStore {
|
|
|
54
54
|
writable: true,
|
|
55
55
|
value: null
|
|
56
56
|
});
|
|
57
|
+
Object.defineProperty(this, "_vadFrameProcessedCallback", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: null
|
|
62
|
+
});
|
|
57
63
|
}
|
|
58
64
|
static getInstance() {
|
|
59
65
|
if (!EkaScribeStore.instance) {
|
|
@@ -124,6 +130,13 @@ class EkaScribeStore {
|
|
|
124
130
|
set vadFramesCallback(callback) {
|
|
125
131
|
this._vadFramesCallback = callback;
|
|
126
132
|
}
|
|
133
|
+
// Vad Frame Processed Callback
|
|
134
|
+
get vadFrameProcessedCallback() {
|
|
135
|
+
return this._vadFrameProcessedCallback;
|
|
136
|
+
}
|
|
137
|
+
set vadFrameProcessedCallback(callback) {
|
|
138
|
+
this._vadFrameProcessedCallback = callback;
|
|
139
|
+
}
|
|
127
140
|
// Reset store to initial state
|
|
128
141
|
resetStore() {
|
|
129
142
|
this._txnID = '';
|