sera-ai 1.0.6 → 1.0.8
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/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +31 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ interface AudioRecorderProps {
|
|
|
6
6
|
apiBaseUrl?: string;
|
|
7
7
|
patientId?: number;
|
|
8
8
|
patientName?: string;
|
|
9
|
+
patientHistory?: string;
|
|
9
10
|
onTranscriptionUpdate?: (text: string, sessionId: string) => void;
|
|
10
11
|
onTranscriptionComplete?: (text: string, classification: ClassificationInfoResponse, sessionId: string) => void;
|
|
11
12
|
onSuccess?: (data: any) => void;
|
|
@@ -48,6 +49,7 @@ interface AudioDictationProps {
|
|
|
48
49
|
onDictationComplete: (message: string) => void;
|
|
49
50
|
onDictationStart?: () => void;
|
|
50
51
|
onProcessingStart?: () => void;
|
|
52
|
+
onError?: (error: string) => void;
|
|
51
53
|
className?: string;
|
|
52
54
|
style?: React$1.CSSProperties;
|
|
53
55
|
buttonText?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ interface AudioRecorderProps {
|
|
|
6
6
|
apiBaseUrl?: string;
|
|
7
7
|
patientId?: number;
|
|
8
8
|
patientName?: string;
|
|
9
|
+
patientHistory?: string;
|
|
9
10
|
onTranscriptionUpdate?: (text: string, sessionId: string) => void;
|
|
10
11
|
onTranscriptionComplete?: (text: string, classification: ClassificationInfoResponse, sessionId: string) => void;
|
|
11
12
|
onSuccess?: (data: any) => void;
|
|
@@ -48,6 +49,7 @@ interface AudioDictationProps {
|
|
|
48
49
|
onDictationComplete: (message: string) => void;
|
|
49
50
|
onDictationStart?: () => void;
|
|
50
51
|
onProcessingStart?: () => void;
|
|
52
|
+
onError?: (error: string) => void;
|
|
51
53
|
className?: string;
|
|
52
54
|
style?: React$1.CSSProperties;
|
|
53
55
|
buttonText?: string;
|
package/dist/index.js
CHANGED
|
@@ -2852,6 +2852,7 @@ var useAudioRecorder = ({
|
|
|
2852
2852
|
speciality,
|
|
2853
2853
|
patientId,
|
|
2854
2854
|
patientName,
|
|
2855
|
+
patientHistory,
|
|
2855
2856
|
selectedFormat = "json",
|
|
2856
2857
|
skipDiarization = true,
|
|
2857
2858
|
silenceRemoval = true,
|
|
@@ -3233,6 +3234,7 @@ var useAudioRecorder = ({
|
|
|
3233
3234
|
formData.append("model", selectedModelRef.current);
|
|
3234
3235
|
formData.append("doctorName", doctorName);
|
|
3235
3236
|
formData.append("patientName", patientName || "");
|
|
3237
|
+
if (patientHistory) formData.append("patientHistory", patientHistory);
|
|
3236
3238
|
if (patientId) formData.append("patientId", patientId.toString());
|
|
3237
3239
|
formData.append("removeSilence", removeSilenceRef.current.toString());
|
|
3238
3240
|
formData.append("skipDiarization", skipDiarizationRef.current.toString());
|
|
@@ -3414,6 +3416,7 @@ var useAudioRecorder = ({
|
|
|
3414
3416
|
skipDiarization,
|
|
3415
3417
|
selectedFormat,
|
|
3416
3418
|
patientName,
|
|
3419
|
+
patientHistory,
|
|
3417
3420
|
onTranscriptionComplete,
|
|
3418
3421
|
speciality,
|
|
3419
3422
|
removeSilence,
|
|
@@ -3472,6 +3475,7 @@ var useAudioRecorder = ({
|
|
|
3472
3475
|
await createSession(localSessionId, {
|
|
3473
3476
|
patientId,
|
|
3474
3477
|
patientName: patientName || void 0,
|
|
3478
|
+
patientHistory: patientHistory || void 0,
|
|
3475
3479
|
speciality
|
|
3476
3480
|
});
|
|
3477
3481
|
}
|
|
@@ -3570,6 +3574,7 @@ var useAudioRecorder = ({
|
|
|
3570
3574
|
createSession,
|
|
3571
3575
|
patientId,
|
|
3572
3576
|
patientName,
|
|
3577
|
+
patientHistory,
|
|
3573
3578
|
speciality,
|
|
3574
3579
|
currentDeviceId
|
|
3575
3580
|
]);
|
|
@@ -4360,6 +4365,7 @@ var AudioRecorder = ({
|
|
|
4360
4365
|
speciality,
|
|
4361
4366
|
patientId,
|
|
4362
4367
|
patientName,
|
|
4368
|
+
patientHistory,
|
|
4363
4369
|
onTranscriptionUpdate,
|
|
4364
4370
|
onTranscriptionComplete,
|
|
4365
4371
|
onSuccess,
|
|
@@ -4394,6 +4400,7 @@ var AudioRecorder = ({
|
|
|
4394
4400
|
speciality,
|
|
4395
4401
|
patientName,
|
|
4396
4402
|
patientId,
|
|
4403
|
+
patientHistory,
|
|
4397
4404
|
onTranscriptionUpdate: (text, sessionId) => {
|
|
4398
4405
|
console.log("onTranscriptionUpdate called with text:", text, "sessionId:", sessionId);
|
|
4399
4406
|
if (text.length > 0) {
|
|
@@ -4607,6 +4614,7 @@ var useAudioDictation = ({
|
|
|
4607
4614
|
onDictationComplete,
|
|
4608
4615
|
onDictationStart,
|
|
4609
4616
|
onProcessingStart,
|
|
4617
|
+
onError,
|
|
4610
4618
|
apiKey,
|
|
4611
4619
|
apiBaseUrl = API_BASE_URL2,
|
|
4612
4620
|
appendMode = true,
|
|
@@ -4695,7 +4703,9 @@ var useAudioDictation = ({
|
|
|
4695
4703
|
setAudioBuffer(combinedBuffer);
|
|
4696
4704
|
} else {
|
|
4697
4705
|
console.warn("Final chunk received but no audio data accumulated");
|
|
4698
|
-
|
|
4706
|
+
const errorMessage = "No audio data was recorded";
|
|
4707
|
+
setDictationError(errorMessage);
|
|
4708
|
+
onError?.(errorMessage);
|
|
4699
4709
|
}
|
|
4700
4710
|
}
|
|
4701
4711
|
};
|
|
@@ -4709,7 +4719,9 @@ var useAudioDictation = ({
|
|
|
4709
4719
|
} catch (error) {
|
|
4710
4720
|
console.error("Error starting dictation:", error);
|
|
4711
4721
|
setIsDictating(false);
|
|
4712
|
-
|
|
4722
|
+
const errorMessage = "An error occurred while starting dictation";
|
|
4723
|
+
setDictationError(errorMessage);
|
|
4724
|
+
onError?.(errorMessage);
|
|
4713
4725
|
}
|
|
4714
4726
|
};
|
|
4715
4727
|
const stopDictating = async () => {
|
|
@@ -4768,15 +4780,21 @@ var useAudioDictation = ({
|
|
|
4768
4780
|
await processDictationAudio(combinedBuffer);
|
|
4769
4781
|
} else {
|
|
4770
4782
|
console.error("No valid audio data found");
|
|
4771
|
-
|
|
4783
|
+
const errorMessage = "No audio data recorded";
|
|
4784
|
+
setDictationError(errorMessage);
|
|
4785
|
+
onError?.(errorMessage);
|
|
4772
4786
|
}
|
|
4773
4787
|
} else {
|
|
4774
4788
|
console.error("No audio data to process");
|
|
4775
|
-
|
|
4789
|
+
const errorMessage = "No audio data to process";
|
|
4790
|
+
setDictationError(errorMessage);
|
|
4791
|
+
onError?.(errorMessage);
|
|
4776
4792
|
}
|
|
4777
4793
|
} catch (error) {
|
|
4778
4794
|
console.error("Error stopping recording:", error);
|
|
4779
|
-
|
|
4795
|
+
const errorMessage = "An error occurred while stopping dictation";
|
|
4796
|
+
setDictationError(errorMessage);
|
|
4797
|
+
onError?.(errorMessage);
|
|
4780
4798
|
} finally {
|
|
4781
4799
|
setIsDictating(false);
|
|
4782
4800
|
audioSamplesRef.current = [];
|
|
@@ -4895,11 +4913,15 @@ var useAudioDictation = ({
|
|
|
4895
4913
|
onDictationComplete(convertedData.dictation);
|
|
4896
4914
|
} else {
|
|
4897
4915
|
console.error("No dictation text in response");
|
|
4898
|
-
|
|
4916
|
+
const errorMessage = "No dictation text in response";
|
|
4917
|
+
setDictationError(errorMessage);
|
|
4918
|
+
onError?.(errorMessage);
|
|
4899
4919
|
}
|
|
4900
4920
|
} catch (error) {
|
|
4901
4921
|
console.error("Error processing dictation audio:", error);
|
|
4902
|
-
|
|
4922
|
+
const errorMessage = "An error occurred while processing dictation";
|
|
4923
|
+
setDictationError(errorMessage);
|
|
4924
|
+
onError?.(errorMessage);
|
|
4903
4925
|
} finally {
|
|
4904
4926
|
setIsProcessing(false);
|
|
4905
4927
|
setIsDictating(false);
|
|
@@ -4988,6 +5010,7 @@ var AudioDictation = ({
|
|
|
4988
5010
|
onDictationComplete,
|
|
4989
5011
|
onDictationStart,
|
|
4990
5012
|
onProcessingStart,
|
|
5013
|
+
onError,
|
|
4991
5014
|
className = "",
|
|
4992
5015
|
style,
|
|
4993
5016
|
buttonText,
|
|
@@ -5000,6 +5023,7 @@ var AudioDictation = ({
|
|
|
5000
5023
|
onDictationComplete,
|
|
5001
5024
|
onDictationStart,
|
|
5002
5025
|
onProcessingStart,
|
|
5026
|
+
onError,
|
|
5003
5027
|
apiKey,
|
|
5004
5028
|
apiBaseUrl,
|
|
5005
5029
|
appendMode,
|