@myun/gimi-chat 0.2.9 → 0.3.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.
|
@@ -227,9 +227,15 @@ var FileUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
227
227
|
customRequest: customRequest,
|
|
228
228
|
action: "",
|
|
229
229
|
limit: limit,
|
|
230
|
+
onExceed: function onExceed() {
|
|
231
|
+
Toast.warning("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(limit, "\u4E2A\u6587\u4EF6"));
|
|
232
|
+
},
|
|
230
233
|
multiple: limit > 1,
|
|
231
234
|
accept: (accept === null || accept === void 0 ? void 0 : accept.join(',')) || DEFAULT_ACCEPT,
|
|
232
235
|
maxSize: maxSize * 1024,
|
|
236
|
+
onSizeError: function onSizeError() {
|
|
237
|
+
Toast.warning('文件大小超出限制');
|
|
238
|
+
},
|
|
233
239
|
disabled: disabled,
|
|
234
240
|
showUploadList: false,
|
|
235
241
|
fileList: transformFileItem(fileList || [])
|
|
@@ -17,9 +17,7 @@ import FileCardSideBar from "../file-card/fileCardSidebar";
|
|
|
17
17
|
import OfficeFilePreviewPanel from "../file-preview";
|
|
18
18
|
import AiLoading from "../ai-loading";
|
|
19
19
|
var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
20
|
-
var _props$
|
|
21
|
-
businessType = _props$businessType === void 0 ? 'chat' : _props$businessType,
|
|
22
|
-
_props$showInput = props.showInput,
|
|
20
|
+
var _props$showInput = props.showInput,
|
|
23
21
|
showInput = _props$showInput === void 0 ? true : _props$showInput,
|
|
24
22
|
baseUrl = props.baseUrl,
|
|
25
23
|
token = props.token,
|
|
@@ -54,12 +52,6 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
54
52
|
var agentObj = useAppSelector(function (state) {
|
|
55
53
|
return state.gimiMenu.agentObj;
|
|
56
54
|
});
|
|
57
|
-
var storedBaseUrl = useAppSelector(function (state) {
|
|
58
|
-
return state.gimiMenu.baseUrl;
|
|
59
|
-
});
|
|
60
|
-
var storedToken = useAppSelector(function (state) {
|
|
61
|
-
return state.gimiMenu.token;
|
|
62
|
-
});
|
|
63
55
|
var chatUI = useChatUI();
|
|
64
56
|
var _useChatVoice = useChatVoice(),
|
|
65
57
|
isRecording = _useChatVoice.isRecording,
|
|
@@ -70,7 +62,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
70
62
|
playTTSByText = _useChatVoice.playTTSByText,
|
|
71
63
|
stopTTSByText = _useChatVoice.stopTTSByText,
|
|
72
64
|
isPlaying = _useChatVoice.isPlaying;
|
|
73
|
-
var _useCommonChatAPI = useCommonChatAPI(containerRef, platform, stopTTSByText, isPlaying, agentId, props
|
|
65
|
+
var _useCommonChatAPI = useCommonChatAPI(containerRef, platform, stopTTSByText, isPlaying, agentId, props.reloadAgentKey, props.resetKey, props.interruptKey, props.chatInputConfig, props.initSendValue),
|
|
74
66
|
headerValue = _useCommonChatAPI.headerValue,
|
|
75
67
|
msgLoading = _useCommonChatAPI.msgLoading,
|
|
76
68
|
onSucessExcel = _useCommonChatAPI.onSucessExcel,
|
|
@@ -87,8 +79,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
87
79
|
scrollBottomForce = _useCommonChatAPI.scrollBottomForce,
|
|
88
80
|
showBackBottom = _useCommonChatAPI.showBackBottom,
|
|
89
81
|
isScrolling = _useCommonChatAPI.isScrolling,
|
|
90
|
-
regenerate = _useCommonChatAPI.regenerate
|
|
91
|
-
startAICorrection = _useCommonChatAPI.startAICorrection;
|
|
82
|
+
regenerate = _useCommonChatAPI.regenerate;
|
|
92
83
|
React.useImperativeHandle(ref, function () {
|
|
93
84
|
return {
|
|
94
85
|
messageList: messageList,
|
|
@@ -124,11 +115,6 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
124
115
|
React.useEffect(function () {
|
|
125
116
|
dispatch(setBussinessParams(bussinessParams || {}));
|
|
126
117
|
}, [bussinessParams]);
|
|
127
|
-
React.useEffect(function () {
|
|
128
|
-
if (bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.QUESTION_ID && bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.ANSWER_ID && businessType === 'correction' && storedBaseUrl && storedToken) {
|
|
129
|
-
startAICorrection(bussinessParams.ANSWER_ID, bussinessParams.QUESTION_ID);
|
|
130
|
-
}
|
|
131
|
-
}, [bussinessParams, storedBaseUrl, storedToken, businessType]);
|
|
132
118
|
var disableVoiceCommunication = React.useMemo(function () {
|
|
133
119
|
var lastedMessage = messageList[messageList.length - 1];
|
|
134
120
|
var content = (lastedMessage === null || lastedMessage === void 0 ? void 0 : lastedMessage.content) || '';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IAIInputProps } from "../types/chat";
|
|
3
|
-
declare const useCommonChatAPI: (containerRef: React.RefObject<HTMLDivElement>, platform: string, stopTTSByText?: () => void, isPlaying?: boolean, agentId?: number, reloadAgentKey?: string, resetKey?: string, interruptKey?: string, chatInputConfig?: IAIInputProps) => {
|
|
3
|
+
declare const useCommonChatAPI: (containerRef: React.RefObject<HTMLDivElement>, platform: string, stopTTSByText?: () => void, isPlaying?: boolean, agentId?: number, reloadAgentKey?: string, resetKey?: string, interruptKey?: string, chatInputConfig?: IAIInputProps, initSendValue?: string) => {
|
|
4
4
|
headerValue: string;
|
|
5
5
|
getHeaderValue: (conversationId: number) => Promise<void>;
|
|
6
6
|
msgLoading: boolean;
|
|
@@ -32,7 +32,7 @@ import { useChatRecommend } from "./useChatRecommend";
|
|
|
32
32
|
import { set, cloneDeep } from 'lodash';
|
|
33
33
|
import { FileStatus } from "../interfaces/fileInterface";
|
|
34
34
|
import useChatHistory from "./useChatHistory";
|
|
35
|
-
var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTSByText, isPlaying, agentId, reloadAgentKey, resetKey, interruptKey, chatInputConfig) {
|
|
35
|
+
var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTSByText, isPlaying, agentId, reloadAgentKey, resetKey, interruptKey, chatInputConfig, initSendValue) {
|
|
36
36
|
var _useApi = useApi(),
|
|
37
37
|
getMessageTitle = _useApi.getMessageTitle,
|
|
38
38
|
stopStreamOut = _useApi.stopStreamOut,
|
|
@@ -819,12 +819,18 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
|
|
|
819
819
|
React.useEffect(function () {
|
|
820
820
|
if (conversationId && conversationIdRef.current !== conversationId) {
|
|
821
821
|
conversationIdRef.current = conversationId;
|
|
822
|
-
|
|
822
|
+
// 如果有初始化发送值,不自动加载历史消息,而是直接发送初始化发送值
|
|
823
|
+
if (autoLoadConversation && !initSendValue) {
|
|
823
824
|
getHeaderValue(conversationId);
|
|
824
825
|
getContentMessageList();
|
|
825
826
|
}
|
|
827
|
+
if (initSendValue) {
|
|
828
|
+
getHeaderValue(conversationId);
|
|
829
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
830
|
+
handleSend(initSendValue);
|
|
831
|
+
}
|
|
826
832
|
}
|
|
827
|
-
}, [conversationId, autoLoadConversation]);
|
|
833
|
+
}, [conversationId, autoLoadConversation, initSendValue]);
|
|
828
834
|
React.useEffect(function () {
|
|
829
835
|
var idAtEffectTime = conversationId;
|
|
830
836
|
return function () {
|
package/dist/types/chat.d.ts
CHANGED