@myun/gimi-chat 0.4.0 → 0.4.2
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/components/templates/CommonChat.js +2 -1
- package/dist/components/templates/GimiChatComponent.js +3 -2
- package/dist/components/upload-list/index.module.css +1 -0
- package/dist/hooks/useChatHistory.js +2 -2
- package/dist/hooks/useChatStream.js +9 -0
- package/dist/types/chat.d.ts +1 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
|
@@ -100,7 +100,8 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
100
100
|
messageList: messageList,
|
|
101
101
|
agentDetail: agentObj,
|
|
102
102
|
conversationId: store.getState().gimiMenu.conversationId,
|
|
103
|
-
inputEditor: chatInputRef.current
|
|
103
|
+
inputEditor: chatInputRef.current,
|
|
104
|
+
uploadFileList: store.getState().gimiMenu.fileList
|
|
104
105
|
};
|
|
105
106
|
});
|
|
106
107
|
React.useEffect(function () {
|
|
@@ -6,12 +6,13 @@ 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;
|
|
9
|
+
var _commonChatRef$curren, _commonChatRef$curren2, _commonChatRef$curren3, _commonChatRef$curren4, _commonChatRef$curren5;
|
|
10
10
|
return {
|
|
11
11
|
messageList: ((_commonChatRef$curren = commonChatRef.current) === null || _commonChatRef$curren === void 0 ? void 0 : _commonChatRef$curren.messageList) || [],
|
|
12
12
|
agentDetail: ((_commonChatRef$curren2 = commonChatRef.current) === null || _commonChatRef$curren2 === void 0 ? void 0 : _commonChatRef$curren2.agentDetail) || {},
|
|
13
13
|
conversationId: ((_commonChatRef$curren3 = commonChatRef.current) === null || _commonChatRef$curren3 === void 0 ? void 0 : _commonChatRef$curren3.conversationId) || null,
|
|
14
|
-
inputEditor: ((_commonChatRef$curren4 = commonChatRef.current) === null || _commonChatRef$curren4 === void 0 ? void 0 : _commonChatRef$curren4.inputEditor) || null
|
|
14
|
+
inputEditor: ((_commonChatRef$curren4 = commonChatRef.current) === null || _commonChatRef$curren4 === void 0 ? void 0 : _commonChatRef$curren4.inputEditor) || null,
|
|
15
|
+
uploadFileList: ((_commonChatRef$curren5 = commonChatRef.current) === null || _commonChatRef$curren5 === void 0 ? void 0 : _commonChatRef$curren5.uploadFileList) || []
|
|
15
16
|
};
|
|
16
17
|
});
|
|
17
18
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
@@ -77,7 +77,7 @@ var useChatHistory = function useChatHistory(checkUnfinishedMessage, scrollBotto
|
|
|
77
77
|
|
|
78
78
|
// 处理加载历史后的滚动补偿
|
|
79
79
|
useLayoutEffect(function () {
|
|
80
|
-
if (historyScrollRef.current && containerRef.current) {
|
|
80
|
+
if (historyScrollRef.current && containerRef.current && !isMoreLoading) {
|
|
81
81
|
var _historyScrollRef$cur = historyScrollRef.current,
|
|
82
82
|
height = _historyScrollRef$cur.height,
|
|
83
83
|
top = _historyScrollRef$cur.top;
|
|
@@ -94,7 +94,7 @@ var useChatHistory = function useChatHistory(checkUnfinishedMessage, scrollBotto
|
|
|
94
94
|
}
|
|
95
95
|
historyScrollRef.current = null;
|
|
96
96
|
}
|
|
97
|
-
}, [messageList]);
|
|
97
|
+
}, [messageList, isMoreLoading, containerRef]);
|
|
98
98
|
|
|
99
99
|
// 处理滚动事件
|
|
100
100
|
useEffect(function () {
|
|
@@ -158,6 +158,15 @@ export var useChatStream = function useChatStream(platform) {
|
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
} else if (_dataObj.ERROR || _dataObj.moduleType === 'FAILED') {
|
|
161
|
+
var isRefresh = parseInt(_dataObj.status, 10) === 10002026;
|
|
162
|
+
if (isRefresh) {
|
|
163
|
+
Toast.error(_dataObj.message || '当前工作流正在其它设备运行中,请稍作等待后刷新页面重试');
|
|
164
|
+
setTimeout(function () {
|
|
165
|
+
window.location.reload();
|
|
166
|
+
}, 2000);
|
|
167
|
+
onErrorComplete === null || onErrorComplete === void 0 || onErrorComplete();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
161
170
|
var errorMessage = '内容过大,请精简后开启新对话';
|
|
162
171
|
Toast.error(_dataObj.ERROR === errorMessage ? errorMessage : '服务异常');
|
|
163
172
|
onErrorComplete === null || onErrorComplete === void 0 || onErrorComplete();
|