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.mjs CHANGED
@@ -2828,6 +2828,7 @@ var useAudioRecorder = ({
2828
2828
  speciality,
2829
2829
  patientId,
2830
2830
  patientName,
2831
+ patientHistory,
2831
2832
  selectedFormat = "json",
2832
2833
  skipDiarization = true,
2833
2834
  silenceRemoval = true,
@@ -3209,6 +3210,7 @@ var useAudioRecorder = ({
3209
3210
  formData.append("model", selectedModelRef.current);
3210
3211
  formData.append("doctorName", doctorName);
3211
3212
  formData.append("patientName", patientName || "");
3213
+ if (patientHistory) formData.append("patientHistory", patientHistory);
3212
3214
  if (patientId) formData.append("patientId", patientId.toString());
3213
3215
  formData.append("removeSilence", removeSilenceRef.current.toString());
3214
3216
  formData.append("skipDiarization", skipDiarizationRef.current.toString());
@@ -3390,6 +3392,7 @@ var useAudioRecorder = ({
3390
3392
  skipDiarization,
3391
3393
  selectedFormat,
3392
3394
  patientName,
3395
+ patientHistory,
3393
3396
  onTranscriptionComplete,
3394
3397
  speciality,
3395
3398
  removeSilence,
@@ -3448,6 +3451,7 @@ var useAudioRecorder = ({
3448
3451
  await createSession(localSessionId, {
3449
3452
  patientId,
3450
3453
  patientName: patientName || void 0,
3454
+ patientHistory: patientHistory || void 0,
3451
3455
  speciality
3452
3456
  });
3453
3457
  }
@@ -3546,6 +3550,7 @@ var useAudioRecorder = ({
3546
3550
  createSession,
3547
3551
  patientId,
3548
3552
  patientName,
3553
+ patientHistory,
3549
3554
  speciality,
3550
3555
  currentDeviceId
3551
3556
  ]);
@@ -4336,6 +4341,7 @@ var AudioRecorder = ({
4336
4341
  speciality,
4337
4342
  patientId,
4338
4343
  patientName,
4344
+ patientHistory,
4339
4345
  onTranscriptionUpdate,
4340
4346
  onTranscriptionComplete,
4341
4347
  onSuccess,
@@ -4370,6 +4376,7 @@ var AudioRecorder = ({
4370
4376
  speciality,
4371
4377
  patientName,
4372
4378
  patientId,
4379
+ patientHistory,
4373
4380
  onTranscriptionUpdate: (text, sessionId) => {
4374
4381
  console.log("onTranscriptionUpdate called with text:", text, "sessionId:", sessionId);
4375
4382
  if (text.length > 0) {
@@ -4583,6 +4590,7 @@ var useAudioDictation = ({
4583
4590
  onDictationComplete,
4584
4591
  onDictationStart,
4585
4592
  onProcessingStart,
4593
+ onError,
4586
4594
  apiKey,
4587
4595
  apiBaseUrl = API_BASE_URL2,
4588
4596
  appendMode = true,
@@ -4671,7 +4679,9 @@ var useAudioDictation = ({
4671
4679
  setAudioBuffer(combinedBuffer);
4672
4680
  } else {
4673
4681
  console.warn("Final chunk received but no audio data accumulated");
4674
- setDictationError("No audio data was recorded");
4682
+ const errorMessage = "No audio data was recorded";
4683
+ setDictationError(errorMessage);
4684
+ onError?.(errorMessage);
4675
4685
  }
4676
4686
  }
4677
4687
  };
@@ -4685,7 +4695,9 @@ var useAudioDictation = ({
4685
4695
  } catch (error) {
4686
4696
  console.error("Error starting dictation:", error);
4687
4697
  setIsDictating(false);
4688
- setDictationError("An error occurred while starting dictation");
4698
+ const errorMessage = "An error occurred while starting dictation";
4699
+ setDictationError(errorMessage);
4700
+ onError?.(errorMessage);
4689
4701
  }
4690
4702
  };
4691
4703
  const stopDictating = async () => {
@@ -4744,15 +4756,21 @@ var useAudioDictation = ({
4744
4756
  await processDictationAudio(combinedBuffer);
4745
4757
  } else {
4746
4758
  console.error("No valid audio data found");
4747
- setDictationError("No audio data recorded");
4759
+ const errorMessage = "No audio data recorded";
4760
+ setDictationError(errorMessage);
4761
+ onError?.(errorMessage);
4748
4762
  }
4749
4763
  } else {
4750
4764
  console.error("No audio data to process");
4751
- setDictationError("No audio data to process");
4765
+ const errorMessage = "No audio data to process";
4766
+ setDictationError(errorMessage);
4767
+ onError?.(errorMessage);
4752
4768
  }
4753
4769
  } catch (error) {
4754
4770
  console.error("Error stopping recording:", error);
4755
- setDictationError("An error occurred while stopping dictation");
4771
+ const errorMessage = "An error occurred while stopping dictation";
4772
+ setDictationError(errorMessage);
4773
+ onError?.(errorMessage);
4756
4774
  } finally {
4757
4775
  setIsDictating(false);
4758
4776
  audioSamplesRef.current = [];
@@ -4871,11 +4889,15 @@ var useAudioDictation = ({
4871
4889
  onDictationComplete(convertedData.dictation);
4872
4890
  } else {
4873
4891
  console.error("No dictation text in response");
4874
- setDictationError("No dictation text in response");
4892
+ const errorMessage = "No dictation text in response";
4893
+ setDictationError(errorMessage);
4894
+ onError?.(errorMessage);
4875
4895
  }
4876
4896
  } catch (error) {
4877
4897
  console.error("Error processing dictation audio:", error);
4878
- setDictationError("An error occurred while processing dictation");
4898
+ const errorMessage = "An error occurred while processing dictation";
4899
+ setDictationError(errorMessage);
4900
+ onError?.(errorMessage);
4879
4901
  } finally {
4880
4902
  setIsProcessing(false);
4881
4903
  setIsDictating(false);
@@ -4964,6 +4986,7 @@ var AudioDictation = ({
4964
4986
  onDictationComplete,
4965
4987
  onDictationStart,
4966
4988
  onProcessingStart,
4989
+ onError,
4967
4990
  className = "",
4968
4991
  style,
4969
4992
  buttonText,
@@ -4976,6 +4999,7 @@ var AudioDictation = ({
4976
4999
  onDictationComplete,
4977
5000
  onDictationStart,
4978
5001
  onProcessingStart,
5002
+ onError,
4979
5003
  apiKey,
4980
5004
  apiBaseUrl,
4981
5005
  appendMode,