sera-ai 1.0.6 → 1.0.7
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -48,6 +48,7 @@ interface AudioDictationProps {
|
|
|
48
48
|
onDictationComplete: (message: string) => void;
|
|
49
49
|
onDictationStart?: () => void;
|
|
50
50
|
onProcessingStart?: () => void;
|
|
51
|
+
onError?: (error: string) => void;
|
|
51
52
|
className?: string;
|
|
52
53
|
style?: React$1.CSSProperties;
|
|
53
54
|
buttonText?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ interface AudioDictationProps {
|
|
|
48
48
|
onDictationComplete: (message: string) => void;
|
|
49
49
|
onDictationStart?: () => void;
|
|
50
50
|
onProcessingStart?: () => void;
|
|
51
|
+
onError?: (error: string) => void;
|
|
51
52
|
className?: string;
|
|
52
53
|
style?: React$1.CSSProperties;
|
|
53
54
|
buttonText?: string;
|
package/dist/index.js
CHANGED
|
@@ -4607,6 +4607,7 @@ var useAudioDictation = ({
|
|
|
4607
4607
|
onDictationComplete,
|
|
4608
4608
|
onDictationStart,
|
|
4609
4609
|
onProcessingStart,
|
|
4610
|
+
onError,
|
|
4610
4611
|
apiKey,
|
|
4611
4612
|
apiBaseUrl = API_BASE_URL2,
|
|
4612
4613
|
appendMode = true,
|
|
@@ -4695,7 +4696,9 @@ var useAudioDictation = ({
|
|
|
4695
4696
|
setAudioBuffer(combinedBuffer);
|
|
4696
4697
|
} else {
|
|
4697
4698
|
console.warn("Final chunk received but no audio data accumulated");
|
|
4698
|
-
|
|
4699
|
+
const errorMessage = "No audio data was recorded";
|
|
4700
|
+
setDictationError(errorMessage);
|
|
4701
|
+
onError?.(errorMessage);
|
|
4699
4702
|
}
|
|
4700
4703
|
}
|
|
4701
4704
|
};
|
|
@@ -4709,7 +4712,9 @@ var useAudioDictation = ({
|
|
|
4709
4712
|
} catch (error) {
|
|
4710
4713
|
console.error("Error starting dictation:", error);
|
|
4711
4714
|
setIsDictating(false);
|
|
4712
|
-
|
|
4715
|
+
const errorMessage = "An error occurred while starting dictation";
|
|
4716
|
+
setDictationError(errorMessage);
|
|
4717
|
+
onError?.(errorMessage);
|
|
4713
4718
|
}
|
|
4714
4719
|
};
|
|
4715
4720
|
const stopDictating = async () => {
|
|
@@ -4768,15 +4773,21 @@ var useAudioDictation = ({
|
|
|
4768
4773
|
await processDictationAudio(combinedBuffer);
|
|
4769
4774
|
} else {
|
|
4770
4775
|
console.error("No valid audio data found");
|
|
4771
|
-
|
|
4776
|
+
const errorMessage = "No audio data recorded";
|
|
4777
|
+
setDictationError(errorMessage);
|
|
4778
|
+
onError?.(errorMessage);
|
|
4772
4779
|
}
|
|
4773
4780
|
} else {
|
|
4774
4781
|
console.error("No audio data to process");
|
|
4775
|
-
|
|
4782
|
+
const errorMessage = "No audio data to process";
|
|
4783
|
+
setDictationError(errorMessage);
|
|
4784
|
+
onError?.(errorMessage);
|
|
4776
4785
|
}
|
|
4777
4786
|
} catch (error) {
|
|
4778
4787
|
console.error("Error stopping recording:", error);
|
|
4779
|
-
|
|
4788
|
+
const errorMessage = "An error occurred while stopping dictation";
|
|
4789
|
+
setDictationError(errorMessage);
|
|
4790
|
+
onError?.(errorMessage);
|
|
4780
4791
|
} finally {
|
|
4781
4792
|
setIsDictating(false);
|
|
4782
4793
|
audioSamplesRef.current = [];
|
|
@@ -4895,11 +4906,15 @@ var useAudioDictation = ({
|
|
|
4895
4906
|
onDictationComplete(convertedData.dictation);
|
|
4896
4907
|
} else {
|
|
4897
4908
|
console.error("No dictation text in response");
|
|
4898
|
-
|
|
4909
|
+
const errorMessage = "No dictation text in response";
|
|
4910
|
+
setDictationError(errorMessage);
|
|
4911
|
+
onError?.(errorMessage);
|
|
4899
4912
|
}
|
|
4900
4913
|
} catch (error) {
|
|
4901
4914
|
console.error("Error processing dictation audio:", error);
|
|
4902
|
-
|
|
4915
|
+
const errorMessage = "An error occurred while processing dictation";
|
|
4916
|
+
setDictationError(errorMessage);
|
|
4917
|
+
onError?.(errorMessage);
|
|
4903
4918
|
} finally {
|
|
4904
4919
|
setIsProcessing(false);
|
|
4905
4920
|
setIsDictating(false);
|
|
@@ -4988,6 +5003,7 @@ var AudioDictation = ({
|
|
|
4988
5003
|
onDictationComplete,
|
|
4989
5004
|
onDictationStart,
|
|
4990
5005
|
onProcessingStart,
|
|
5006
|
+
onError,
|
|
4991
5007
|
className = "",
|
|
4992
5008
|
style,
|
|
4993
5009
|
buttonText,
|
|
@@ -5000,6 +5016,7 @@ var AudioDictation = ({
|
|
|
5000
5016
|
onDictationComplete,
|
|
5001
5017
|
onDictationStart,
|
|
5002
5018
|
onProcessingStart,
|
|
5019
|
+
onError,
|
|
5003
5020
|
apiKey,
|
|
5004
5021
|
apiBaseUrl,
|
|
5005
5022
|
appendMode,
|