@myun/gimi-chat 0.3.6 → 0.3.7
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.
|
@@ -32,8 +32,8 @@ var tabList = [{
|
|
|
32
32
|
}
|
|
33
33
|
// { key: 'course', displayName: '课程' },
|
|
34
34
|
];
|
|
35
|
-
var quotoIcon = 'https://simg01.gaodunwangxiao.com/
|
|
36
|
-
var isActiveQuotoIcon = 'https://simg01.gaodunwangxiao.com/
|
|
35
|
+
var quotoIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/30/be6d9_20260130135139.png';
|
|
36
|
+
var isActiveQuotoIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/30/8e64c_20260130135037.png';
|
|
37
37
|
var QuotedContent = function QuotedContent() {
|
|
38
38
|
var _useState = useState('video'),
|
|
39
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { store } from "../../store";
|
|
4
4
|
import { useAppDispatch, useAppSelector } from "../../store/hooks";
|
|
5
|
-
import { setBaseUrl, setToken, setPlatform, setConversationId, setAgentDetail, setBussinessParams } from "../../store/slices/gimiMenuSlice";
|
|
5
|
+
import { setBaseUrl, setToken, setPlatform, setConversationId, setAgentDetail, setBussinessParams, setQuoteTeachModelList } from "../../store/slices/gimiMenuSlice";
|
|
6
6
|
import useCommonChatAPI from "../../hooks/useCommonChatAPI";
|
|
7
7
|
import { replaceBraces } from "../../utils/tools";
|
|
8
8
|
import styles from "./index.module.css";
|
|
@@ -130,6 +130,14 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
130
130
|
React.useEffect(function () {
|
|
131
131
|
dispatch(setBussinessParams(bussinessParams || {}));
|
|
132
132
|
}, [bussinessParams, dispatch]);
|
|
133
|
+
React.useEffect(function () {
|
|
134
|
+
var _props$initQuoteSourc;
|
|
135
|
+
if ((_props$initQuoteSourc = props.initQuoteSource) !== null && _props$initQuoteSourc !== void 0 && _props$initQuoteSourc.teachModelId) {
|
|
136
|
+
dispatch(setQuoteTeachModelList({
|
|
137
|
+
quoteTeachModelList: [props.initQuoteSource]
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
}, [props.initQuoteSource, dispatch]);
|
|
133
141
|
var disableVoiceCommunication = React.useMemo(function () {
|
|
134
142
|
var lastedMessage = messageList[messageList.length - 1];
|
|
135
143
|
var content = (lastedMessage === null || lastedMessage === void 0 ? void 0 : lastedMessage.content) || '';
|
|
@@ -158,7 +158,8 @@ export var useChatStream = function useChatStream(platform) {
|
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
} else if (_dataObj.ERROR || _dataObj.moduleType === 'FAILED') {
|
|
161
|
-
|
|
161
|
+
var errorMessage = '内容过大,请精简后开启新对话';
|
|
162
|
+
Toast.error(_dataObj.ERROR === errorMessage ? errorMessage : '服务异常');
|
|
162
163
|
onErrorComplete === null || onErrorComplete === void 0 || onErrorComplete();
|
|
163
164
|
return;
|
|
164
165
|
} else if (data.status && data.status !== 0 && !_dataObj.ERROR) {
|
|
@@ -796,39 +796,38 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
796
796
|
isSystemAuto = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : false;
|
|
797
797
|
conversationId = _args9.length > 3 ? _args9[3] : undefined;
|
|
798
798
|
value = val.trim();
|
|
799
|
-
console.log('initAttachments', initAttachments);
|
|
800
799
|
if (!(!value && !isSystemAuto)) {
|
|
801
|
-
_context9.next =
|
|
800
|
+
_context9.next = 6;
|
|
802
801
|
break;
|
|
803
802
|
}
|
|
804
803
|
return _context9.abrupt("return");
|
|
805
|
-
case
|
|
804
|
+
case 6:
|
|
806
805
|
if (navigator.onLine) {
|
|
807
|
-
_context9.next =
|
|
806
|
+
_context9.next = 9;
|
|
808
807
|
break;
|
|
809
808
|
}
|
|
810
809
|
Toast.error('无法连接到网络');
|
|
811
810
|
return _context9.abrupt("return");
|
|
812
|
-
case
|
|
813
|
-
if (!(status === 2 ||
|
|
814
|
-
_context9.next =
|
|
811
|
+
case 9:
|
|
812
|
+
if (!(status === 2 || msgLoading)) {
|
|
813
|
+
_context9.next = 12;
|
|
815
814
|
break;
|
|
816
815
|
}
|
|
817
816
|
Toast.error('AI正在输出中,请稍后');
|
|
818
817
|
return _context9.abrupt("return");
|
|
819
|
-
case
|
|
818
|
+
case 12:
|
|
820
819
|
chatInputConfig === null || chatInputConfig === void 0 || (_chatInputConfig$onBe = chatInputConfig.onBeforeSend) === null || _chatInputConfig$onBe === void 0 || _chatInputConfig$onBe.call(chatInputConfig, value);
|
|
821
820
|
|
|
822
821
|
// 设置inputModel
|
|
823
822
|
fillInputModel(value, messageListRef.current);
|
|
824
823
|
fileValidationMsg = fileValidation(fileListRef.current);
|
|
825
824
|
if (!fileValidationMsg) {
|
|
826
|
-
_context9.next =
|
|
825
|
+
_context9.next = 18;
|
|
827
826
|
break;
|
|
828
827
|
}
|
|
829
828
|
Toast.error(fileValidationMsg);
|
|
830
829
|
return _context9.abrupt("return");
|
|
831
|
-
case
|
|
830
|
+
case 18:
|
|
832
831
|
if (isPlaying) {
|
|
833
832
|
// 点击发送按钮时,先停止播放
|
|
834
833
|
stopTTSByText === null || stopTTSByText === void 0 || stopTTSByText();
|
|
@@ -860,7 +859,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
860
859
|
// 系统自动上传,直接开始会话,不更新列表
|
|
861
860
|
startChat([].concat(_toConsumableArray(prevChatList), [userChat]), isSystemAuto, conversationId);
|
|
862
861
|
}
|
|
863
|
-
case
|
|
862
|
+
case 25:
|
|
864
863
|
case "end":
|
|
865
864
|
return _context9.stop();
|
|
866
865
|
}
|
package/dist/types/chat.d.ts
CHANGED
|
@@ -115,6 +115,12 @@ export interface CommonChatProps {
|
|
|
115
115
|
showHeader?: boolean;
|
|
116
116
|
initSendValue?: string;
|
|
117
117
|
initAttachments?: FileItem[];
|
|
118
|
+
initQuoteSource?: {
|
|
119
|
+
teachModelId: number;
|
|
120
|
+
teachModelName: string;
|
|
121
|
+
type?: string;
|
|
122
|
+
duration: number;
|
|
123
|
+
};
|
|
118
124
|
chatInputConfig?: IAIInputProps;
|
|
119
125
|
platform?: 'myun' | 'preview' | 'damai';
|
|
120
126
|
businessType: 'correction' | 'chat';
|