dmed-voice-assistant 1.2.4 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +4 -2
- package/dist/recognition.js +12 -2
- package/dist/recorder.js +3 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -23,7 +23,8 @@ const VoiceAssistant = _ref => {
|
|
23
23
|
onNewRecordEvent,
|
24
24
|
onRecordDataChange,
|
25
25
|
onNewRecognitionEvent,
|
26
|
-
onRecognitionDataChange
|
26
|
+
onRecognitionDataChange,
|
27
|
+
onCloseRecognition
|
27
28
|
} = _ref;
|
28
29
|
const [mode, setMode] = (0, _react.useState)(!isOnlyRecognitionMode ? "recorder" : "recognition");
|
29
30
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
@@ -42,7 +43,8 @@ const VoiceAssistant = _ref => {
|
|
42
43
|
recognitionHistoryList: recognitionListValue,
|
43
44
|
onNewRecognitionEvent: onNewRecognitionEvent,
|
44
45
|
onRecognitionDataChange: onRecognitionDataChange,
|
45
|
-
isOnlyRecognitionMode: isOnlyRecognitionMode
|
46
|
+
isOnlyRecognitionMode: isOnlyRecognitionMode,
|
47
|
+
onCloseRecognition: onCloseRecognition
|
46
48
|
})]
|
47
49
|
})
|
48
50
|
});
|
package/dist/recognition.js
CHANGED
@@ -74,7 +74,8 @@ const Recognition = _ref4 => {
|
|
74
74
|
recognitionHistoryList,
|
75
75
|
setMode,
|
76
76
|
onNewRecognitionEvent,
|
77
|
-
onRecognitionDataChange
|
77
|
+
onRecognitionDataChange,
|
78
|
+
onCloseRecognition
|
78
79
|
} = _ref4;
|
79
80
|
const [open, setOpen] = (0, _react.useState)(false);
|
80
81
|
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
@@ -88,7 +89,7 @@ const Recognition = _ref4 => {
|
|
88
89
|
const recognitionRef = (0, _react.useRef)(null);
|
89
90
|
const mediaRecorderRef = (0, _react.useRef)(null);
|
90
91
|
const [result, setResult] = (0, _react.useState)([]);
|
91
|
-
const [historyList, setHistoryList] = (0, _react.useState)(
|
92
|
+
const [historyList, setHistoryList] = (0, _react.useState)([]);
|
92
93
|
const [filterHistoryList, setFilterHistoryList] = (0, _react.useState)([]);
|
93
94
|
const [dropdownList, setDropdownList] = (0, _react.useState)([]);
|
94
95
|
const [recordTime, setRecordTime] = (0, _react.useState)(0);
|
@@ -133,6 +134,11 @@ const Recognition = _ref4 => {
|
|
133
134
|
const handleLanguageChange = event => {
|
134
135
|
setSelectedLanguage(event.target.value);
|
135
136
|
};
|
137
|
+
const handleCloseModal = () => {
|
138
|
+
if (onCloseRecognition) {
|
139
|
+
onCloseRecognition();
|
140
|
+
}
|
141
|
+
};
|
136
142
|
const startRecording = async () => {
|
137
143
|
try {
|
138
144
|
if (recognitionRef.current) {
|
@@ -299,6 +305,9 @@ const Recognition = _ref4 => {
|
|
299
305
|
}, {});
|
300
306
|
setFilterHistoryList(groupedData[selectedDate] ? groupedData[selectedDate] : []);
|
301
307
|
}, [selectedDate, historyList]);
|
308
|
+
(0, _react.useEffect)(() => {
|
309
|
+
setHistoryList(recognitionHistoryList);
|
310
|
+
}, [recognitionHistoryList]);
|
302
311
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
303
312
|
className: "bg-white rounded-[5px] p-[20px] w-[440px]",
|
304
313
|
sx: {
|
@@ -328,6 +337,7 @@ const Recognition = _ref4 => {
|
|
328
337
|
})]
|
329
338
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
330
339
|
className: "px-[10px] py-[8px] cursor-pointer",
|
340
|
+
onClick: handleCloseModal,
|
331
341
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_svgs.CloseIcon, {})
|
332
342
|
})]
|
333
343
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
package/dist/recorder.js
CHANGED
@@ -57,12 +57,11 @@ const RecorderBox = _ref => {
|
|
57
57
|
const [voiceList, setVoiceList] = (0, _react.useState)([]);
|
58
58
|
const languageList = ['Auto-Detect', 'English', 'Chinese (Simplified)'];
|
59
59
|
const [selectedLanguage, setSelectedLanguage] = (0, _react.useState)("");
|
60
|
-
const [recordList, setRecordList] = (0, _react.useState)(
|
60
|
+
const [recordList, setRecordList] = (0, _react.useState)([]);
|
61
61
|
const [newRecordFileName, setNewRecordFileName] = (0, _react.useState)("");
|
62
62
|
const [newRecordTime, setNewRecordTime] = (0, _react.useState)(0);
|
63
63
|
const [isRunning, setIsRunning] = (0, _react.useState)(false);
|
64
64
|
const [intervalId, setIntervalId] = (0, _react.useState)(null);
|
65
|
-
const [audioBlob, setAudioBlob] = (0, _react.useState)(null);
|
66
65
|
const [audioSize, setAudioSize] = (0, _react.useState)(0);
|
67
66
|
const mediaRecorderRef = (0, _react.useRef)(null);
|
68
67
|
const handleVoiceChange = event => {
|
@@ -89,7 +88,6 @@ const RecorderBox = _ref => {
|
|
89
88
|
await initRecorder();
|
90
89
|
}
|
91
90
|
if (mediaRecorderRef.current) {
|
92
|
-
setAudioBlob(null);
|
93
91
|
mediaRecorderRef.current.start();
|
94
92
|
setIsStartedRecord(true);
|
95
93
|
setNewRecordFileName(getVoiceFileName(new Date()));
|
@@ -102,7 +100,6 @@ const RecorderBox = _ref => {
|
|
102
100
|
let {
|
103
101
|
blob
|
104
102
|
} = _ref2;
|
105
|
-
setAudioBlob(blob);
|
106
103
|
let temp = [...recordList];
|
107
104
|
const newVoice = {
|
108
105
|
audioURL: URL.createObjectURL(blob),
|
@@ -194,8 +191,8 @@ const RecorderBox = _ref => {
|
|
194
191
|
fetchAudioInputDevices();
|
195
192
|
}, []);
|
196
193
|
(0, _react.useEffect)(() => {
|
197
|
-
|
198
|
-
}, [
|
194
|
+
setRecordList(recordHistoryList);
|
195
|
+
}, [recordHistoryList]);
|
199
196
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
200
197
|
className: "bg-[#0B0B0B] rounded-[5px] border p-[20px] w-[850px]",
|
201
198
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
|