@mastra/react 1.4.1 → 1.4.2-alpha.1
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/CHANGELOG.md +18 -0
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -3212,6 +3212,7 @@ const useMastraSpeechToText = ({ agent, language }) => {
|
|
|
3212
3212
|
const start = () => {
|
|
3213
3213
|
if (!agent || startInFlightRef.current || recorderRef.current) return;
|
|
3214
3214
|
startInFlightRef.current = true;
|
|
3215
|
+
sessionRef.current += 1;
|
|
3215
3216
|
const session = sessionRef.current;
|
|
3216
3217
|
recordMicrophoneToFile(handleFinish(session)).then((recorder) => {
|
|
3217
3218
|
startInFlightRef.current = false;
|
|
@@ -3240,10 +3241,11 @@ const useMastraSpeechToText = ({ agent, language }) => {
|
|
|
3240
3241
|
});
|
|
3241
3242
|
};
|
|
3242
3243
|
const stop = () => {
|
|
3243
|
-
|
|
3244
|
+
if (recorderRef.current) {
|
|
3245
|
+
recorderRef.current.stop();
|
|
3246
|
+
recorderRef.current = null;
|
|
3247
|
+
} else if (startInFlightRef.current) sessionRef.current += 1;
|
|
3244
3248
|
startInFlightRef.current = false;
|
|
3245
|
-
recorderRef.current?.stop();
|
|
3246
|
-
recorderRef.current = null;
|
|
3247
3249
|
setState((prev) => ({
|
|
3248
3250
|
...prev,
|
|
3249
3251
|
isListening: false
|