@myun/gimi-chat 0.4.2 → 0.4.4
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.
|
@@ -171,7 +171,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
171
171
|
return /*#__PURE__*/React.createElement(FileUpload, {
|
|
172
172
|
ref: uploadFileRef,
|
|
173
173
|
accept: props.accept,
|
|
174
|
-
disabled: props.disabled
|
|
174
|
+
disabled: props.disabled || (fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0
|
|
175
175
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
176
176
|
content: '上传文件'
|
|
177
177
|
}, (fileList === null || fileList === void 0 ? void 0 : fileList.length) === 0 ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -49,6 +49,9 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
49
49
|
var messageList = useAppSelector(function (state) {
|
|
50
50
|
return state.gimiMenu.messageList;
|
|
51
51
|
});
|
|
52
|
+
var fileList = useAppSelector(function (state) {
|
|
53
|
+
return state.gimiMenu.fileList;
|
|
54
|
+
});
|
|
52
55
|
var agentObj = useAppSelector(function (state) {
|
|
53
56
|
return state.gimiMenu.agentObj;
|
|
54
57
|
});
|
|
@@ -101,7 +104,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
101
104
|
agentDetail: agentObj,
|
|
102
105
|
conversationId: store.getState().gimiMenu.conversationId,
|
|
103
106
|
inputEditor: chatInputRef.current,
|
|
104
|
-
uploadFileList:
|
|
107
|
+
uploadFileList: fileList
|
|
105
108
|
};
|
|
106
109
|
});
|
|
107
110
|
React.useEffect(function () {
|
|
@@ -6,13 +6,27 @@ import { Provider } from 'react-redux';
|
|
|
6
6
|
var GimiChatComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
7
|
var commonChatRef = React.useRef(null);
|
|
8
8
|
React.useImperativeHandle(ref, function () {
|
|
9
|
-
var _commonChatRef$curren, _commonChatRef$curren2, _commonChatRef$curren3, _commonChatRef$curren4, _commonChatRef$curren5;
|
|
10
9
|
return {
|
|
11
|
-
messageList
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
get messageList() {
|
|
11
|
+
var _commonChatRef$curren;
|
|
12
|
+
return ((_commonChatRef$curren = commonChatRef.current) === null || _commonChatRef$curren === void 0 ? void 0 : _commonChatRef$curren.messageList) || [];
|
|
13
|
+
},
|
|
14
|
+
get agentDetail() {
|
|
15
|
+
var _commonChatRef$curren2;
|
|
16
|
+
return ((_commonChatRef$curren2 = commonChatRef.current) === null || _commonChatRef$curren2 === void 0 ? void 0 : _commonChatRef$curren2.agentDetail) || {};
|
|
17
|
+
},
|
|
18
|
+
get conversationId() {
|
|
19
|
+
var _commonChatRef$curren3;
|
|
20
|
+
return ((_commonChatRef$curren3 = commonChatRef.current) === null || _commonChatRef$curren3 === void 0 ? void 0 : _commonChatRef$curren3.conversationId) || null;
|
|
21
|
+
},
|
|
22
|
+
get inputEditor() {
|
|
23
|
+
var _commonChatRef$curren4;
|
|
24
|
+
return ((_commonChatRef$curren4 = commonChatRef.current) === null || _commonChatRef$curren4 === void 0 ? void 0 : _commonChatRef$curren4.inputEditor) || null;
|
|
25
|
+
},
|
|
26
|
+
get uploadFileList() {
|
|
27
|
+
var _commonChatRef$curren5;
|
|
28
|
+
return ((_commonChatRef$curren5 = commonChatRef.current) === null || _commonChatRef$curren5 === void 0 ? void 0 : _commonChatRef$curren5.uploadFileList) || [];
|
|
29
|
+
}
|
|
16
30
|
};
|
|
17
31
|
});
|
|
18
32
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
@@ -263,7 +263,7 @@ var useChatVoice = function useChatVoice() {
|
|
|
263
263
|
})), [stopTTSByText]);
|
|
264
264
|
useEffect(function () {
|
|
265
265
|
// 如果离开当前页面/会话,立即停止正在使用的语音功能
|
|
266
|
-
if (conversationId) {
|
|
266
|
+
if (conversationId || agentObj !== null && agentObj !== void 0 && agentObj.agentId) {
|
|
267
267
|
cleanFunction();
|
|
268
268
|
}
|
|
269
269
|
|
|
@@ -278,7 +278,7 @@ var useChatVoice = function useChatVoice() {
|
|
|
278
278
|
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
279
279
|
cleanFunction();
|
|
280
280
|
};
|
|
281
|
-
}, [conversationId, cleanFunction]);
|
|
281
|
+
}, [conversationId, agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentId, cleanFunction]);
|
|
282
282
|
useEffect(function () {
|
|
283
283
|
var handleMessage = function handleMessage(data) {
|
|
284
284
|
if (data.type === 'tts_play_end') {
|