bhd-components 0.7.3 → 0.7.5
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/README.md +1 -1
- package/dist/{0650d749.esm.es5.development.js → 40717e9e.esm.es5.development.js} +9435 -1276
- package/dist/6b2db3d5.esm.es5.production.js +485 -0
- package/dist/index.esm.es5.development.css +11898 -896
- package/dist/index.esm.es5.development.js +1832 -651
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.esm.es5.development.css +2 -1
- package/dist/vendor.esm.es5.production.esm.es5.production.css +1 -1
- package/es2017/customerService/contactsList.js +2 -2
- package/es2017/customerService/function.d.ts +6 -1
- package/es2017/customerService/function.js +64 -15
- package/es2017/customerService/index.d.ts +3 -0
- package/es2017/customerService/index.js +589 -252
- package/es2017/customerService/index.module.less +596 -109
- package/es2017/customerService/index2.module.less +586 -109
- package/es2017/customerService/screenshotTool.d.ts +9 -0
- package/es2017/customerService/screenshotTool.js +127 -0
- package/es2017/icons/components/custom-knowledge_content.d.ts +4 -0
- package/es2017/icons/components/custom-knowledge_content.js +24 -0
- package/es2017/icons/components/custom-screenshot.d.ts +4 -0
- package/es2017/icons/components/custom-screenshot.js +25 -0
- package/es2017/icons/components/custom-video-abstraction.d.ts +4 -0
- package/es2017/icons/components/custom-video-abstraction.js +22 -0
- package/es2017/icons/components/custom-wenhao_round.d.ts +4 -0
- package/es2017/icons/components/custom-wenhao_round.js +22 -0
- package/es2017/icons/components/index.d.ts +4 -0
- package/es2017/icons/components/index.js +4 -0
- package/esm/customerService/contactsList.js +6 -2
- package/esm/customerService/function.d.ts +6 -1
- package/esm/customerService/function.js +65 -15
- package/esm/customerService/index.d.ts +3 -0
- package/esm/customerService/index.js +594 -283
- package/esm/customerService/index.module.less +596 -109
- package/esm/customerService/index2.module.less +586 -109
- package/esm/customerService/screenshotTool.d.ts +9 -0
- package/esm/customerService/screenshotTool.js +128 -0
- package/esm/icons/components/custom-knowledge_content.d.ts +4 -0
- package/esm/icons/components/custom-knowledge_content.js +26 -0
- package/esm/icons/components/custom-screenshot.d.ts +4 -0
- package/esm/icons/components/custom-screenshot.js +27 -0
- package/esm/icons/components/custom-video-abstraction.d.ts +4 -0
- package/esm/icons/components/custom-video-abstraction.js +24 -0
- package/esm/icons/components/custom-wenhao_round.d.ts +4 -0
- package/esm/icons/components/custom-wenhao_round.js +24 -0
- package/esm/icons/components/index.d.ts +4 -0
- package/esm/icons/components/index.js +4 -0
- package/package.json +3 -1
- package/dist/24d37cb8.esm.es5.production.js +0 -468
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
4
5
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
|
|
5
6
|
import React, { useEffect, useState, useRef } from "react";
|
|
6
7
|
import { Modal, Drawer, Input, Tooltip } from "antd";
|
|
8
|
+
import { ViewImage } from "bhd-components";
|
|
9
|
+
import html2canvas from "html2canvas";
|
|
7
10
|
import cssStyle from "./index.module.less";
|
|
8
11
|
import cssStyleOnline from "./index2.module.less";
|
|
9
12
|
var styles = cssStyle;
|
|
10
13
|
if (false) {
|
|
11
14
|
styles = cssStyleOnline;
|
|
12
15
|
}
|
|
13
|
-
import { CustomAiIcon, CustomRecord, CustomFullScreen, CustomExitFullScreen, CustomReloading, CustomCopy, CustomLike, CustomDislike, CustomQuote, CustomSending, CustomContacts, CustomDuihao,
|
|
14
|
-
import { CloseOutlined, RightOutlined } from "@ant-design/icons";
|
|
16
|
+
import { CustomAiIcon, CustomRecord, CustomFullScreen, CustomExitFullScreen, CustomReloading, CustomCopy, CustomLike, CustomDislike, CustomQuote, CustomSending, CustomContacts, CustomDuihao, CustomRoundClose, CustomScreenshot, CustomKnowledgeContent, CustomWenhaoRound } from "../icons/index";
|
|
17
|
+
import { CloseOutlined, RightOutlined, ZoomInOutlined } from "@ant-design/icons";
|
|
15
18
|
import HistoryFun from "./historyFun";
|
|
16
19
|
import ContactsList from "./contactsList";
|
|
20
|
+
import ScreenshotTool from "./screenshotTool";
|
|
17
21
|
import { parseDate } from "../utils/Date";
|
|
18
22
|
import { Remarkable } from "remarkable";
|
|
19
23
|
import hljs from "highlight.js";
|
|
@@ -22,42 +26,47 @@ import { render } from "react-dom";
|
|
|
22
26
|
import Provider from "../provider";
|
|
23
27
|
var TextArea = Input.TextArea;
|
|
24
28
|
import knowledge_icon from "./images/knowledge_icon.png";
|
|
25
|
-
import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
26
|
-
import { readMessage, getByteLen, serverUrl, copyText, getDataTime } from "./function"; //一些方法
|
|
29
|
+
// import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
30
|
+
import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
|
|
27
31
|
var CustomerService = function(props) {
|
|
28
|
-
var userData = props.userData, http = props.http, urllocation = props.urllocation, onCancel = props.onCancel, serverName = props.serverName, fetchEventSource = props.fetchEventSource, initShowType = props.initShowType, onEvent = props.onEvent, stepIds = props.stepIds, stepId = props.stepId;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
32
|
+
var userData = props.userData, http = props.http, urllocation = props.urllocation, onCancel = props.onCancel, serverName = props.serverName, fetchEventSource = props.fetchEventSource, initShowType = props.initShowType, onEvent = props.onEvent, stepIds = props.stepIds, stepId = props.stepId, config = props.config;
|
|
33
|
+
// const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
|
|
34
|
+
// const [voiceRecordingStatus, setVoiceRecordingStatus] = useState(3); //语音录制状态 3,语音识别完成 2,录制中, 1,录制结束
|
|
35
|
+
var _useState = _sliced_to_array(useState([]), 2), copyTextOBJ = _useState[0], setCopyTextObj = _useState[1]; //复制的消息id
|
|
36
|
+
var _useState1 = _sliced_to_array(useState({}), 2), citationContent = _useState1[0], setCitationContent = _useState1[1]; //引用内容
|
|
37
|
+
var _useState2 = _sliced_to_array(useState(""), 2), roomId = _useState2[0], setRoomId = _useState2[1]; //聊天室id
|
|
38
|
+
var _useState3 = _sliced_to_array(useState([]), 2), historyMessageList = _useState3[0], setHistoryMessageList = _useState3[1]; //历史消息
|
|
39
|
+
var _useState4 = _sliced_to_array(useState(""), 2), keyWord = _useState4[0], setKeyWord = _useState4[1]; //搜索内容
|
|
40
|
+
var _useState5 = _sliced_to_array(useState([]), 2), questionsList = _useState5[0], setQuestionsList = _useState5[1]; //问题列表
|
|
41
|
+
var _useState6 = _sliced_to_array(useState([]), 2), hotQuestionsList = _useState6[0], setHotQuestionsList = _useState6[1]; //热门问题
|
|
42
|
+
var _useState7 = _sliced_to_array(useState(false), 2), greetingMessage = _useState7[0], setGreetingMessage = _useState7[1]; //聊天记录列表是否请求完成
|
|
43
|
+
var _useState8 = _sliced_to_array(useState(1), 2), pageNum = _useState8[0], setPageNum = _useState8[1]; //页码
|
|
44
|
+
var _useState9 = _sliced_to_array(useState(0), 2), pageNumHistory = _useState9[0], setPageNumHistory = _useState9[1]; //用于搜索历史记录后的页码
|
|
45
|
+
var _useState10 = _sliced_to_array(useState(0), 2), pageCount = _useState10[0], setPageCount = _useState10[1]; //总页数
|
|
46
|
+
var _useState11 = _sliced_to_array(useState(false), 2), loading = _useState11[0], setLoading = _useState11[1]; //上拉显示加载图标
|
|
47
|
+
var _useState12 = _sliced_to_array(useState(false), 2), bottomLoading = _useState12[0], setBottomLoading = _useState12[1]; //下拉显示加载图标
|
|
48
|
+
var _useState13 = _sliced_to_array(useState(true), 2), finished = _useState13[0], setFinished = _useState13[1]; //是否结束生成
|
|
49
|
+
var _useState14 = _sliced_to_array(useState(""), 2), lastId = _useState14[0], setLastId = _useState14[1]; //最后一条数据的id,可用于定位当前位置
|
|
50
|
+
var _useState15 = _sliced_to_array(useState({}), 2), chatWith = _useState15[0], setChatWith = _useState15[1]; //聊天的老师id或ai
|
|
51
|
+
var _useState16 = _sliced_to_array(useState(false), 2), firstLoad = _useState16[0], setFirstLoad = _useState16[1]; //第一次切换全屏时滚动到页面底部
|
|
52
|
+
var _useState17 = _sliced_to_array(useState(45), 2), buttomHei = _useState17[0], setButtomHei = _useState17[1]; //底部输入框的高度
|
|
53
|
+
var _useState18 = _sliced_to_array(useState(false), 2), showHistory = _useState18[0], setShowHistory = _useState18[1]; //是否显示历史记录
|
|
54
|
+
var _useState19 = _sliced_to_array(useState(false), 2), showContacts = _useState19[0], setShowContacts = _useState19[1]; //是否显示老师列表
|
|
55
|
+
var _useState20 = _sliced_to_array(useState(-1), 2), showType = _useState20[0], setShowType = _useState20[1]; //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
|
|
56
|
+
var _useState21 = _sliced_to_array(useState(-1), 2), answerMode = _useState21[0], setAnswerMode = _useState21[1]; //设置回答模式。1,召唤老师回答
|
|
57
|
+
var _useState22 = _sliced_to_array(useState([]), 2), teacherList = _useState22[0], setTeacherList = _useState22[1]; //老师列表
|
|
58
|
+
var _useState23 = _sliced_to_array(useState({}), 2), problem = _useState23[0], setProblem = _useState23[1]; //召唤老师回答的问题
|
|
59
|
+
var _useState24 = _sliced_to_array(useState([]), 2), contactsList = _useState24[0], setContactsList = _useState24[1]; //老师列表
|
|
60
|
+
var _useState25 = _sliced_to_array(useState([]), 2), chatObj = _useState25[0], setChatObj = _useState25[1]; //聊天记录id保存,用来在实验报告中记录
|
|
61
|
+
var _useState26 = _sliced_to_array(useState(""), 2), keyWordProblem = _useState26[0], setKeyWordProblem = _useState26[1]; //历史记录搜索的内容
|
|
62
|
+
var _useState27 = _sliced_to_array(useState(""), 2), imgBese64 = _useState27[0], setImgBese64 = _useState27[1]; //屏幕截图
|
|
63
|
+
var _useState28 = _sliced_to_array(useState(""), 2), screenshotBese64 = _useState28[0], setScreenshotBese64 = _useState28[1]; //bese64图片
|
|
64
|
+
var _useState29 = _sliced_to_array(useState(""), 2), viewBase64 = _useState29[0], setViewBase64 = _useState29[1]; //图片预览
|
|
65
|
+
var _useState30 = _sliced_to_array(useState(false), 2), visible = _useState30[0], setVisible = _useState30[1]; //是否显示图片预览
|
|
66
|
+
var _useState31 = _sliced_to_array(useState([]), 2), bottomRecommendationQuestions = _useState31[0], setBottomRecommendationQuestions = _useState31[1]; //底部推荐问题
|
|
58
67
|
var timer = useRef(null); //文本框输入时
|
|
59
68
|
var receiveMessageTimer = useRef(null); //接收ai发回的消息
|
|
60
|
-
|
|
69
|
+
// let voiceCountdownTimer = useRef(null); //语音录制倒计时
|
|
61
70
|
var listTimer = useRef(null); // 请求列表倒计时
|
|
62
71
|
var roomMessage = useRef(null); //循环当前页面的新消息
|
|
63
72
|
var chatRoomList = useRef(null); //获取聊天室列表
|
|
@@ -65,6 +74,7 @@ var CustomerService = function(props) {
|
|
|
65
74
|
var childRef = useRef(null); //获取子组件方法
|
|
66
75
|
var scrollTopHei = useRef(0);
|
|
67
76
|
var isPosition = useRef(true);
|
|
77
|
+
var recommendeQuestionID = useRef([]); //推荐问题id
|
|
68
78
|
var mid = props.userData.mid;
|
|
69
79
|
var remarkable = new Remarkable({
|
|
70
80
|
highlight: function highlight(str, lang) {
|
|
@@ -79,16 +89,6 @@ var CustomerService = function(props) {
|
|
|
79
89
|
return ""; // use external default escaping
|
|
80
90
|
}
|
|
81
91
|
});
|
|
82
|
-
useEffect(function() {
|
|
83
|
-
return function() {
|
|
84
|
-
clearTimeout(receiveMessageTimer.current);
|
|
85
|
-
clearTimeout(voiceCountdownTimer.current);
|
|
86
|
-
clearTimeout(listTimer.current);
|
|
87
|
-
clearTimeout(timer.current);
|
|
88
|
-
clearTimeout(roomMessage.current);
|
|
89
|
-
clearTimeout(chatRoomList.current);
|
|
90
|
-
};
|
|
91
|
-
}, []);
|
|
92
92
|
useEffect(function() {
|
|
93
93
|
var handleScroll = function handleScroll() {
|
|
94
94
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
@@ -136,11 +136,27 @@ var CustomerService = function(props) {
|
|
|
136
136
|
}
|
|
137
137
|
scrollTopHei.current = scrollTop;
|
|
138
138
|
};
|
|
139
|
+
console.log(showType, "showTypeshowTypeshowType");
|
|
140
|
+
if (showType == 5) {
|
|
141
|
+
//document.querySelector("#__docusaurus")
|
|
142
|
+
setTimeout(function() {
|
|
143
|
+
html2canvas(document.getElementsByTagName("body")[0], {
|
|
144
|
+
allowTaint: true,
|
|
145
|
+
useCORS: true,
|
|
146
|
+
scale: 1 // 图片比例
|
|
147
|
+
}).then(function(canvas) {
|
|
148
|
+
document.body.appendChild(canvas);
|
|
149
|
+
var base64URL = canvas.toDataURL("image/jpeg");
|
|
150
|
+
var image = new Image();
|
|
151
|
+
image.src = base64URL; // 将'your_image_url'替换为你自己的图片URL
|
|
152
|
+
console.log(base64URL);
|
|
153
|
+
setImgBese64(base64URL);
|
|
154
|
+
});
|
|
155
|
+
}, 1000);
|
|
156
|
+
}
|
|
139
157
|
if (showType != 1 && !firstLoad && pageCount > 0) {
|
|
140
158
|
setFirstLoad(true);
|
|
141
|
-
|
|
142
|
-
scrollToBottom();
|
|
143
|
-
}, 100);
|
|
159
|
+
scrollToBottom();
|
|
144
160
|
}
|
|
145
161
|
var content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
146
162
|
if (content) {
|
|
@@ -159,6 +175,7 @@ var CustomerService = function(props) {
|
|
|
159
175
|
]);
|
|
160
176
|
useEffect(function() {
|
|
161
177
|
resettingBottomHei();
|
|
178
|
+
scrollToBottom();
|
|
162
179
|
var dom = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
163
180
|
if (dom) {
|
|
164
181
|
if (showType == 1) {
|
|
@@ -175,9 +192,11 @@ var CustomerService = function(props) {
|
|
|
175
192
|
]);
|
|
176
193
|
useEffect(function() {
|
|
177
194
|
// console.log(props,'lsdkcmsdlcksd')
|
|
178
|
-
getQuestiionsList("", 1);
|
|
179
|
-
scrollToBottom();
|
|
195
|
+
// getQuestiionsList("", 1);
|
|
180
196
|
setShowType(initShowType);
|
|
197
|
+
//获取视频页面推荐问题
|
|
198
|
+
videoPageQuestiionsList();
|
|
199
|
+
scrollToBottom();
|
|
181
200
|
}, [
|
|
182
201
|
initShowType
|
|
183
202
|
]);
|
|
@@ -190,6 +209,14 @@ var CustomerService = function(props) {
|
|
|
190
209
|
getHistoryMessage(pageNum, 1);
|
|
191
210
|
}
|
|
192
211
|
}
|
|
212
|
+
//复制代码功能
|
|
213
|
+
var chat_content = document.getElementById("chat_content");
|
|
214
|
+
if (chat_content) {
|
|
215
|
+
chat_content = document.getElementById("chat_content");
|
|
216
|
+
delegate(chat_content, "click", ".".concat(styles.copyCode), function(event, target) {
|
|
217
|
+
findCopyContent(event);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
193
220
|
}, [
|
|
194
221
|
roomId
|
|
195
222
|
]);
|
|
@@ -200,6 +227,11 @@ var CustomerService = function(props) {
|
|
|
200
227
|
});
|
|
201
228
|
roomsListTimer();
|
|
202
229
|
return function() {
|
|
230
|
+
clearTimeout(receiveMessageTimer.current);
|
|
231
|
+
// clearTimeout(voiceCountdownTimer.current);
|
|
232
|
+
clearTimeout(listTimer.current);
|
|
233
|
+
clearTimeout(timer.current);
|
|
234
|
+
clearTimeout(roomMessage.current);
|
|
203
235
|
clearTimeout(chatRoomList.current);
|
|
204
236
|
};
|
|
205
237
|
}, []);
|
|
@@ -215,63 +247,81 @@ var CustomerService = function(props) {
|
|
|
215
247
|
if (count > 0) {
|
|
216
248
|
setShowContacts(true);
|
|
217
249
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
} else {
|
|
223
|
-
try {
|
|
224
|
-
if (historyMessageList[historyMessageList.length - 1].extraInfo == null) {
|
|
225
|
-
sendGreetingMessage(1);
|
|
226
|
-
} else if (JSON.parse(historyMessageList[historyMessageList.length - 1].extraInfo).length > 0 && (JSON.parse(historyMessageList[historyMessageList.length - 1].extraInfo)[0].key == "questionId" || JSON.parse(historyMessageList[historyMessageList.length - 1].extraInfo)[0].value == "knowledgebase")) {
|
|
227
|
-
// console.log(
|
|
228
|
-
// JSON.parse(
|
|
229
|
-
// historyMessageList[historyMessageList.length - 1].extraInfo,
|
|
230
|
-
// "sdklsdksd"
|
|
231
|
-
// )
|
|
232
|
-
// );
|
|
233
|
-
sendGreetingMessage(1);
|
|
234
|
-
}
|
|
235
|
-
} catch (error) {}
|
|
236
|
-
}
|
|
250
|
+
//发送打招呼信息
|
|
251
|
+
if (!(roomList.length > 0 && roomList[0].roomId != roomId && greetingMessage)) {
|
|
252
|
+
sendGreetingMessage(1);
|
|
253
|
+
scrollToBottom();
|
|
237
254
|
}
|
|
238
|
-
scrollToBottom();
|
|
239
255
|
}, [
|
|
240
256
|
greetingMessage,
|
|
241
257
|
hotQuestionsList
|
|
242
258
|
]);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
259
|
+
//查找需要复制的代码
|
|
260
|
+
var findCopyContent = function(e) {
|
|
261
|
+
var source = findParent(e.target, styles.copyCode);
|
|
262
|
+
if (!source) return;
|
|
263
|
+
var id = source.getAttribute("data-id");
|
|
264
|
+
var position = source.getAttribute("data-position");
|
|
265
|
+
if (!id && !position) return;
|
|
266
|
+
var message = "";
|
|
267
|
+
setHistoryMessageList(function(list) {
|
|
268
|
+
var _list_filter_;
|
|
269
|
+
message = (_list_filter_ = list.filter(function(e) {
|
|
270
|
+
return e.id == id;
|
|
271
|
+
})[0]) === null || _list_filter_ === void 0 ? void 0 : _list_filter_.message;
|
|
272
|
+
return list;
|
|
273
|
+
});
|
|
274
|
+
if (!message) return;
|
|
275
|
+
var codeConment = "";
|
|
276
|
+
var i = 0;
|
|
277
|
+
message.replaceAll(new RegExp(/```(?:.|\n)*?```/, "ig"), function(con) {
|
|
278
|
+
i++;
|
|
279
|
+
if (i == position) {
|
|
280
|
+
codeConment = con;
|
|
281
|
+
return con;
|
|
282
|
+
} else {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
resetStyles();
|
|
287
|
+
source.classList.add("copy_success");
|
|
288
|
+
source.children[2].innerText = "复制成功";
|
|
289
|
+
copyText(codeConment);
|
|
290
|
+
setTimeout(function() {
|
|
291
|
+
try {
|
|
292
|
+
resetStyles();
|
|
293
|
+
} catch (error) {}
|
|
294
|
+
}, 3000);
|
|
295
|
+
};
|
|
252
296
|
//AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
|
|
253
297
|
var sendGreetingMessage = function(type) {
|
|
254
298
|
var questionsList = [];
|
|
255
299
|
var obj = {};
|
|
256
300
|
if (type == 1) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
301
|
+
var questionsId = [];
|
|
302
|
+
questionsList = hotQuestionsList.map(function(item, index) {
|
|
303
|
+
if (index < 3) {
|
|
304
|
+
questionsId.push(item.id);
|
|
305
|
+
return {
|
|
306
|
+
key: "messageSource",
|
|
307
|
+
value: item.id,
|
|
308
|
+
question: item.question,
|
|
309
|
+
answer: item.answer
|
|
310
|
+
};
|
|
311
|
+
} else {
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
recommendeQuestionID.current = questionsId; //保存推荐问题id
|
|
316
|
+
questionsList = questionsList.filter(function(i) {
|
|
317
|
+
return i != null;
|
|
318
|
+
});
|
|
270
319
|
obj = {
|
|
271
320
|
roomId: roomId,
|
|
272
321
|
sender: "AI",
|
|
273
322
|
recevier: mid,
|
|
274
|
-
message: "Hi,我是智能学习助手,你遇到了什么问题?"
|
|
323
|
+
message: "Hi,我是智能学习助手,你遇到了什么问题?",
|
|
324
|
+
extraInfos: questionsList
|
|
275
325
|
};
|
|
276
326
|
if (pageNumHistory <= 1) {
|
|
277
327
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -281,19 +331,11 @@ var CustomerService = function(props) {
|
|
|
281
331
|
downvoted: false,
|
|
282
332
|
quotedMessage: "",
|
|
283
333
|
createdAt: getDataTime(-1),
|
|
284
|
-
|
|
285
|
-
extraInfo: JSON.stringify([
|
|
286
|
-
{
|
|
287
|
-
key: "messageSource",
|
|
288
|
-
value: "knowledgebase"
|
|
289
|
-
}
|
|
290
|
-
])
|
|
334
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
291
335
|
}));
|
|
292
336
|
return newHistoryMessageList;
|
|
293
337
|
});
|
|
294
|
-
|
|
295
|
-
scrollToBottom();
|
|
296
|
-
}, 100);
|
|
338
|
+
scrollToBottom();
|
|
297
339
|
}
|
|
298
340
|
return;
|
|
299
341
|
} else if (type == 2) {
|
|
@@ -382,9 +424,7 @@ var CustomerService = function(props) {
|
|
|
382
424
|
}));
|
|
383
425
|
return newHistoryMessageList;
|
|
384
426
|
});
|
|
385
|
-
|
|
386
|
-
scrollToBottom();
|
|
387
|
-
}, 100);
|
|
427
|
+
scrollToBottom();
|
|
388
428
|
}
|
|
389
429
|
return;
|
|
390
430
|
}
|
|
@@ -457,12 +497,7 @@ var CustomerService = function(props) {
|
|
|
457
497
|
return newHistoryMessageList;
|
|
458
498
|
});
|
|
459
499
|
// console.log(lastId,'消息发送给老师111');
|
|
460
|
-
|
|
461
|
-
setTimeout(function() {
|
|
462
|
-
console.log("滚动到底部");
|
|
463
|
-
scrollToBottom();
|
|
464
|
-
}, 100);
|
|
465
|
-
// }
|
|
500
|
+
scrollToBottom();
|
|
466
501
|
}
|
|
467
502
|
//判断当前窗口是否是
|
|
468
503
|
if (type == 1) {
|
|
@@ -484,8 +519,9 @@ var CustomerService = function(props) {
|
|
|
484
519
|
console.log(err);
|
|
485
520
|
});
|
|
486
521
|
};
|
|
487
|
-
//发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2
|
|
522
|
+
//发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2 是普通消息,flag == 3 是针对视频页面点击底部推荐问题
|
|
488
523
|
var sendMessage = function(item, flag) {
|
|
524
|
+
console.log(item, flag, 888888888);
|
|
489
525
|
var questions = [];
|
|
490
526
|
if (item && flag) {
|
|
491
527
|
questions = [
|
|
@@ -520,6 +556,27 @@ var CustomerService = function(props) {
|
|
|
520
556
|
} else if (userData.modules.some(function(item) {
|
|
521
557
|
return item.short == "AIservice";
|
|
522
558
|
})) {
|
|
559
|
+
var sendData = {
|
|
560
|
+
//相关数据
|
|
561
|
+
roomId: roomId,
|
|
562
|
+
message: keyWord,
|
|
563
|
+
quotedMessage: citationContent.content || "",
|
|
564
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
565
|
+
generateUpvoteOrDownvoteMessage: false
|
|
566
|
+
};
|
|
567
|
+
var imageUrl = "";
|
|
568
|
+
// if(citationContent.imageUrl){
|
|
569
|
+
// sendData.image = citationContent.imageUrl;
|
|
570
|
+
// imageUrl = citationContent.imageUrl;
|
|
571
|
+
// getBase64Image(citationContent.imageUrl).then((res)=>{
|
|
572
|
+
// console.log(res,33333);
|
|
573
|
+
// });
|
|
574
|
+
// console.log(imageUrl,'转换的bese64');
|
|
575
|
+
// }
|
|
576
|
+
if (screenshotBese64) {
|
|
577
|
+
sendData.image = screenshotBese64;
|
|
578
|
+
imageUrl = screenshotBese64;
|
|
579
|
+
}
|
|
523
580
|
if (pageNumHistory <= 1) {
|
|
524
581
|
setHistoryMessageList(function(historyMessageList) {
|
|
525
582
|
var newHistoryMessageList = historyMessageList.concat({
|
|
@@ -532,20 +589,19 @@ var CustomerService = function(props) {
|
|
|
532
589
|
upvoted: false,
|
|
533
590
|
downvoted: false,
|
|
534
591
|
createdAt: getDataTime(-1),
|
|
535
|
-
extraInfo: JSON.stringify([
|
|
592
|
+
extraInfo: imageUrl ? JSON.stringify([
|
|
593
|
+
{
|
|
594
|
+
key: "imageUrl",
|
|
595
|
+
value: imageUrl
|
|
596
|
+
}
|
|
597
|
+
]) : JSON.stringify([])
|
|
536
598
|
});
|
|
537
599
|
return newHistoryMessageList;
|
|
538
600
|
});
|
|
539
601
|
}
|
|
540
602
|
setFinished(false);
|
|
541
|
-
aiSendQuestions(3,
|
|
542
|
-
|
|
543
|
-
roomId: roomId,
|
|
544
|
-
message: keyWord,
|
|
545
|
-
quotedMessage: citationContent.content || "",
|
|
546
|
-
regenerate: citationContent.content != "" ? false : true,
|
|
547
|
-
generateUpvoteOrDownvoteMessage: false
|
|
548
|
-
}, 1);
|
|
603
|
+
aiSendQuestions(3, sendData, 1);
|
|
604
|
+
setScreenshotBese64("");
|
|
549
605
|
//存在AI客服
|
|
550
606
|
} else {
|
|
551
607
|
//不存在AI客服
|
|
@@ -567,6 +623,11 @@ var CustomerService = function(props) {
|
|
|
567
623
|
});
|
|
568
624
|
scrollToBottom();
|
|
569
625
|
}
|
|
626
|
+
console.log(type, "接受答案77777");
|
|
627
|
+
//获取下面的推荐问题
|
|
628
|
+
if (type == 2) {
|
|
629
|
+
videoPageQuestiionsList(2);
|
|
630
|
+
}
|
|
570
631
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
571
632
|
if (res.data.id) {
|
|
572
633
|
if (pageNumHistory <= 1) {
|
|
@@ -631,18 +692,6 @@ var CustomerService = function(props) {
|
|
|
631
692
|
});
|
|
632
693
|
}, 60 * 1000);
|
|
633
694
|
var data = JSON.stringify(obj);
|
|
634
|
-
// if (type == 1 || type == 2) {
|
|
635
|
-
// data = JSON.stringify(obj);
|
|
636
|
-
// } else if(type == 3){
|
|
637
|
-
// data = JSON.stringify({
|
|
638
|
-
// //相关数据
|
|
639
|
-
// roomId: roomId,
|
|
640
|
-
// message: keyWord,
|
|
641
|
-
// quotedMessage: citationContent.content || "",
|
|
642
|
-
// regenerate: citationContent.content != "" ? false : true,
|
|
643
|
-
// generateUpvoteOrDownvoteMessage: false,
|
|
644
|
-
// });
|
|
645
|
-
// }
|
|
646
695
|
setKeyWord("");
|
|
647
696
|
setQuestionsList([]);
|
|
648
697
|
setTimeout(function() {
|
|
@@ -680,9 +729,7 @@ var CustomerService = function(props) {
|
|
|
680
729
|
});
|
|
681
730
|
}
|
|
682
731
|
});
|
|
683
|
-
|
|
684
|
-
scrollToBottom();
|
|
685
|
-
}, 10);
|
|
732
|
+
scrollToBottom();
|
|
686
733
|
}
|
|
687
734
|
//使用fetchEventSource接收数据
|
|
688
735
|
var eventSource = fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
@@ -690,7 +737,8 @@ var CustomerService = function(props) {
|
|
|
690
737
|
headers: {
|
|
691
738
|
"Content-Type": "application/json",
|
|
692
739
|
Accept: "text/event-stream,application/json",
|
|
693
|
-
"X-Auth-Jwt": window.localStorage.getItem("usertoken") || "",
|
|
740
|
+
// "X-Auth-Jwt": window.localStorage.getItem("usertoken") || "",
|
|
741
|
+
"X-Auth-Jwt": sessionStorage.getItem("jwt") || "",
|
|
694
742
|
"Auth-Token": userData.token,
|
|
695
743
|
"X-Module-Id": userData.modules.find(function(ele) {
|
|
696
744
|
return ele.short == "IntelligentCustomerService";
|
|
@@ -866,11 +914,9 @@ var CustomerService = function(props) {
|
|
|
866
914
|
return newHistoryMessageList2;
|
|
867
915
|
}
|
|
868
916
|
});
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
}, 10);
|
|
917
|
+
if (isPosition.current) {
|
|
918
|
+
scrollToBottom();
|
|
919
|
+
}
|
|
874
920
|
};
|
|
875
921
|
//问题记录到实验报告中
|
|
876
922
|
var testLabQuestion = function(title, content, teachId) {
|
|
@@ -893,21 +939,6 @@ var CustomerService = function(props) {
|
|
|
893
939
|
});
|
|
894
940
|
}
|
|
895
941
|
};
|
|
896
|
-
//语音转文字
|
|
897
|
-
var speechToText = function() {
|
|
898
|
-
http.post("".concat(urllocation, "/chat-service/public/v1.0/speech:recognize"), {
|
|
899
|
-
audio: bese64String
|
|
900
|
-
}).then(function(res) {
|
|
901
|
-
setVoiceRecordingStatus(3);
|
|
902
|
-
if (res.data) {
|
|
903
|
-
setKeyWord(res.data.text);
|
|
904
|
-
resettingBottomHei();
|
|
905
|
-
}
|
|
906
|
-
}).catch(function(err) {
|
|
907
|
-
setKeyWord("");
|
|
908
|
-
setVoiceRecordingStatus(3);
|
|
909
|
-
});
|
|
910
|
-
};
|
|
911
942
|
//创建聊天室
|
|
912
943
|
var createRooms = function(uid) {
|
|
913
944
|
return http.post("".concat(urllocation, "/chat-service/public/v1.0/rooms"), {
|
|
@@ -998,6 +1029,9 @@ var CustomerService = function(props) {
|
|
|
998
1029
|
if (flag != 4) {
|
|
999
1030
|
if (pageNum == 1 && (flag == 2 || flag == 3)) {
|
|
1000
1031
|
scrollToBottom();
|
|
1032
|
+
setTimeout(function() {
|
|
1033
|
+
scrollToBottom();
|
|
1034
|
+
}, 1000);
|
|
1001
1035
|
} else {
|
|
1002
1036
|
scrollTo("li_flag");
|
|
1003
1037
|
}
|
|
@@ -1073,10 +1107,8 @@ var CustomerService = function(props) {
|
|
|
1073
1107
|
});
|
|
1074
1108
|
// console.log(dataList.length , originList,lastId,'dfkvdnfkvdfj44444');
|
|
1075
1109
|
if (!lastId && originList != newList) {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
readMessage(roomId, urllocation, userData, http);
|
|
1079
|
-
}, 100);
|
|
1110
|
+
scrollToBottom();
|
|
1111
|
+
readMessage(roomId, urllocation, userData, http);
|
|
1080
1112
|
}
|
|
1081
1113
|
}
|
|
1082
1114
|
try {
|
|
@@ -1189,7 +1221,7 @@ var CustomerService = function(props) {
|
|
|
1189
1221
|
});
|
|
1190
1222
|
});
|
|
1191
1223
|
};
|
|
1192
|
-
//获取问题列表flag ==1 是问候消息 2,搜索列表 展示相关问题
|
|
1224
|
+
//获取问题列表flag ==1 是问候消息 2,搜索列表 展示相关问题 ,3.视频页面,4.视频联想问题不够时,增加知识库联想问题
|
|
1193
1225
|
var getQuestiionsList = function(value, flag) {
|
|
1194
1226
|
var data = {};
|
|
1195
1227
|
if (flag == 1) {
|
|
@@ -1197,6 +1229,19 @@ var CustomerService = function(props) {
|
|
|
1197
1229
|
page: 1,
|
|
1198
1230
|
maxPageSize: 5
|
|
1199
1231
|
};
|
|
1232
|
+
} else if (flag == 3) {
|
|
1233
|
+
data = {
|
|
1234
|
+
page: 1,
|
|
1235
|
+
maxPageSize: 4,
|
|
1236
|
+
question: value,
|
|
1237
|
+
sectionId: getQuery("s_id") || 325569
|
|
1238
|
+
};
|
|
1239
|
+
} else if (flag == 4) {
|
|
1240
|
+
data = {
|
|
1241
|
+
page: 1,
|
|
1242
|
+
maxPageSize: 4,
|
|
1243
|
+
question: value
|
|
1244
|
+
};
|
|
1200
1245
|
} else {
|
|
1201
1246
|
data = {
|
|
1202
1247
|
page: 1,
|
|
@@ -1208,14 +1253,69 @@ var CustomerService = function(props) {
|
|
|
1208
1253
|
params: data
|
|
1209
1254
|
}).then(function(res) {
|
|
1210
1255
|
if (res.data.questions) {
|
|
1256
|
+
var questionList = res.data.questions;
|
|
1211
1257
|
if (flag == 1) {
|
|
1212
|
-
setHotQuestionsList(
|
|
1258
|
+
setHotQuestionsList(questionList);
|
|
1259
|
+
} else if (flag == 4) {
|
|
1260
|
+
setQuestionsList(function(questionList) {
|
|
1261
|
+
return _to_consumable_array(questionList).concat(_to_consumable_array(res.data.questions));
|
|
1262
|
+
});
|
|
1213
1263
|
} else {
|
|
1214
|
-
setQuestionsList(
|
|
1264
|
+
setQuestionsList(questionList);
|
|
1265
|
+
}
|
|
1266
|
+
if (questionList.length < 4 && flag == 3) {
|
|
1267
|
+
console.log("视频页面,联想问题小于4个");
|
|
1268
|
+
//视频页面,联想问题小于4个
|
|
1269
|
+
getQuestiionsList(value, 4);
|
|
1215
1270
|
}
|
|
1216
1271
|
}
|
|
1217
1272
|
});
|
|
1218
1273
|
};
|
|
1274
|
+
//获取视频页面热门问题 flag == 1,默认推荐问题 == 2,已经推荐过问题
|
|
1275
|
+
var videoPageQuestiionsList = function() {
|
|
1276
|
+
var flag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
1277
|
+
console.log(props, 3333333);
|
|
1278
|
+
var config = props.config;
|
|
1279
|
+
if (config && config.type == "video" && config.params) {
|
|
1280
|
+
console.log("请求接口2222", config);
|
|
1281
|
+
var params = config.params;
|
|
1282
|
+
var videoId = params.videoPageData.videoId;
|
|
1283
|
+
var watchTime = params.videoPageData.videoProgress;
|
|
1284
|
+
var courseId = getQuery("yc_id") || 10;
|
|
1285
|
+
var sectionId = getQuery("s_id") || 20;
|
|
1286
|
+
if (videoId && watchTime && courseId && sectionId) {
|
|
1287
|
+
console.log("请求接口2222");
|
|
1288
|
+
http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
|
|
1289
|
+
"recommendedQuestions": flag == 2 ? recommendeQuestionID.current : [
|
|
1290
|
+
""
|
|
1291
|
+
],
|
|
1292
|
+
"contexts": [
|
|
1293
|
+
{
|
|
1294
|
+
"type": "VIDEO",
|
|
1295
|
+
"courseId": courseId,
|
|
1296
|
+
"sectionId": sectionId,
|
|
1297
|
+
"videoId": videoId,
|
|
1298
|
+
"watchTime": watchTime
|
|
1299
|
+
}
|
|
1300
|
+
],
|
|
1301
|
+
"maximum": 5
|
|
1302
|
+
}).then(function(res) {
|
|
1303
|
+
console.log(res, 333333);
|
|
1304
|
+
if (res.data.total > 0) {
|
|
1305
|
+
var data = res.data.questions;
|
|
1306
|
+
if (flag == 2) {
|
|
1307
|
+
setBottomRecommendationQuestions(data);
|
|
1308
|
+
} else {
|
|
1309
|
+
setHotQuestionsList(data);
|
|
1310
|
+
}
|
|
1311
|
+
resettingBottomHei();
|
|
1312
|
+
scrollToBottom();
|
|
1313
|
+
console.log(data, 99999);
|
|
1314
|
+
}
|
|
1315
|
+
}).catch(function() {});
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1219
1319
|
//获取老师列表
|
|
1220
1320
|
var getTeacherList = function(keyWord) {
|
|
1221
1321
|
http.get("".concat(urllocation, "/chat-service/public/v1.0/teachers"), {
|
|
@@ -1315,11 +1415,14 @@ var CustomerService = function(props) {
|
|
|
1315
1415
|
};
|
|
1316
1416
|
//设置滚动条滚动到底部
|
|
1317
1417
|
var scrollToBottom = function() {
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
container
|
|
1321
|
-
|
|
1418
|
+
setTimeout(function() {
|
|
1419
|
+
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1420
|
+
if (container) {
|
|
1421
|
+
container.scrollTop = container.scrollHeight;
|
|
1422
|
+
}
|
|
1423
|
+
}, 100);
|
|
1322
1424
|
};
|
|
1425
|
+
//滚动到指定位置
|
|
1323
1426
|
var scrollTo = function(id) {
|
|
1324
1427
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1325
1428
|
var container2 = document.getElementById(id);
|
|
@@ -1328,12 +1431,6 @@ var CustomerService = function(props) {
|
|
|
1328
1431
|
try {
|
|
1329
1432
|
setTimeout(function() {
|
|
1330
1433
|
var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
|
|
1331
|
-
// let top =
|
|
1332
|
-
// showType == 1 || showType == 3
|
|
1333
|
-
// ? $("#li_flag").offset().top
|
|
1334
|
-
// : $("#chat_content_modal #li_flag").offset().top -
|
|
1335
|
-
// $("#chat_content_modal").offset().top;
|
|
1336
|
-
// console.log(top2,top,444444444444)
|
|
1337
1434
|
$("#".concat(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal")).animate({
|
|
1338
1435
|
scrollTop: top
|
|
1339
1436
|
}, 0);
|
|
@@ -1342,6 +1439,22 @@ var CustomerService = function(props) {
|
|
|
1342
1439
|
setLoading(false);
|
|
1343
1440
|
}
|
|
1344
1441
|
};
|
|
1442
|
+
//重置底部输入框高度
|
|
1443
|
+
var resettingBottomHei = function() {
|
|
1444
|
+
setTimeout(function() {
|
|
1445
|
+
if (showType == 1 || showType == 3) {
|
|
1446
|
+
if (document.getElementById("Drawer_buttom")) {
|
|
1447
|
+
var hei = document.getElementById("Drawer_buttom").offsetHeight + document.getElementById("BottomAssociationProblem").offsetHeight;
|
|
1448
|
+
setButtomHei(hei);
|
|
1449
|
+
}
|
|
1450
|
+
} else {
|
|
1451
|
+
if (document.getElementById("Drawer_buttom_modal")) {
|
|
1452
|
+
var hei1 = document.getElementById("Drawer_buttom_modal").offsetHeight + document.getElementById("BottomAssociationProblem").offsetHeight;
|
|
1453
|
+
setButtomHei(hei1);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}, 50);
|
|
1457
|
+
};
|
|
1345
1458
|
// 获取新的JWT
|
|
1346
1459
|
var verifyJWT = function(url) {
|
|
1347
1460
|
return new Promise(function(resolve) {
|
|
@@ -1375,6 +1488,9 @@ var CustomerService = function(props) {
|
|
|
1375
1488
|
//显示聊天室名字
|
|
1376
1489
|
var showChatRoomName = function() {
|
|
1377
1490
|
var title = "AI助手";
|
|
1491
|
+
title = userData.modules.some(function(ele) {
|
|
1492
|
+
return ele.short == "AIservice";
|
|
1493
|
+
}) ? "AI助手" : "智能问答";
|
|
1378
1494
|
var list = contactsList.filter(function(e) {
|
|
1379
1495
|
return e.roomId == roomId;
|
|
1380
1496
|
});
|
|
@@ -1453,13 +1569,19 @@ var CustomerService = function(props) {
|
|
|
1453
1569
|
/*#__PURE__*/ _jsxs("div", {
|
|
1454
1570
|
className: styles.operate,
|
|
1455
1571
|
children: [
|
|
1456
|
-
/*#__PURE__*/
|
|
1457
|
-
className:
|
|
1572
|
+
/*#__PURE__*/ _jsxs("i", {
|
|
1573
|
+
className: styles.popover_main,
|
|
1458
1574
|
onClick: function() {
|
|
1459
1575
|
setShowHistory(true);
|
|
1460
1576
|
onEvent(serverName + serverUrl(), "click_智能问答_历史记录", "提交");
|
|
1461
1577
|
},
|
|
1462
|
-
children:
|
|
1578
|
+
children: [
|
|
1579
|
+
/*#__PURE__*/ _jsx(CustomRecord, {}),
|
|
1580
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1581
|
+
className: styles.popover,
|
|
1582
|
+
children: "历史记录"
|
|
1583
|
+
})
|
|
1584
|
+
]
|
|
1463
1585
|
}),
|
|
1464
1586
|
/*#__PURE__*/ _jsx("span", {
|
|
1465
1587
|
className: styles.line
|
|
@@ -1487,7 +1609,9 @@ var CustomerService = function(props) {
|
|
|
1487
1609
|
children: /*#__PURE__*/ _jsx(CustomExitFullScreen, {})
|
|
1488
1610
|
}),
|
|
1489
1611
|
/*#__PURE__*/ _jsx("i", {
|
|
1490
|
-
onClick:
|
|
1612
|
+
onClick: function() {
|
|
1613
|
+
onCancel();
|
|
1614
|
+
},
|
|
1491
1615
|
children: /*#__PURE__*/ _jsx(CloseOutlined, {})
|
|
1492
1616
|
})
|
|
1493
1617
|
]
|
|
@@ -1496,22 +1620,6 @@ var CustomerService = function(props) {
|
|
|
1496
1620
|
});
|
|
1497
1621
|
}
|
|
1498
1622
|
};
|
|
1499
|
-
//重置底部输入框高度
|
|
1500
|
-
var resettingBottomHei = function() {
|
|
1501
|
-
setTimeout(function() {
|
|
1502
|
-
if (showType == 1 || showType == 3) {
|
|
1503
|
-
if (document.getElementById("Drawer_buttom")) {
|
|
1504
|
-
var hei = document.getElementById("Drawer_buttom").offsetHeight;
|
|
1505
|
-
setButtomHei(hei);
|
|
1506
|
-
}
|
|
1507
|
-
} else {
|
|
1508
|
-
if (document.getElementById("Drawer_buttom_modal")) {
|
|
1509
|
-
var hei1 = document.getElementById("Drawer_buttom_modal").offsetHeight;
|
|
1510
|
-
setButtomHei(hei1);
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
}, 50);
|
|
1514
|
-
};
|
|
1515
1623
|
//切换聊天室 type == renew ,存在新消息
|
|
1516
1624
|
var switchChatRoom = function(id, type) {
|
|
1517
1625
|
if (type != "1") {
|
|
@@ -1550,19 +1658,12 @@ var CustomerService = function(props) {
|
|
|
1550
1658
|
// setRoomId(id);
|
|
1551
1659
|
// }
|
|
1552
1660
|
};
|
|
1553
|
-
// const saveContactsList = (list: any)=>{
|
|
1554
|
-
// console.log(list,44444444)
|
|
1555
|
-
// // if(list != undefined){
|
|
1556
|
-
// // setRoomList(list);
|
|
1557
|
-
// // }
|
|
1558
|
-
// }
|
|
1559
1661
|
//渲染问答
|
|
1560
1662
|
var renderQuestion = function() {
|
|
1561
1663
|
// if (historyMessageList.length > 0) {
|
|
1562
1664
|
return /*#__PURE__*/ _jsx("ul", {
|
|
1563
1665
|
className: styles.message_con,
|
|
1564
1666
|
children: historyMessageList.map(function(item, i) {
|
|
1565
|
-
console.log(item, 444444888888);
|
|
1566
1667
|
var timeObj = parseDate(item.createdAt);
|
|
1567
1668
|
// console.log(item.message);
|
|
1568
1669
|
var message = item.message;
|
|
@@ -1594,6 +1695,9 @@ var CustomerService = function(props) {
|
|
|
1594
1695
|
}
|
|
1595
1696
|
}
|
|
1596
1697
|
var dataTime = time;
|
|
1698
|
+
// let code = message.split("```");
|
|
1699
|
+
// code = code[1];
|
|
1700
|
+
// console.log(code,888888888);
|
|
1597
1701
|
if (lastId == item.id && keyWordProblem != "") {
|
|
1598
1702
|
message = remarkable.render(message);
|
|
1599
1703
|
message = message.replaceAll(keyWordProblem, function(e) {
|
|
@@ -1602,6 +1706,14 @@ var CustomerService = function(props) {
|
|
|
1602
1706
|
} else {
|
|
1603
1707
|
message = remarkable.render(message);
|
|
1604
1708
|
}
|
|
1709
|
+
var position = 0;
|
|
1710
|
+
message = message.replaceAll(new RegExp("<pre", "ig"), function(i, index) {
|
|
1711
|
+
//copyText(${item.message,2,position})
|
|
1712
|
+
position++;
|
|
1713
|
+
// console.log(i,index,onClick={copyText} ,'skdcnsdjk')
|
|
1714
|
+
var text = "<p class='".concat(styles.copyCode, " copyCodeFun' data-id=").concat(item.id, " data-position=").concat(position, ">\n <span class='").concat(styles.icon, ' copy\' >\n <svg\n width="1em"\n height="1em"\n viewBox="0 0 14 14"\n shape-rendering="geometricPrecision"\n fill="currentColor"\n xmlns="http://www.w3.org/2000/svg"\n >\n <g clip-path="url(#clip0_518_8403)">\n <path\n d="M6.16666 1.66666H13.1667C13.4761 1.66666 13.7728 1.78957 13.9916 2.00837C14.2104 2.22716 14.3333 2.5239 14.3333 2.83332V9.83332C14.3333 10.1427 14.2104 10.4395 13.9916 10.6583C13.7728 10.8771 13.4761 11 13.1667 11H6.16666C5.85724 11 5.5605 10.8771 5.34171 10.6583C5.12291 10.4395 5 10.1427 5 9.83332V2.83332C5 2.5239 5.12291 2.22716 5.34171 2.00837C5.5605 1.78957 5.85724 1.66666 6.16666 1.66666ZM6.16666 2.66666C6.12246 2.66666 6.08007 2.68422 6.04881 2.71547C6.01756 2.74673 6 2.78912 6 2.83332V9.83332C6 9.85521 6.00431 9.87688 6.01268 9.8971C6.02106 9.91732 6.03334 9.9357 6.04881 9.95117C6.06429 9.96665 6.08266 9.97893 6.10288 9.9873C6.1231 9.99568 6.14478 9.99999 6.16666 9.99999H13.1667C13.2109 9.99999 13.2533 9.98243 13.2845 9.95117C13.3158 9.91992 13.3333 9.87753 13.3333 9.83332V2.83332C13.3333 2.78912 13.3158 2.74673 13.2845 2.71547C13.2533 2.68422 13.2109 2.66666 13.1667 2.66666H6.16666ZM10 12C10 11.8674 10.0527 11.7402 10.1464 11.6464C10.2402 11.5527 10.3674 11.5 10.5 11.5C10.6326 11.5 10.7598 11.5527 10.8536 11.6464C10.9473 11.7402 11 11.8674 11 12V13.1667C11 13.4761 10.8771 13.7728 10.6583 13.9916C10.4395 14.2104 10.1427 14.3333 9.83333 14.3333H2.83333C2.52391 14.3333 2.22717 14.2104 2.00837 13.9916C1.78958 13.7728 1.66666 13.4761 1.66666 13.1667V6.16666C1.66666 5.85724 1.78958 5.56049 2.00837 5.3417C2.22717 5.12291 2.52391 4.99999 2.83333 4.99999H4C4.13261 4.99999 4.25978 5.05267 4.35355 5.14644C4.44732 5.2402 4.5 5.36738 4.5 5.49999C4.5 5.6326 4.44732 5.75978 4.35355 5.85354C4.25978 5.94731 4.13261 5.99999 4 5.99999H2.83333C2.78913 5.99999 2.74674 6.01755 2.71548 6.04881C2.68422 6.08006 2.66666 6.12245 2.66666 6.16666V13.1667C2.66666 13.2109 2.68422 13.2533 2.71548 13.2845C2.74674 13.3158 2.78913 13.3333 2.83333 13.3333H9.83333C9.87753 13.3333 9.91993 13.3158 9.95118 13.2845C9.98244 13.2533 10 13.2109 10 13.1667V12Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_518_8403">\n <rect width="16" height="16" />\n </clipPath>\n </defs>\n </svg>\n </span>\n <span class=\'').concat(styles.icon, ' copy_success_flag\'>\n <svg\n width="1em"\n height="1em"\n shape-rendering="geometricPrecision"\n fill="currentColor"\n viewBox="0 0 12 7"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path d="M11.2242 0.375687C11.4586 0.610002 11.4586 0.989901 11.2242 1.22422L4.82424 7.62422C4.58992 7.85853 4.21003 7.85853 3.97571 7.62422L0.775712 4.42422C0.541397 4.1899 0.541397 3.81 0.775712 3.57569C1.01003 3.34137 1.38993 3.34137 1.62424 3.57569L4.39998 6.35142L10.3757 0.375687C10.61 0.141373 10.9899 0.141373 11.2242 0.375687Z" />\n </svg>\n </span><span class="copyCode">复制代码</span></p><pre');
|
|
1715
|
+
return text;
|
|
1716
|
+
});
|
|
1605
1717
|
if (item.sender == mid) {
|
|
1606
1718
|
//只有引用和复制功能
|
|
1607
1719
|
li = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
@@ -1632,7 +1744,8 @@ var CustomerService = function(props) {
|
|
|
1632
1744
|
onClick: function() {
|
|
1633
1745
|
setCitationContent({
|
|
1634
1746
|
content: item.message,
|
|
1635
|
-
id: item.id
|
|
1747
|
+
id: item.id,
|
|
1748
|
+
imageUrl: item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" ? JSON.parse(item.extraInfo)[0].value : ""
|
|
1636
1749
|
});
|
|
1637
1750
|
resettingBottomHei();
|
|
1638
1751
|
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
@@ -1670,14 +1783,33 @@ var CustomerService = function(props) {
|
|
|
1670
1783
|
]
|
|
1671
1784
|
})
|
|
1672
1785
|
}),
|
|
1673
|
-
/*#__PURE__*/
|
|
1786
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1674
1787
|
className: styles.content,
|
|
1675
|
-
children:
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1788
|
+
children: [
|
|
1789
|
+
/*#__PURE__*/ _jsx("p", {
|
|
1790
|
+
dangerouslySetInnerHTML: {
|
|
1791
|
+
__html: message
|
|
1792
|
+
},
|
|
1793
|
+
className: styles.content_child
|
|
1794
|
+
}),
|
|
1795
|
+
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
1796
|
+
className: styles.img_con,
|
|
1797
|
+
children: [
|
|
1798
|
+
/*#__PURE__*/ _jsx("img", {
|
|
1799
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
1800
|
+
}),
|
|
1801
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1802
|
+
className: styles.mask_zoom,
|
|
1803
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
1804
|
+
onClick: function() {
|
|
1805
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
1806
|
+
setVisible(true);
|
|
1807
|
+
}
|
|
1808
|
+
})
|
|
1809
|
+
})
|
|
1810
|
+
]
|
|
1811
|
+
})
|
|
1812
|
+
]
|
|
1681
1813
|
})
|
|
1682
1814
|
]
|
|
1683
1815
|
}),
|
|
@@ -1777,6 +1909,23 @@ var CustomerService = function(props) {
|
|
|
1777
1909
|
},
|
|
1778
1910
|
className: styles.content_child
|
|
1779
1911
|
}),
|
|
1912
|
+
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
1913
|
+
className: styles.img_con,
|
|
1914
|
+
children: [
|
|
1915
|
+
/*#__PURE__*/ _jsx("img", {
|
|
1916
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
1917
|
+
}),
|
|
1918
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1919
|
+
className: styles.mask_zoom,
|
|
1920
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
1921
|
+
onClick: function() {
|
|
1922
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
1923
|
+
setVisible(true);
|
|
1924
|
+
}
|
|
1925
|
+
})
|
|
1926
|
+
})
|
|
1927
|
+
]
|
|
1928
|
+
}),
|
|
1780
1929
|
item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ _jsx("ul", {
|
|
1781
1930
|
className: styles.association_problem,
|
|
1782
1931
|
children: JSON.parse(item.extraInfo).map(function(list, index) {
|
|
@@ -1791,6 +1940,29 @@ var CustomerService = function(props) {
|
|
|
1791
1940
|
]
|
|
1792
1941
|
}, i + "_" + index + "_" + list.value);
|
|
1793
1942
|
})
|
|
1943
|
+
}),
|
|
1944
|
+
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1945
|
+
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1946
|
+
//召唤老师回答按钮
|
|
1947
|
+
isAiChatWindow && item.findTeacher && userData.modules.some(function(item) {
|
|
1948
|
+
return item.short == "TeacherAnswer";
|
|
1949
|
+
}) && /*#__PURE__*/ _jsx("div", {
|
|
1950
|
+
className: "".concat(styles.operate_modal_bottom, " "),
|
|
1951
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
1952
|
+
className: styles.stop_findTeacher,
|
|
1953
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
1954
|
+
onClick: function() {
|
|
1955
|
+
setAnswerMode(-1);
|
|
1956
|
+
setTeacherList([]);
|
|
1957
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
1958
|
+
return historyMessageList.filter(function(item) {
|
|
1959
|
+
return item.id != "-1";
|
|
1960
|
+
});
|
|
1961
|
+
});
|
|
1962
|
+
},
|
|
1963
|
+
children: "停止召唤老师"
|
|
1964
|
+
})
|
|
1965
|
+
})
|
|
1794
1966
|
})
|
|
1795
1967
|
]
|
|
1796
1968
|
})
|
|
@@ -1813,30 +1985,7 @@ var CustomerService = function(props) {
|
|
|
1813
1985
|
}) : /*#__PURE__*/ _jsx("p", {
|
|
1814
1986
|
children: item.quotedMessage
|
|
1815
1987
|
})
|
|
1816
|
-
})
|
|
1817
|
-
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1818
|
-
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1819
|
-
//召唤老师回答按钮
|
|
1820
|
-
isAiChatWindow && item.findTeacher && userData.modules.some(function(item) {
|
|
1821
|
-
return item.short == "TeacherAnswer";
|
|
1822
|
-
}) ? /*#__PURE__*/ _jsx("div", {
|
|
1823
|
-
className: "".concat(styles.operate_modal_bottom, " "),
|
|
1824
|
-
children: /*#__PURE__*/ _jsx("p", {
|
|
1825
|
-
className: styles.stop_findTeacher,
|
|
1826
|
-
children: /*#__PURE__*/ _jsx("span", {
|
|
1827
|
-
onClick: function() {
|
|
1828
|
-
setAnswerMode(-1);
|
|
1829
|
-
setTeacherList([]);
|
|
1830
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
1831
|
-
return historyMessageList.filter(function(item) {
|
|
1832
|
-
return item.id != "-1";
|
|
1833
|
-
});
|
|
1834
|
-
});
|
|
1835
|
-
},
|
|
1836
|
-
children: "停止召唤老师"
|
|
1837
|
-
})
|
|
1838
|
-
})
|
|
1839
|
-
}) : ""
|
|
1988
|
+
})
|
|
1840
1989
|
]
|
|
1841
1990
|
})
|
|
1842
1991
|
})
|
|
@@ -1857,16 +2006,17 @@ var CustomerService = function(props) {
|
|
|
1857
2006
|
//问候语及点赞下面不需要展示相关按钮
|
|
1858
2007
|
var extraInfo = item.extraInfo;
|
|
1859
2008
|
//JSON.parse(extraInfo)[0].key == 'questionId' 是联想问题
|
|
1860
|
-
if (extraInfo
|
|
2009
|
+
if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
|
|
1861
2010
|
return "";
|
|
1862
2011
|
}
|
|
2012
|
+
// console.log(historyMessageList,i,'sdcsd;sldcscsdsd')
|
|
1863
2013
|
return /*#__PURE__*/ _jsxs("p", {
|
|
1864
2014
|
className: styles.operate,
|
|
1865
2015
|
children: [
|
|
1866
2016
|
// 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
|
|
1867
2017
|
isAiChatWindow && answerMode != 1 && userData.modules.some(function(item) {
|
|
1868
2018
|
return item.short == "TeacherAnswer";
|
|
1869
|
-
}) && /*#__PURE__*/ _jsx("span", {
|
|
2019
|
+
}) && historyMessageList[i - 1].extraInfo && JSON.parse(historyMessageList[i - 1].extraInfo).length > 0 && JSON.parse(historyMessageList[i - 1].extraInfo)[0].key != "imageUrl" && /*#__PURE__*/ _jsx("span", {
|
|
1870
2020
|
className: styles.ask_question,
|
|
1871
2021
|
onClick: function() {
|
|
1872
2022
|
setAnswerMode(1);
|
|
@@ -2015,7 +2165,7 @@ var CustomerService = function(props) {
|
|
|
2015
2165
|
}
|
|
2016
2166
|
//3、是否显示召唤老师回答按钮
|
|
2017
2167
|
var findTeacherBtn = false;
|
|
2018
|
-
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
|
|
2168
|
+
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null) && historyMessageList[i - 1].extraInfo && JSON.parse(historyMessageList[i - 1].extraInfo).length > 0 && JSON.parse(historyMessageList[i - 1].extraInfo)[0].key != "imageUrl") {
|
|
2019
2169
|
findTeacherBtn = true;
|
|
2020
2170
|
}
|
|
2021
2171
|
return /*#__PURE__*/ _jsxs("div", {
|
|
@@ -2221,16 +2371,46 @@ var CustomerService = function(props) {
|
|
|
2221
2371
|
]
|
|
2222
2372
|
});
|
|
2223
2373
|
};
|
|
2374
|
+
//保存粘贴的图片
|
|
2375
|
+
var handleFilePaste = function(e) {
|
|
2376
|
+
e.preventDefault();
|
|
2377
|
+
var items = e.clipboardData.items;
|
|
2378
|
+
// console.log(e,items,3333333)
|
|
2379
|
+
for(var i = 0; i < items.length; i++){
|
|
2380
|
+
var item = items[i];
|
|
2381
|
+
if (item.kind === "file") {
|
|
2382
|
+
var file = item.getAsFile();
|
|
2383
|
+
if (file && file.type.startsWith("image/")) {
|
|
2384
|
+
// 处理粘贴的图片文件
|
|
2385
|
+
// 创建FileReader对象
|
|
2386
|
+
var reader = new FileReader();
|
|
2387
|
+
// 文件读取成功后执行的回调函数
|
|
2388
|
+
reader.onload = function handleFilePaste(event) {
|
|
2389
|
+
// 获取Base64编码的字符串
|
|
2390
|
+
var base64String = event.target.result;
|
|
2391
|
+
setScreenshotBese64(base64String);
|
|
2392
|
+
};
|
|
2393
|
+
// 以Base64格式读取文件
|
|
2394
|
+
reader.readAsDataURL(file);
|
|
2395
|
+
}
|
|
2396
|
+
} else {
|
|
2397
|
+
var clipboardData = e.clipboardData || window.clipboardData;
|
|
2398
|
+
var pastedText = clipboardData.getData("text");
|
|
2399
|
+
var con = keyWord + pastedText;
|
|
2400
|
+
setKeyWord(con);
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2224
2404
|
//渲染底部按钮
|
|
2225
2405
|
var renderBottomAnt = function() {
|
|
2226
2406
|
var placeholder = "";
|
|
2227
2407
|
var disabled = false;
|
|
2228
|
-
if (
|
|
2229
|
-
placeholder = "正在录制语音,再次点击麦克风结束录制。";
|
|
2230
|
-
} else if (voiceRecordingStatus == 1) {
|
|
2231
|
-
placeholder = "正在语音识别文字,请稍后...";
|
|
2232
|
-
} else if (!finished) {
|
|
2408
|
+
if (!finished) {
|
|
2233
2409
|
placeholder = "答案生成中,请稍后再发送...";
|
|
2410
|
+
}
|
|
2411
|
+
if (screenshotBese64) {
|
|
2412
|
+
placeholder = "在发送之前,请输入需要对这个图片做的操作...";
|
|
2413
|
+
disabled = true;
|
|
2234
2414
|
} else {
|
|
2235
2415
|
placeholder = "请输入问题,按Enter发送,Shift+Enter换行";
|
|
2236
2416
|
disabled = true;
|
|
@@ -2247,7 +2427,114 @@ var CustomerService = function(props) {
|
|
|
2247
2427
|
className: "".concat(styles.input, " ").concat(userData.modules.some(function(item) {
|
|
2248
2428
|
return item.short == "AIservice";
|
|
2249
2429
|
}) ? "" : styles.no_AI),
|
|
2430
|
+
onPaste: handleFilePaste,
|
|
2250
2431
|
children: [
|
|
2432
|
+
screenshotBese64 && /*#__PURE__*/ _jsxs("div", {
|
|
2433
|
+
className: styles.picture_layout,
|
|
2434
|
+
children: [
|
|
2435
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
2436
|
+
className: styles.left,
|
|
2437
|
+
children: [
|
|
2438
|
+
/*#__PURE__*/ _jsx("img", {
|
|
2439
|
+
src: screenshotBese64
|
|
2440
|
+
}),
|
|
2441
|
+
/*#__PURE__*/ _jsx("span", {
|
|
2442
|
+
className: styles.icon_close,
|
|
2443
|
+
onClick: function() {
|
|
2444
|
+
setScreenshotBese64("");
|
|
2445
|
+
},
|
|
2446
|
+
children: /*#__PURE__*/ _jsx(CustomRoundClose, {})
|
|
2447
|
+
}),
|
|
2448
|
+
/*#__PURE__*/ _jsx("div", {
|
|
2449
|
+
className: styles.icon_zoom,
|
|
2450
|
+
onClick: function() {
|
|
2451
|
+
setViewBase64(screenshotBese64), setVisible(true);
|
|
2452
|
+
},
|
|
2453
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {})
|
|
2454
|
+
})
|
|
2455
|
+
]
|
|
2456
|
+
}),
|
|
2457
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
2458
|
+
className: styles.right,
|
|
2459
|
+
children: [
|
|
2460
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
2461
|
+
onClick: function() {
|
|
2462
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
2463
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
2464
|
+
id: -1,
|
|
2465
|
+
roomId: roomId,
|
|
2466
|
+
sender: mid,
|
|
2467
|
+
recevier: "AI",
|
|
2468
|
+
message: "讲解这张图片涉及到的知识内容",
|
|
2469
|
+
createdAt: getDataTime(-1),
|
|
2470
|
+
extraInfo: JSON.stringify([
|
|
2471
|
+
{
|
|
2472
|
+
key: "imageUrl",
|
|
2473
|
+
value: screenshotBese64
|
|
2474
|
+
}
|
|
2475
|
+
])
|
|
2476
|
+
});
|
|
2477
|
+
return newHistoryMessageList;
|
|
2478
|
+
});
|
|
2479
|
+
scrollToBottom();
|
|
2480
|
+
aiSendQuestions(3, {
|
|
2481
|
+
//相关数据
|
|
2482
|
+
roomId: roomId,
|
|
2483
|
+
message: "讲解这张图片涉及到的知识内容",
|
|
2484
|
+
image: screenshotBese64,
|
|
2485
|
+
quotedMessage: citationContent.content || "",
|
|
2486
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
2487
|
+
generateUpvoteOrDownvoteMessage: false
|
|
2488
|
+
}, 1);
|
|
2489
|
+
setScreenshotBese64("");
|
|
2490
|
+
resettingBottomHei();
|
|
2491
|
+
},
|
|
2492
|
+
children: [
|
|
2493
|
+
/*#__PURE__*/ _jsx(CustomKnowledgeContent, {}),
|
|
2494
|
+
"讲解这张图片涉及到的知识内容"
|
|
2495
|
+
]
|
|
2496
|
+
}),
|
|
2497
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
2498
|
+
onClick: function() {
|
|
2499
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
2500
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
2501
|
+
id: -1,
|
|
2502
|
+
roomId: roomId,
|
|
2503
|
+
sender: mid,
|
|
2504
|
+
recevier: "AI",
|
|
2505
|
+
message: "帮助我更深入地理解图片中的概念",
|
|
2506
|
+
createdAt: getDataTime(-1),
|
|
2507
|
+
extraInfo: JSON.stringify([
|
|
2508
|
+
{
|
|
2509
|
+
key: "imageUrl",
|
|
2510
|
+
value: screenshotBese64
|
|
2511
|
+
}
|
|
2512
|
+
])
|
|
2513
|
+
});
|
|
2514
|
+
return newHistoryMessageList;
|
|
2515
|
+
});
|
|
2516
|
+
scrollToBottom();
|
|
2517
|
+
aiSendQuestions(3, {
|
|
2518
|
+
//相关数据
|
|
2519
|
+
roomId: roomId,
|
|
2520
|
+
message: "帮助我更深入地理解图片中的概念",
|
|
2521
|
+
image: screenshotBese64,
|
|
2522
|
+
quotedMessage: citationContent.content || "",
|
|
2523
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
2524
|
+
generateUpvoteOrDownvoteMessage: false
|
|
2525
|
+
}, 1);
|
|
2526
|
+
setScreenshotBese64("");
|
|
2527
|
+
resettingBottomHei();
|
|
2528
|
+
},
|
|
2529
|
+
children: [
|
|
2530
|
+
/*#__PURE__*/ _jsx(CustomWenhaoRound, {}),
|
|
2531
|
+
"帮助我更深入地理解图片中的概念"
|
|
2532
|
+
]
|
|
2533
|
+
})
|
|
2534
|
+
]
|
|
2535
|
+
})
|
|
2536
|
+
]
|
|
2537
|
+
}),
|
|
2251
2538
|
/*#__PURE__*/ _jsx(TextArea, {
|
|
2252
2539
|
placeholder: placeholder,
|
|
2253
2540
|
autoSize: {
|
|
@@ -2269,7 +2556,12 @@ var CustomerService = function(props) {
|
|
|
2269
2556
|
} else {
|
|
2270
2557
|
var roomList = contactsList;
|
|
2271
2558
|
if (roomList.length > 0 && roomList[0].roomId != roomId) return;
|
|
2272
|
-
|
|
2559
|
+
console.log(props, 333333);
|
|
2560
|
+
if (props.config && props.config.type == "video") {
|
|
2561
|
+
getQuestiionsList(String(e.target.value), 3);
|
|
2562
|
+
} else {
|
|
2563
|
+
getQuestiionsList(String(e.target.value), 2);
|
|
2564
|
+
}
|
|
2273
2565
|
}
|
|
2274
2566
|
}, 1000);
|
|
2275
2567
|
}
|
|
@@ -2326,15 +2618,18 @@ var CustomerService = function(props) {
|
|
|
2326
2618
|
onEvent(serverName + serverUrl(), "click_智能问答_输入框", "提交");
|
|
2327
2619
|
},
|
|
2328
2620
|
disabled: !disabled,
|
|
2329
|
-
maxLength: 1000
|
|
2621
|
+
maxLength: 1000,
|
|
2622
|
+
id: "con_textarea"
|
|
2330
2623
|
}),
|
|
2331
|
-
citationContent.content
|
|
2624
|
+
citationContent.content && /*#__PURE__*/ _jsxs("div", {
|
|
2332
2625
|
className: styles.content_main,
|
|
2333
2626
|
children: [
|
|
2334
2627
|
/*#__PURE__*/ _jsx("div", {
|
|
2335
2628
|
className: styles.content_con,
|
|
2336
2629
|
children: /*#__PURE__*/ _jsx("p", {
|
|
2337
|
-
children:
|
|
2630
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
2631
|
+
children: citationContent.content
|
|
2632
|
+
})
|
|
2338
2633
|
})
|
|
2339
2634
|
}),
|
|
2340
2635
|
/*#__PURE__*/ _jsx("i", {
|
|
@@ -2346,45 +2641,21 @@ var CustomerService = function(props) {
|
|
|
2346
2641
|
children: /*#__PURE__*/ _jsx(CustomRoundClose, {})
|
|
2347
2642
|
})
|
|
2348
2643
|
]
|
|
2349
|
-
})
|
|
2644
|
+
})
|
|
2350
2645
|
]
|
|
2351
2646
|
}),
|
|
2352
2647
|
userData.modules.some(function(item) {
|
|
2353
2648
|
return item.short == "AIservice";
|
|
2354
|
-
})
|
|
2355
|
-
className: styles.
|
|
2356
|
-
children:
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
setKeyWord("");
|
|
2365
|
-
voiceCountdownTimer.current = setTimeout(function() {
|
|
2366
|
-
stopRecord();
|
|
2367
|
-
setVoiceRecordingStatus(1);
|
|
2368
|
-
}, 120000);
|
|
2369
|
-
onEvent(serverName + serverUrl(), "click_智能问答_ 麦克风", "提交");
|
|
2370
|
-
},
|
|
2371
|
-
children: /*#__PURE__*/ _jsx(CustomSoundRecording, {})
|
|
2372
|
-
}) : "",
|
|
2373
|
-
voiceRecordingStatus == 2 ? /*#__PURE__*/ _jsx("img", {
|
|
2374
|
-
// src={Voice_btn}
|
|
2375
|
-
src: "/new_yun/images/aiService/voice_btn.gif",
|
|
2376
|
-
className: styles.voice_btn,
|
|
2377
|
-
onClick: function() {
|
|
2378
|
-
//结束录音
|
|
2379
|
-
// console.log(mediaRecorder,'3333333');
|
|
2380
|
-
// mediaRecorder.stop();
|
|
2381
|
-
stopRecord();
|
|
2382
|
-
setVoiceRecordingStatus(1);
|
|
2383
|
-
clearTimeout(voiceCountdownTimer.current);
|
|
2384
|
-
}
|
|
2385
|
-
}) : ""
|
|
2386
|
-
]
|
|
2387
|
-
}) : ""
|
|
2649
|
+
}) && contactsList.length > 0 && contactsList[0].roomId == roomId && /*#__PURE__*/ _jsx("p", {
|
|
2650
|
+
className: styles.screenshot,
|
|
2651
|
+
children: /*#__PURE__*/ _jsx("i", {
|
|
2652
|
+
className: "".concat(!disabled ? styles.disabled : ""),
|
|
2653
|
+
onClick: function() {
|
|
2654
|
+
setShowType(5);
|
|
2655
|
+
},
|
|
2656
|
+
children: /*#__PURE__*/ _jsx(CustomScreenshot, {})
|
|
2657
|
+
})
|
|
2658
|
+
})
|
|
2388
2659
|
]
|
|
2389
2660
|
}),
|
|
2390
2661
|
/*#__PURE__*/ _jsx("p", {
|
|
@@ -2508,7 +2779,8 @@ var CustomerService = function(props) {
|
|
|
2508
2779
|
style: {
|
|
2509
2780
|
bottom: "".concat(buttomHei + 6, "px")
|
|
2510
2781
|
},
|
|
2511
|
-
children: questionsList.map(function(item) {
|
|
2782
|
+
children: questionsList.map(function(item, i) {
|
|
2783
|
+
if (i > 4) return "";
|
|
2512
2784
|
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2513
2785
|
var span = "";
|
|
2514
2786
|
//搜索内容是否有特殊字符
|
|
@@ -2539,6 +2811,23 @@ var CustomerService = function(props) {
|
|
|
2539
2811
|
});
|
|
2540
2812
|
}
|
|
2541
2813
|
};
|
|
2814
|
+
var renderBottomAssociationProblem = function() {
|
|
2815
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
2816
|
+
className: styles.issues_list_flag,
|
|
2817
|
+
style: {
|
|
2818
|
+
bottom: "".concat(buttomHei, "px")
|
|
2819
|
+
},
|
|
2820
|
+
id: "BottomAssociationProblem",
|
|
2821
|
+
children: bottomRecommendationQuestions.map(function(item) {
|
|
2822
|
+
return /*#__PURE__*/ _jsx("p", {
|
|
2823
|
+
onClick: function() {
|
|
2824
|
+
sendMessage(item, 1);
|
|
2825
|
+
},
|
|
2826
|
+
children: item.question
|
|
2827
|
+
}, item.id);
|
|
2828
|
+
})
|
|
2829
|
+
});
|
|
2830
|
+
};
|
|
2542
2831
|
//加载指定数据,点击历史记录
|
|
2543
2832
|
var loadSpecifiedData = function(renewRoomId, page, id, receiver, keyWordProblem) {
|
|
2544
2833
|
// let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
|
|
@@ -2579,7 +2868,6 @@ var CustomerService = function(props) {
|
|
|
2579
2868
|
open: showType == 1 ? true : false,
|
|
2580
2869
|
className: styles.ChatWindow_Drawer,
|
|
2581
2870
|
mask: false,
|
|
2582
|
-
// maskClosable={false}
|
|
2583
2871
|
rootClassName: styles.service_ChatWindow_Drawer,
|
|
2584
2872
|
children: [
|
|
2585
2873
|
showType == 1 && /*#__PURE__*/ _jsx("div", {
|
|
@@ -2636,6 +2924,7 @@ var CustomerService = function(props) {
|
|
|
2636
2924
|
className: styles.Drawer_buttom_Issues_List,
|
|
2637
2925
|
children: [
|
|
2638
2926
|
renderAssociationProblem(),
|
|
2927
|
+
renderBottomAssociationProblem(),
|
|
2639
2928
|
/*#__PURE__*/ _jsx("div", {
|
|
2640
2929
|
className: styles.Drawer_buttom,
|
|
2641
2930
|
id: "Drawer_buttom",
|
|
@@ -3043,6 +3332,28 @@ var CustomerService = function(props) {
|
|
|
3043
3332
|
]
|
|
3044
3333
|
})
|
|
3045
3334
|
]
|
|
3335
|
+
}),
|
|
3336
|
+
showType == 5 && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
|
|
3337
|
+
imgBese64: imgBese64,
|
|
3338
|
+
saveScreenshotBese64: function(base64) {
|
|
3339
|
+
setScreenshotBese64(base64);
|
|
3340
|
+
setShowType(1);
|
|
3341
|
+
},
|
|
3342
|
+
cancelScreenshot: function() {
|
|
3343
|
+
setShowType(1);
|
|
3344
|
+
}
|
|
3345
|
+
}),
|
|
3346
|
+
viewBase64 && visible && /*#__PURE__*/ _jsx(ViewImage, {
|
|
3347
|
+
visible: visible,
|
|
3348
|
+
onCancel: function() {
|
|
3349
|
+
return setVisible(false);
|
|
3350
|
+
},
|
|
3351
|
+
className: "",
|
|
3352
|
+
getSrc: function() {
|
|
3353
|
+
return new Promise(function(resolve) {
|
|
3354
|
+
resolve(viewBase64);
|
|
3355
|
+
});
|
|
3356
|
+
}
|
|
3046
3357
|
})
|
|
3047
3358
|
]
|
|
3048
3359
|
});
|