bhd-components 0.5.7 → 0.5.9
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/{535fc6c5.esm.es5.development.js → 4a44b71b.esm.es5.development.js} +98068 -25721
- package/dist/e7b4aef5.esm.es5.production.js +468 -0
- package/dist/index.esm.es5.development.css +8467 -0
- package/dist/index.esm.es5.development.js +5881 -0
- package/dist/index.esm.es5.production.css +1 -0
- package/dist/index.esm.es5.production.js +1 -0
- package/es2017/customerService/contactsList/index.d.ts +3 -2
- package/es2017/customerService/contactsList/index.js +93 -90
- package/es2017/customerService/contactsList/index.module.less +32 -13
- package/es2017/customerService/function.js +18 -13
- package/es2017/customerService/historyFun/index.d.ts +2 -1
- package/es2017/customerService/historyFun/index.js +121 -86
- package/es2017/customerService/historyFun/index.module.less +40 -6
- package/es2017/customerService/index.js +748 -567
- package/es2017/customerService/index.module.less +747 -684
- package/es2017/icons/components/custom-duihao.js +1 -1
- package/es2017/utils/Date.d.ts +9 -0
- package/es2017/utils/Date.js +18 -0
- package/esm/customerService/contactsList/index.d.ts +3 -2
- package/esm/customerService/contactsList/index.js +104 -97
- package/esm/customerService/contactsList/index.module.less +32 -13
- package/esm/customerService/function.js +18 -13
- package/esm/customerService/historyFun/index.d.ts +2 -1
- package/esm/customerService/historyFun/index.js +127 -94
- package/esm/customerService/historyFun/index.module.less +40 -6
- package/esm/customerService/index.js +813 -609
- package/esm/customerService/index.module.less +747 -684
- package/esm/icons/components/custom-duihao.js +1 -1
- package/esm/utils/Date.d.ts +9 -0
- package/esm/utils/Date.js +18 -0
- package/package.json +4 -3
- package/dist/1bddec89.esm.es5.production.js +0 -72
- package/dist/CustomerService.esm.es5.development.css +0 -2827
- package/dist/CustomerService.esm.es5.development.js +0 -3823
- package/dist/CustomerService.esm.es5.production.css +0 -1
- package/dist/CustomerService.esm.es5.production.js +0 -1
|
@@ -3,14 +3,14 @@ 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
4
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
|
|
5
5
|
import React, { useEffect, useState, useRef } from "react";
|
|
6
|
-
import styles from "./index.module.less";
|
|
7
6
|
import { Modal, Drawer, Input, Tooltip } from "antd";
|
|
7
|
+
import styles from "./index.module.less";
|
|
8
|
+
// const inOnline = process.env.NODE_TYPE === "online";
|
|
8
9
|
import { CustomAiIcon, CustomRecord, CustomFullScreen, CustomExitFullScreen, CustomReloading, CustomCopy, CustomLike, CustomDislike, CustomQuote, CustomSending, CustomContacts, CustomDuihao, CustomSoundRecording, CustomRoundClose } from "../icons/index";
|
|
9
10
|
import { CloseOutlined } from "@ant-design/icons";
|
|
10
11
|
import HistoryFun from "./historyFun/index";
|
|
11
12
|
import ContactsList from "./contactsList/index";
|
|
12
|
-
|
|
13
|
-
import dayjs from "dayjs";
|
|
13
|
+
import { parseDate } from "../utils/Date";
|
|
14
14
|
import { Remarkable } from "remarkable";
|
|
15
15
|
import hljs from "highlight.js";
|
|
16
16
|
import "highlight.js/styles/default.css";
|
|
@@ -22,7 +22,6 @@ import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
|
22
22
|
import { readMessage, getByteLen, serverUrl, copyText, getDataTime } from "./function"; //一些方法
|
|
23
23
|
var CustomerService = function(props) {
|
|
24
24
|
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;
|
|
25
|
-
// urllocation = "/zhong";
|
|
26
25
|
var _useState = _sliced_to_array(useState(props.userData.mid), 2), mid = _useState[0], setmid = _useState[1]; //当前用户id
|
|
27
26
|
var _useMediaRecorder = useMediaRecorder(), bese64String = _useMediaRecorder.bese64String, startRecord = _useMediaRecorder.startRecord, stopRecord = _useMediaRecorder.stopRecord; //语音转文字
|
|
28
27
|
var _useState1 = _sliced_to_array(useState(3), 2), voiceRecordingStatus = _useState1[0], setVoiceRecordingStatus = _useState1[1]; //语音录制状态 3,语音识别完成 2,录制中, 1,录制结束
|
|
@@ -35,26 +34,30 @@ var CustomerService = function(props) {
|
|
|
35
34
|
var _useState8 = _sliced_to_array(useState([]), 2), hotQuestionsList = _useState8[0], setHotQuestionsList = _useState8[1]; //热门问题
|
|
36
35
|
var _useState9 = _sliced_to_array(useState(false), 2), greetingMessage = _useState9[0], setGreetingMessage = _useState9[1]; //聊天记录列表是否请求完成
|
|
37
36
|
var _useState10 = _sliced_to_array(useState(1), 2), pageNum = _useState10[0], setPageNum = _useState10[1]; //页码
|
|
38
|
-
var _useState11 = _sliced_to_array(useState(0), 2),
|
|
39
|
-
var _useState12 = _sliced_to_array(useState(
|
|
40
|
-
var _useState13 = _sliced_to_array(useState(
|
|
41
|
-
var _useState14 = _sliced_to_array(useState(
|
|
42
|
-
var _useState15 = _sliced_to_array(useState(
|
|
43
|
-
var _useState16 = _sliced_to_array(useState(
|
|
44
|
-
var _useState17 = _sliced_to_array(useState(
|
|
45
|
-
var _useState18 = _sliced_to_array(useState(false), 2),
|
|
46
|
-
var _useState19 = _sliced_to_array(useState(
|
|
47
|
-
var _useState20 = _sliced_to_array(useState(
|
|
48
|
-
var _useState21 = _sliced_to_array(useState(
|
|
49
|
-
var _useState22 = _sliced_to_array(useState(
|
|
50
|
-
var _useState23 = _sliced_to_array(useState(
|
|
51
|
-
var _useState24 = _sliced_to_array(useState([]), 2),
|
|
52
|
-
var _useState25 = _sliced_to_array(useState(
|
|
37
|
+
var _useState11 = _sliced_to_array(useState(0), 2), pageNumHistory = _useState11[0], setPageNumHistory = _useState11[1]; //用于搜索历史记录后的页码
|
|
38
|
+
var _useState12 = _sliced_to_array(useState(0), 2), pageCount = _useState12[0], setPageCount = _useState12[1]; //总页数
|
|
39
|
+
var _useState13 = _sliced_to_array(useState(false), 2), loading = _useState13[0], setLoading = _useState13[1]; //上拉显示加载图标
|
|
40
|
+
var _useState14 = _sliced_to_array(useState(false), 2), bottomLoading = _useState14[0], setBottomLoading = _useState14[1]; //下拉显示加载图标
|
|
41
|
+
var _useState15 = _sliced_to_array(useState(true), 2), finished = _useState15[0], setFinished = _useState15[1]; //是否结束生成
|
|
42
|
+
var _useState16 = _sliced_to_array(useState(""), 2), lastId = _useState16[0], setLastId = _useState16[1]; //最后一条数据的id,可用于定位当前位置
|
|
43
|
+
var _useState17 = _sliced_to_array(useState({}), 2), chatWith = _useState17[0], setChatWith = _useState17[1]; //聊天的老师id或ai
|
|
44
|
+
var _useState18 = _sliced_to_array(useState(false), 2), firstLoad = _useState18[0], setFirstLoad = _useState18[1]; //第一次切换全屏时滚动到页面底部
|
|
45
|
+
var _useState19 = _sliced_to_array(useState(45), 2), buttomHei = _useState19[0], setButtomHei = _useState19[1]; //底部输入框的高度
|
|
46
|
+
var _useState20 = _sliced_to_array(useState(false), 2), showHistory = _useState20[0], setShowHistory = _useState20[1]; //是否显示历史记录
|
|
47
|
+
var _useState21 = _sliced_to_array(useState(false), 2), showContacts = _useState21[0], setShowContacts = _useState21[1]; //是否显示关联老师
|
|
48
|
+
var _useState22 = _sliced_to_array(useState(-1), 2), showType = _useState22[0], setShowType = _useState22[1]; //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
|
|
49
|
+
var _useState23 = _sliced_to_array(useState(-1), 2), answerMode = _useState23[0], setAnswerMode = _useState23[1]; //设置回答模式。1,召唤老师回答
|
|
50
|
+
var _useState24 = _sliced_to_array(useState([]), 2), teacherList = _useState24[0], setTeacherList = _useState24[1]; //老师列表
|
|
51
|
+
var _useState25 = _sliced_to_array(useState({}), 2), problem = _useState25[0], setProblem = _useState25[1]; //召唤老师回答的问题
|
|
52
|
+
var _useState26 = _sliced_to_array(useState([]), 2), roomList = _useState26[0], setRoomList = _useState26[1]; //聊天列表
|
|
53
|
+
var _useState27 = _sliced_to_array(useState([]), 2), chatObj = _useState27[0], setChatObj = _useState27[1]; //聊天记录id保存,用来在实验报告中记录
|
|
53
54
|
var timer = useRef(null); //文本框输入时
|
|
54
55
|
var receiveMessageTimer = useRef(null); //接收ai发回的消息
|
|
55
56
|
var voiceCountdownTimer = useRef(null); //语音录制倒计时
|
|
56
57
|
var listTimer = useRef(null); // 请求列表倒计时
|
|
58
|
+
var roomMessage = useRef(null); //循环当前页面的新消息
|
|
57
59
|
var ctrl = useRef(); //停止生成ai回答时使用
|
|
60
|
+
var childRef = useRef(null); //获取子组件方法
|
|
58
61
|
var remarkable = new Remarkable({
|
|
59
62
|
highlight: function highlight(str, lang) {
|
|
60
63
|
if (lang && hljs.getLanguage(lang)) {
|
|
@@ -74,6 +77,7 @@ var CustomerService = function(props) {
|
|
|
74
77
|
clearTimeout(voiceCountdownTimer.current);
|
|
75
78
|
clearTimeout(listTimer.current);
|
|
76
79
|
clearTimeout(timer.current);
|
|
80
|
+
clearTimeout(roomMessage.current);
|
|
77
81
|
};
|
|
78
82
|
}, []);
|
|
79
83
|
useEffect(function() {
|
|
@@ -86,15 +90,18 @@ var CustomerService = function(props) {
|
|
|
86
90
|
//元素内部页面滚动到达底部
|
|
87
91
|
if (e.target.clientHeight + e.target.scrollTop >= e.target.scrollHeight) {
|
|
88
92
|
//console.log('元素内部页面滚动到达底部');
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
if (pageNumHistory > 1) {
|
|
94
|
+
console.log(pageNumHistory, "pageNumpageNumpageNum");
|
|
95
|
+
var number = pageNumHistory - 1;
|
|
96
|
+
// setPageNum((pageNum) => {
|
|
97
|
+
// return pageNum - 1;
|
|
98
|
+
// });
|
|
99
|
+
setPageNumHistory(number);
|
|
94
100
|
clearTimeout(listTimer.current);
|
|
101
|
+
setBottomLoading(true);
|
|
95
102
|
listTimer.current = setTimeout(function() {
|
|
96
103
|
console.log("加载下一页", number);
|
|
97
|
-
getHistoryMessage(number,
|
|
104
|
+
getHistoryMessage(number, 4);
|
|
98
105
|
}, 1000);
|
|
99
106
|
}
|
|
100
107
|
}
|
|
@@ -107,13 +114,12 @@ var CustomerService = function(props) {
|
|
|
107
114
|
});
|
|
108
115
|
clearTimeout(listTimer.current);
|
|
109
116
|
listTimer.current = setTimeout(function() {
|
|
110
|
-
console.log("
|
|
111
|
-
getHistoryMessage(number,
|
|
117
|
+
console.log("下拉加载下一页", number);
|
|
118
|
+
getHistoryMessage(number, 2);
|
|
112
119
|
}, 1000);
|
|
113
120
|
}
|
|
114
121
|
};
|
|
115
|
-
|
|
116
|
-
if (showType == 2 && !firstLoad && pageCount > 0) {
|
|
122
|
+
if (showType != 1 && !firstLoad && pageCount > 0) {
|
|
117
123
|
setFirstLoad(true);
|
|
118
124
|
setTimeout(function() {
|
|
119
125
|
scrollToBottom();
|
|
@@ -141,9 +147,9 @@ var CustomerService = function(props) {
|
|
|
141
147
|
if (showType == 1) {
|
|
142
148
|
dom.style.maxHeight = "".concat(window.innerHeight - 60 - buttomHei, "px");
|
|
143
149
|
} else if (showType == 3) {
|
|
144
|
-
dom.style.maxHeight = "".concat(window.innerHeight -
|
|
150
|
+
dom.style.maxHeight = "".concat(window.innerHeight - 114 - buttomHei, "px");
|
|
145
151
|
} else {
|
|
146
|
-
dom.style.maxHeight = "".concat(window.innerHeight - 160 -
|
|
152
|
+
dom.style.maxHeight = "".concat(window.innerHeight - 160 - 62 - buttomHei, "px");
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
155
|
}, [
|
|
@@ -151,12 +157,10 @@ var CustomerService = function(props) {
|
|
|
151
157
|
showType
|
|
152
158
|
]);
|
|
153
159
|
useEffect(function() {
|
|
154
|
-
console.log(props,
|
|
160
|
+
// console.log(props,'lsdkcmsdlcksd')
|
|
155
161
|
getQuestiionsList("", 1);
|
|
156
162
|
scrollToBottom();
|
|
157
|
-
//
|
|
158
|
-
// console.log("9999999", less);
|
|
159
|
-
// getRoomList();
|
|
163
|
+
// less.modifyVars({ "@color-border-Tr": "#f4523b" });
|
|
160
164
|
setShowType(initShowType);
|
|
161
165
|
}, [
|
|
162
166
|
initShowType
|
|
@@ -164,40 +168,33 @@ var CustomerService = function(props) {
|
|
|
164
168
|
useEffect(function() {
|
|
165
169
|
// console.log(roomId,1111111)
|
|
166
170
|
if (roomId != "") {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
+
if (lastId == "") {
|
|
172
|
+
getHistoryMessage(pageNum, 2);
|
|
173
|
+
} else {
|
|
174
|
+
//查看历史记录,需要定位到当前记录
|
|
175
|
+
getHistoryMessage(pageNum, 1);
|
|
176
|
+
}
|
|
171
177
|
}
|
|
172
178
|
}, [
|
|
173
179
|
roomId
|
|
174
180
|
]);
|
|
175
181
|
useEffect(function() {
|
|
176
|
-
|
|
177
|
-
if (roomList.length > 0) {
|
|
178
|
-
//切换到有聊天的窗口
|
|
179
|
-
var message = roomList.filter(function(item) {
|
|
180
|
-
return item.unreadCount > 0;
|
|
181
|
-
});
|
|
182
|
-
if (message.length > 0) {
|
|
183
|
-
setRoomId(message[0].roomId);
|
|
184
|
-
readMessage(message[0].roomId, urllocation, userData, http);
|
|
185
|
-
} else {
|
|
186
|
-
setRoomId(roomList[0].roomId);
|
|
187
|
-
}
|
|
188
|
-
} else {
|
|
182
|
+
if (roomList.length == 0) {
|
|
189
183
|
createRooms("AI").then(function(res) {
|
|
190
|
-
// console.log(res.data,'dlfkvdlkfvmdf');
|
|
191
184
|
setRoomId(res.data.id);
|
|
192
185
|
setRoomList([
|
|
193
186
|
{
|
|
194
187
|
roomId: res.data.id,
|
|
195
188
|
unreadCount: 0,
|
|
196
|
-
uid: mid
|
|
189
|
+
uid: mid,
|
|
190
|
+
sender: "AI"
|
|
197
191
|
}
|
|
198
192
|
]);
|
|
199
193
|
});
|
|
194
|
+
} else {
|
|
195
|
+
setRoomList(roomList);
|
|
200
196
|
}
|
|
197
|
+
// recordRef.current.roomList=JSON.parse(JSON.stringify(roomList))
|
|
201
198
|
}, [
|
|
202
199
|
roomList
|
|
203
200
|
]);
|
|
@@ -214,7 +211,12 @@ var CustomerService = function(props) {
|
|
|
214
211
|
if (historyMessageList[historyMessageList.length - 1].extraInfo == null) {
|
|
215
212
|
sendGreetingMessage(1);
|
|
216
213
|
} 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")) {
|
|
217
|
-
console.log(
|
|
214
|
+
// console.log(
|
|
215
|
+
// JSON.parse(
|
|
216
|
+
// historyMessageList[historyMessageList.length - 1].extraInfo,
|
|
217
|
+
// "sdklsdksd"
|
|
218
|
+
// )
|
|
219
|
+
// );
|
|
218
220
|
sendGreetingMessage(1);
|
|
219
221
|
}
|
|
220
222
|
} catch (error) {}
|
|
@@ -379,6 +381,7 @@ var CustomerService = function(props) {
|
|
|
379
381
|
recevier: chatWith.uid,
|
|
380
382
|
message: problem.question
|
|
381
383
|
};
|
|
384
|
+
setProblem({});
|
|
382
385
|
} else if (type == 2) {
|
|
383
386
|
var list = roomList.filter(function(item) {
|
|
384
387
|
return item.roomId == roomId;
|
|
@@ -391,7 +394,8 @@ var CustomerService = function(props) {
|
|
|
391
394
|
roomId: roomId,
|
|
392
395
|
sender: mid,
|
|
393
396
|
recevier: recevier,
|
|
394
|
-
message: keyWord
|
|
397
|
+
message: keyWord,
|
|
398
|
+
quotedMessage: citationContent.content || ""
|
|
395
399
|
};
|
|
396
400
|
}
|
|
397
401
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj, {
|
|
@@ -408,16 +412,17 @@ var CustomerService = function(props) {
|
|
|
408
412
|
id: res.data.id,
|
|
409
413
|
upvoted: false,
|
|
410
414
|
downvoted: false,
|
|
411
|
-
quotedMessage: "",
|
|
412
415
|
createdAt: getDataTime(-1)
|
|
413
416
|
}));
|
|
414
417
|
return newHistoryMessageList;
|
|
415
418
|
});
|
|
416
419
|
scrollToBottom();
|
|
417
420
|
//记录一个问题id,用于记录老师和学生之间的聊天保存到实验报告中
|
|
418
|
-
if
|
|
419
|
-
|
|
420
|
-
|
|
421
|
+
// if(stepIds != undefined && stepIds != '' && (showType == 3 || showType == 4)){
|
|
422
|
+
// setChatObj({'roomId':roomId,'id':res.data.id});
|
|
423
|
+
//判断当前窗口是否是
|
|
424
|
+
if (type == 1) {
|
|
425
|
+
var roomList = [
|
|
421
426
|
{
|
|
422
427
|
"roomId": roomId,
|
|
423
428
|
"id": res.data.id
|
|
@@ -425,11 +430,12 @@ var CustomerService = function(props) {
|
|
|
425
430
|
];
|
|
426
431
|
setChatObj(function(list) {
|
|
427
432
|
var list2 = list.filter(function(item) {
|
|
428
|
-
return item.id !=
|
|
433
|
+
return item.id != roomList[0].id;
|
|
429
434
|
});
|
|
430
|
-
return list2.concat(
|
|
435
|
+
return list2.concat(roomList);
|
|
431
436
|
});
|
|
432
437
|
}
|
|
438
|
+
// }
|
|
433
439
|
}
|
|
434
440
|
}).catch(function(err) {
|
|
435
441
|
console.log(err);
|
|
@@ -754,7 +760,6 @@ var CustomerService = function(props) {
|
|
|
754
760
|
}
|
|
755
761
|
if (msg.finished) {
|
|
756
762
|
setFinished(true); //发送结束
|
|
757
|
-
console.log(content, JSON.parse(data), "sdklcksdlcms");
|
|
758
763
|
testLabQuestion(JSON.parse(data).message, content, "");
|
|
759
764
|
}
|
|
760
765
|
},
|
|
@@ -828,7 +833,7 @@ var CustomerService = function(props) {
|
|
|
828
833
|
};
|
|
829
834
|
//问题记录到实验报告中
|
|
830
835
|
var testLabQuestion = function(title, content, teachId) {
|
|
831
|
-
console.log(title,
|
|
836
|
+
// console.log(title,content,'记录到实验报告中')
|
|
832
837
|
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
|
|
833
838
|
http.post("".concat(urllocation, "/sandboxes/public/v1.0/labquestion"), {
|
|
834
839
|
title: title,
|
|
@@ -843,6 +848,14 @@ var CustomerService = function(props) {
|
|
|
843
848
|
}).id,
|
|
844
849
|
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
845
850
|
}
|
|
851
|
+
}).then(function() {
|
|
852
|
+
console.log(roomId, chatObj, "roomIdroomIdroomIdroomId");
|
|
853
|
+
setChatObj(function(list1) {
|
|
854
|
+
var list = list1.filter(function(e) {
|
|
855
|
+
return e.roomId != roomId;
|
|
856
|
+
});
|
|
857
|
+
return list;
|
|
858
|
+
});
|
|
846
859
|
});
|
|
847
860
|
}
|
|
848
861
|
};
|
|
@@ -881,14 +894,28 @@ var CustomerService = function(props) {
|
|
|
881
894
|
}
|
|
882
895
|
});
|
|
883
896
|
};
|
|
884
|
-
//获取历史消息 flag:1,历史记录点击定位,2
|
|
897
|
+
//获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
|
|
885
898
|
var getHistoryMessage = function(pageNum, flag) {
|
|
886
|
-
|
|
887
|
-
|
|
899
|
+
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1";
|
|
900
|
+
clearTimeout(roomMessage.current);
|
|
901
|
+
// flag == 1 时已经设置好了位置标记
|
|
902
|
+
var last_id = "";
|
|
903
|
+
if (flag == 2 && historyMessageList.length > 0) {
|
|
904
|
+
last_id = historyMessageList[0].id;
|
|
905
|
+
}
|
|
906
|
+
if (flag != 1 && last_id != "") {
|
|
907
|
+
setLastId(last_id);
|
|
908
|
+
}
|
|
909
|
+
//取消搜索页码标记
|
|
910
|
+
if (flag == 4 && pageNum == 1) {
|
|
911
|
+
setPageNumHistory(0);
|
|
912
|
+
}
|
|
913
|
+
var rid = flag == 3 ? id : roomId;
|
|
914
|
+
if (rid == "") return;
|
|
888
915
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
889
916
|
params: {
|
|
890
|
-
roomId:
|
|
891
|
-
page: pageNum
|
|
917
|
+
roomId: rid,
|
|
918
|
+
page: pageNum ? pageNum : 1,
|
|
892
919
|
maxPageSize: 30,
|
|
893
920
|
direction: "desc"
|
|
894
921
|
},
|
|
@@ -899,137 +926,190 @@ var CustomerService = function(props) {
|
|
|
899
926
|
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
900
927
|
}
|
|
901
928
|
}).then(function(res) {
|
|
929
|
+
var totalNumber = 0;
|
|
930
|
+
var roomList = [];
|
|
931
|
+
setRoomList(function(list) {
|
|
932
|
+
roomList = list;
|
|
933
|
+
return list;
|
|
934
|
+
});
|
|
902
935
|
if (res.data.messages.length > 0) {
|
|
903
936
|
clearTimeout(listTimer.current);
|
|
904
|
-
var last_id = "";
|
|
905
937
|
var total = res.data.total;
|
|
906
938
|
var maxPageSize = 30;
|
|
907
939
|
var dataList = res.data.messages.reverse();
|
|
908
940
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
909
941
|
var newHistoryMessageList = [];
|
|
910
942
|
setHistoryMessageList(function(historyMessageList) {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
943
|
+
//获取历史消息 flag:1,历史记录点击定位,2,代表是下拉加载,3,存在新的消息-->老师回答等
|
|
944
|
+
newHistoryMessageList = [];
|
|
945
|
+
if (flag == 1) {
|
|
946
|
+
newHistoryMessageList = dataList;
|
|
947
|
+
}
|
|
948
|
+
if (flag == 4) {
|
|
949
|
+
newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
|
|
950
|
+
}
|
|
951
|
+
if (flag == 2) {
|
|
952
|
+
if (pageNum == 1) {
|
|
953
|
+
newHistoryMessageList = dataList;
|
|
914
954
|
} else {
|
|
915
|
-
|
|
955
|
+
newHistoryMessageList = dataList.concat(historyMessageList);
|
|
916
956
|
}
|
|
917
957
|
}
|
|
918
|
-
|
|
919
|
-
//查找历史记录flag==1
|
|
920
|
-
if (pageNum == 1 || flag == 1 || flag == 3) {
|
|
958
|
+
if (flag == 3) {
|
|
921
959
|
newHistoryMessageList = dataList;
|
|
922
|
-
} else if (flag == 2) {
|
|
923
|
-
//下拉加载
|
|
924
|
-
newHistoryMessageList = historyMessageList.concat(dataList);
|
|
925
|
-
} else {
|
|
926
|
-
newHistoryMessageList = dataList.concat(historyMessageList);
|
|
927
960
|
}
|
|
961
|
+
//去重
|
|
928
962
|
var _$res = new Map();
|
|
929
963
|
newHistoryMessageList = newHistoryMessageList.filter(function(a) {
|
|
930
964
|
return !_$res.has(a.id) && _$res.set(a.id, 1);
|
|
931
965
|
});
|
|
966
|
+
totalNumber = newHistoryMessageList.length;
|
|
932
967
|
return newHistoryMessageList;
|
|
933
968
|
});
|
|
934
969
|
//如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
|
|
935
970
|
try {
|
|
936
|
-
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)
|
|
971
|
+
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
|
|
937
972
|
fildChatRecords(newHistoryMessageList);
|
|
938
973
|
}
|
|
939
974
|
} catch (error) {}
|
|
940
|
-
if (flag !=
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
console.log("滚动到相应为止3333");
|
|
947
|
-
scrollTo("li_flag");
|
|
975
|
+
if (flag != 4) {
|
|
976
|
+
if (pageNum == 1 && (flag == 2 || flag == 3)) {
|
|
977
|
+
scrollToBottom();
|
|
978
|
+
} else {
|
|
979
|
+
scrollTo("li_flag");
|
|
980
|
+
}
|
|
948
981
|
}
|
|
982
|
+
setBottomLoading(false);
|
|
983
|
+
setLoading(false);
|
|
949
984
|
setGreetingMessage(true);
|
|
950
985
|
//召唤老师回答
|
|
951
|
-
console.log(problem, 8888888);
|
|
952
986
|
if (problem != undefined && problem.user != undefined && problem.question != undefined) {
|
|
953
|
-
console.log(problem, 77777);
|
|
954
987
|
sendToTeacher(1);
|
|
955
988
|
}
|
|
956
989
|
} else {
|
|
957
990
|
setPageCount(0);
|
|
958
991
|
setGreetingMessage(true);
|
|
992
|
+
setBottomLoading(false);
|
|
959
993
|
setLoading(false);
|
|
960
994
|
setHistoryMessageList([]);
|
|
961
995
|
//召唤老师回答
|
|
962
|
-
console.log(problem, 8888888);
|
|
963
996
|
if (problem != undefined && problem.user != undefined && problem.question != undefined) {
|
|
964
|
-
console.log(problem, 77777);
|
|
965
997
|
sendToTeacher(1);
|
|
966
998
|
}
|
|
967
999
|
}
|
|
1000
|
+
// console.log(roomList,rid,roomId,555555);
|
|
1001
|
+
//不是ai窗口循环查询消息
|
|
1002
|
+
var chatWindow = roomList.filter(function(item) {
|
|
1003
|
+
return item.roomId == rid;
|
|
1004
|
+
});
|
|
1005
|
+
var isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
1006
|
+
if (!isAiChatWindow && roomList.length > 0) {
|
|
1007
|
+
getRoomidHistoryMessage(totalNumber, rid);
|
|
1008
|
+
}
|
|
968
1009
|
}).catch(function(res) {
|
|
969
1010
|
setLoading(false);
|
|
970
1011
|
});
|
|
971
1012
|
};
|
|
1013
|
+
//用于循环新消息
|
|
1014
|
+
var getRoomidHistoryMessage = function(totalNumber, rid) {
|
|
1015
|
+
clearTimeout(roomMessage.current);
|
|
1016
|
+
roomMessage.current = setTimeout(function() {
|
|
1017
|
+
getRoomidHistoryMessage(totalNumber, rid);
|
|
1018
|
+
}, 5000);
|
|
1019
|
+
if (rid == "") return;
|
|
1020
|
+
// console.log(roomList,2222222);
|
|
1021
|
+
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
1022
|
+
params: {
|
|
1023
|
+
roomId: rid,
|
|
1024
|
+
page: 1,
|
|
1025
|
+
maxPageSize: totalNumber < 30 ? 30 : totalNumber + 10,
|
|
1026
|
+
direction: "desc"
|
|
1027
|
+
},
|
|
1028
|
+
headers: {
|
|
1029
|
+
"x-module-id": userData.modules.find(function(ele) {
|
|
1030
|
+
return ele.short == "IntelligentCustomerService";
|
|
1031
|
+
}).id,
|
|
1032
|
+
"x-auth-jwt": window.localStorage.getItem("usertoken") || ""
|
|
1033
|
+
}
|
|
1034
|
+
}).then(function(res) {
|
|
1035
|
+
var newHistoryMessageList = [];
|
|
1036
|
+
if (res.data.messages.length > 0) {
|
|
1037
|
+
var dataList = res.data.messages.reverse();
|
|
1038
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
1039
|
+
newHistoryMessageList = dataList;
|
|
1040
|
+
//去重
|
|
1041
|
+
var _$res = new Map();
|
|
1042
|
+
newHistoryMessageList = newHistoryMessageList.filter(function(a) {
|
|
1043
|
+
return !_$res.has(a.id) && _$res.set(a.id, 1);
|
|
1044
|
+
});
|
|
1045
|
+
return newHistoryMessageList;
|
|
1046
|
+
});
|
|
1047
|
+
if (dataList.length > totalNumber) {
|
|
1048
|
+
scrollToBottom();
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
try {
|
|
1052
|
+
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
|
|
1053
|
+
fildChatRecords(newHistoryMessageList);
|
|
1054
|
+
}
|
|
1055
|
+
} catch (error) {}
|
|
1056
|
+
});
|
|
1057
|
+
};
|
|
972
1058
|
//在聊天对话框中查找需要记录的问题及答案
|
|
973
1059
|
var fildChatRecords = function(newHistoryMessageList) {
|
|
974
1060
|
//1、找到对应的聊天室
|
|
975
1061
|
//2、找到与老师对话的新聊天
|
|
976
1062
|
//3、保存聊天到实验报告
|
|
977
|
-
console.log(
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
var roomIDnumber = room[0].roomId;
|
|
984
|
-
var chatID = room[0].id;
|
|
985
|
-
var index = -1;
|
|
986
|
-
newHistoryMessageList.forEach(function(item, i) {
|
|
987
|
-
console.log(item, item.id, "lskdcmsldksdcsdc");
|
|
988
|
-
if (item.id == chatID) {
|
|
989
|
-
index = i;
|
|
990
|
-
return false;
|
|
991
|
-
}
|
|
1063
|
+
// console.log('查找聊天111',chatObj,newHistoryMessageList);
|
|
1064
|
+
try {
|
|
1065
|
+
var chatObj = [];
|
|
1066
|
+
setChatObj(function(item) {
|
|
1067
|
+
chatObj = item;
|
|
1068
|
+
return item;
|
|
992
1069
|
});
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
var
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
if (item.sender == mid) {
|
|
1008
|
-
obj.title = item.message;
|
|
1009
|
-
position = i;
|
|
1010
|
-
}
|
|
1011
|
-
if (item.sender != mid) {
|
|
1012
|
-
obj.con = item.message;
|
|
1013
|
-
obj.teachId = item.receiver;
|
|
1070
|
+
// console.log(chatObj,555555);
|
|
1071
|
+
var room = chatObj.filter(function(item) {
|
|
1072
|
+
return item.roomId == roomId;
|
|
1073
|
+
});
|
|
1074
|
+
if (room.length > 0) {
|
|
1075
|
+
// console.log(room,'dfvdfvdfvdfv')
|
|
1076
|
+
var chatID = room[0].id;
|
|
1077
|
+
console.log(chatID, "chatIDchatIDchatID");
|
|
1078
|
+
var index = -1;
|
|
1079
|
+
newHistoryMessageList.forEach(function(item, i) {
|
|
1080
|
+
// console.log(item,item.id,'lskdcmsldksdcsdc')
|
|
1081
|
+
if (item.id == chatID) {
|
|
1082
|
+
index = i;
|
|
1083
|
+
return false;
|
|
1014
1084
|
}
|
|
1015
1085
|
});
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1086
|
+
//有新的消息
|
|
1087
|
+
if (index != -1) {
|
|
1088
|
+
var newMessage = newHistoryMessageList.slice(index);
|
|
1089
|
+
console.log(newMessage, "newMessagenewMessage");
|
|
1090
|
+
var result = [];
|
|
1091
|
+
newMessage.forEach(function(item, index) {
|
|
1092
|
+
var isQuestion = item.receiver !== mid //是否为问题
|
|
1093
|
+
;
|
|
1094
|
+
if (isQuestion) {
|
|
1095
|
+
//问题
|
|
1096
|
+
if (newMessage[index + 1] && newMessage[index + 1].receiver === mid) {
|
|
1097
|
+
result.push({
|
|
1098
|
+
question: item.message,
|
|
1099
|
+
id: item.receiver,
|
|
1100
|
+
answer: newMessage[index + 1].message
|
|
1101
|
+
});
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1028
1105
|
});
|
|
1029
|
-
|
|
1030
|
-
|
|
1106
|
+
console.log(result, "存储的消息");
|
|
1107
|
+
result.map(function(item) {
|
|
1108
|
+
testLabQuestion(item.question, item.answer, item.id);
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1031
1111
|
}
|
|
1032
|
-
}
|
|
1112
|
+
} catch (error) {}
|
|
1033
1113
|
};
|
|
1034
1114
|
//点赞消息
|
|
1035
1115
|
var likeMessage = function(id, state) {
|
|
@@ -1147,29 +1227,24 @@ var CustomerService = function(props) {
|
|
|
1147
1227
|
};
|
|
1148
1228
|
//设置滚动条滚动到底部
|
|
1149
1229
|
var scrollToBottom = function() {
|
|
1150
|
-
console.log("滚动条滚动到底部");
|
|
1151
1230
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1152
1231
|
if (container) {
|
|
1153
1232
|
container.scrollTop = container.scrollHeight;
|
|
1154
1233
|
}
|
|
1155
1234
|
};
|
|
1156
1235
|
var scrollTo = function(id) {
|
|
1157
|
-
console.log(id, "滚动到指定位置");
|
|
1158
1236
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1159
1237
|
var container2 = document.getElementById(id);
|
|
1160
|
-
// clearTimeout(listTimer.current)
|
|
1161
1238
|
if (container && container2) {
|
|
1162
|
-
// container.scrollTop = container2.scrollHeight;
|
|
1163
|
-
// if(container2.scrollTop == 0){
|
|
1164
1239
|
container.scrollTop = 60;
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1240
|
+
try {
|
|
1241
|
+
setTimeout(function() {
|
|
1242
|
+
var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
|
|
1243
|
+
$("#".concat(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal")).animate({
|
|
1244
|
+
scrollTop: top
|
|
1245
|
+
}, 0);
|
|
1246
|
+
}, 10);
|
|
1247
|
+
} catch (error) {}
|
|
1173
1248
|
setLoading(false);
|
|
1174
1249
|
}
|
|
1175
1250
|
};
|
|
@@ -1190,6 +1265,17 @@ var CustomerService = function(props) {
|
|
|
1190
1265
|
};
|
|
1191
1266
|
//渲染头部
|
|
1192
1267
|
var renderHeader = function() {
|
|
1268
|
+
var list = roomList.filter(function(e) {
|
|
1269
|
+
return e.roomId == roomId;
|
|
1270
|
+
});
|
|
1271
|
+
var title = "智能回答";
|
|
1272
|
+
if (list.length > 0 && list[0].name) {
|
|
1273
|
+
title = list[0].name;
|
|
1274
|
+
}
|
|
1275
|
+
var count = 0;
|
|
1276
|
+
roomList.map(function(item) {
|
|
1277
|
+
count = count + item.unreadCount;
|
|
1278
|
+
});
|
|
1193
1279
|
if (showType == 4) {
|
|
1194
1280
|
return /*#__PURE__*/ _jsxs("div", {
|
|
1195
1281
|
className: styles.top,
|
|
@@ -1197,7 +1283,7 @@ var CustomerService = function(props) {
|
|
|
1197
1283
|
/*#__PURE__*/ _jsx("div", {
|
|
1198
1284
|
className: styles.user,
|
|
1199
1285
|
children: /*#__PURE__*/ _jsx("p", {
|
|
1200
|
-
children:
|
|
1286
|
+
children: title
|
|
1201
1287
|
})
|
|
1202
1288
|
}),
|
|
1203
1289
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -1215,6 +1301,7 @@ var CustomerService = function(props) {
|
|
|
1215
1301
|
/*#__PURE__*/ _jsx("i", {
|
|
1216
1302
|
onClick: function() {
|
|
1217
1303
|
onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
|
|
1304
|
+
setFirstLoad(false); //重启滚动条在最上方
|
|
1218
1305
|
setShowType(3);
|
|
1219
1306
|
},
|
|
1220
1307
|
children: /*#__PURE__*/ _jsx(CustomExitFullScreen, {})
|
|
@@ -1223,6 +1310,7 @@ var CustomerService = function(props) {
|
|
|
1223
1310
|
onClick: function() {
|
|
1224
1311
|
onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
|
|
1225
1312
|
setShowType(3);
|
|
1313
|
+
setFirstLoad(false); //重启滚动条在最上方
|
|
1226
1314
|
},
|
|
1227
1315
|
children: /*#__PURE__*/ _jsx(CloseOutlined, {})
|
|
1228
1316
|
})
|
|
@@ -1230,46 +1318,6 @@ var CustomerService = function(props) {
|
|
|
1230
1318
|
})
|
|
1231
1319
|
]
|
|
1232
1320
|
});
|
|
1233
|
-
} else if (showType == 3) {
|
|
1234
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
1235
|
-
className: styles.top,
|
|
1236
|
-
children: [
|
|
1237
|
-
/*#__PURE__*/ _jsx("div", {
|
|
1238
|
-
className: styles.user,
|
|
1239
|
-
children: /*#__PURE__*/ _jsx("p", {
|
|
1240
|
-
children: "智能回答"
|
|
1241
|
-
})
|
|
1242
|
-
}),
|
|
1243
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
1244
|
-
className: styles.operate,
|
|
1245
|
-
children: [
|
|
1246
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1247
|
-
onClick: function() {
|
|
1248
|
-
setShowHistory(true);
|
|
1249
|
-
},
|
|
1250
|
-
children: /*#__PURE__*/ _jsx(CustomRecord, {})
|
|
1251
|
-
}),
|
|
1252
|
-
/*#__PURE__*/ _jsx("span", {
|
|
1253
|
-
className: styles.line
|
|
1254
|
-
}),
|
|
1255
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1256
|
-
onClick: function() {
|
|
1257
|
-
onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
|
|
1258
|
-
setShowType(4);
|
|
1259
|
-
},
|
|
1260
|
-
children: /*#__PURE__*/ _jsx(CustomExitFullScreen, {})
|
|
1261
|
-
}),
|
|
1262
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1263
|
-
className: "lianxiren21",
|
|
1264
|
-
onClick: function() {
|
|
1265
|
-
setShowContacts(true);
|
|
1266
|
-
},
|
|
1267
|
-
children: /*#__PURE__*/ _jsx(CustomContacts, {})
|
|
1268
|
-
})
|
|
1269
|
-
]
|
|
1270
|
-
})
|
|
1271
|
-
]
|
|
1272
|
-
});
|
|
1273
1321
|
} else {
|
|
1274
1322
|
return /*#__PURE__*/ _jsxs("div", {
|
|
1275
1323
|
className: styles.top,
|
|
@@ -1278,14 +1326,20 @@ var CustomerService = function(props) {
|
|
|
1278
1326
|
className: styles.user,
|
|
1279
1327
|
children: /*#__PURE__*/ _jsxs("p", {
|
|
1280
1328
|
children: [
|
|
1281
|
-
showType == 1 && /*#__PURE__*/
|
|
1329
|
+
showType == 1 && /*#__PURE__*/ _jsxs("i", {
|
|
1282
1330
|
className: "lianxiren21",
|
|
1283
1331
|
onClick: function() {
|
|
1284
1332
|
setShowContacts(true);
|
|
1285
1333
|
},
|
|
1286
|
-
children:
|
|
1334
|
+
children: [
|
|
1335
|
+
/*#__PURE__*/ _jsx(CustomContacts, {}),
|
|
1336
|
+
count > 0 ? /*#__PURE__*/ _jsx("span", {
|
|
1337
|
+
className: styles.count,
|
|
1338
|
+
children: count > 99 ? "99+" : count
|
|
1339
|
+
}) : ""
|
|
1340
|
+
]
|
|
1287
1341
|
}),
|
|
1288
|
-
|
|
1342
|
+
title
|
|
1289
1343
|
]
|
|
1290
1344
|
})
|
|
1291
1345
|
}),
|
|
@@ -1307,6 +1361,7 @@ var CustomerService = function(props) {
|
|
|
1307
1361
|
onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
|
|
1308
1362
|
// switchDialogBox(3, true);
|
|
1309
1363
|
setShowType(2);
|
|
1364
|
+
childRef.current.roomsListTimer();
|
|
1310
1365
|
},
|
|
1311
1366
|
children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
|
|
1312
1367
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
@@ -1331,20 +1386,30 @@ var CustomerService = function(props) {
|
|
|
1331
1386
|
var resettingBottomHei = function() {
|
|
1332
1387
|
setTimeout(function() {
|
|
1333
1388
|
if (showType == 1 || showType == 3) {
|
|
1334
|
-
|
|
1335
|
-
|
|
1389
|
+
if (document.getElementById("Drawer_buttom_modal")) {
|
|
1390
|
+
var hei = document.getElementById("Drawer_buttom").offsetHeight;
|
|
1391
|
+
setButtomHei(hei);
|
|
1392
|
+
}
|
|
1336
1393
|
} else {
|
|
1337
|
-
|
|
1338
|
-
|
|
1394
|
+
if (document.getElementById("Drawer_buttom_modal")) {
|
|
1395
|
+
var hei1 = document.getElementById("Drawer_buttom_modal").offsetHeight;
|
|
1396
|
+
setButtomHei(hei1);
|
|
1397
|
+
}
|
|
1339
1398
|
}
|
|
1340
1399
|
}, 50);
|
|
1341
1400
|
};
|
|
1342
1401
|
//切换聊天室 type == renew ,存在新消息
|
|
1343
1402
|
var switchChatRoom = function(id, type) {
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1403
|
+
setLastId("");
|
|
1404
|
+
setPageNum(1);
|
|
1405
|
+
setPageCount(0);
|
|
1347
1406
|
setRoomId(id);
|
|
1407
|
+
//
|
|
1408
|
+
// if (type == "renew") {
|
|
1409
|
+
// getHistoryMessage(1, 3,id);
|
|
1410
|
+
// }else{
|
|
1411
|
+
// setRoomId(id);
|
|
1412
|
+
// }
|
|
1348
1413
|
readMessage(id, urllocation, userData, http);
|
|
1349
1414
|
};
|
|
1350
1415
|
var saveContactsList = function(list) {
|
|
@@ -1354,13 +1419,14 @@ var CustomerService = function(props) {
|
|
|
1354
1419
|
};
|
|
1355
1420
|
//渲染问答
|
|
1356
1421
|
var renderQuestion = function() {
|
|
1422
|
+
// 2023-12-01T14:34:07
|
|
1423
|
+
// console.log(lastId,'lastIdlastIdlastId')
|
|
1357
1424
|
// console.log(mid, historyMessageList, "ddkfdscksdcs");
|
|
1358
1425
|
if (historyMessageList.length > 0) {
|
|
1359
|
-
// let historyData = "";
|
|
1360
|
-
// let showData = true;
|
|
1361
1426
|
return /*#__PURE__*/ _jsx("ul", {
|
|
1362
1427
|
className: styles.message_con,
|
|
1363
1428
|
children: historyMessageList.map(function(item, i) {
|
|
1429
|
+
var timeObj = parseDate(item.createdAt);
|
|
1364
1430
|
// console.log(item.message);
|
|
1365
1431
|
var message = item.message;
|
|
1366
1432
|
var li;
|
|
@@ -1371,17 +1437,20 @@ var CustomerService = function(props) {
|
|
|
1371
1437
|
var time = "";
|
|
1372
1438
|
if (itemIndex <= 0) {
|
|
1373
1439
|
//第一项
|
|
1374
|
-
time =
|
|
1440
|
+
time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
1375
1441
|
} else {
|
|
1376
1442
|
//非第一项 与上一项进行对比
|
|
1377
1443
|
var beforeTime = historyMessageList[itemIndex - 1].createdAt;
|
|
1378
1444
|
//判断与上一条数据 是否跨天
|
|
1379
|
-
|
|
1380
|
-
|
|
1445
|
+
var beforeTimeObj = parseDate(beforeTime);
|
|
1446
|
+
var beforeTimeStr = "".concat(beforeTimeObj.year, "-").concat(beforeTimeObj.month, "-").concat(beforeTimeObj.day);
|
|
1447
|
+
var curTimeStr = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day);
|
|
1448
|
+
if (beforeTimeStr !== curTimeStr) {
|
|
1449
|
+
time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
1381
1450
|
} else {
|
|
1382
1451
|
//没有跨天 判断是否相隔超过10分钟
|
|
1383
|
-
if (
|
|
1384
|
-
time =
|
|
1452
|
+
if (new Date(item.createdAt).valueOf() - new Date(beforeTime).valueOf() > 10 * 60 * 1000) {
|
|
1453
|
+
time = "".concat(timeObj.minutes, ":").concat(timeObj.seconds);
|
|
1385
1454
|
}
|
|
1386
1455
|
}
|
|
1387
1456
|
}
|
|
@@ -1398,86 +1467,87 @@ var CustomerService = function(props) {
|
|
|
1398
1467
|
className: styles.left,
|
|
1399
1468
|
id: lastId == item.id ? "li_flag" : "",
|
|
1400
1469
|
children: [
|
|
1401
|
-
/*#__PURE__*/
|
|
1470
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1402
1471
|
className: styles.main,
|
|
1403
|
-
children:
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1472
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
1473
|
+
className: styles.main_content,
|
|
1474
|
+
children: [
|
|
1475
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1476
|
+
className: styles.operate_modal,
|
|
1477
|
+
children: /*#__PURE__*/ _jsxs("p", {
|
|
1478
|
+
className: styles.operate,
|
|
1479
|
+
children: [
|
|
1480
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1481
|
+
className: "yinyong_quote1",
|
|
1482
|
+
onClick: function() {
|
|
1483
|
+
setCitationContent({
|
|
1484
|
+
content: item.message,
|
|
1485
|
+
id: item.id
|
|
1486
|
+
});
|
|
1487
|
+
resettingBottomHei();
|
|
1488
|
+
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1489
|
+
},
|
|
1490
|
+
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1491
|
+
}),
|
|
1492
|
+
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
1493
|
+
return list == item.id;
|
|
1494
|
+
}) ? /*#__PURE__*/ _jsx("i", {
|
|
1495
|
+
className: "tongyong-xuanzhongdui",
|
|
1496
|
+
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1497
|
+
}) : /*#__PURE__*/ _jsx("i", {
|
|
1498
|
+
className: "fuzhi21",
|
|
1499
|
+
onClick: function() {
|
|
1500
|
+
var bol = copyText(item.message);
|
|
1501
|
+
if (bol) {
|
|
1502
|
+
var obj = copyTextOBJ;
|
|
1503
|
+
obj = obj.filter(function(list) {
|
|
1504
|
+
return list != item.id;
|
|
1505
|
+
});
|
|
1506
|
+
obj.push(item.id);
|
|
1507
|
+
setCopyTextObj(obj);
|
|
1508
|
+
}
|
|
1509
|
+
setTimeout(function() {
|
|
1510
|
+
var obj = copyTextOBJ;
|
|
1511
|
+
obj = obj.filter(function(list) {
|
|
1512
|
+
return list != item.id;
|
|
1513
|
+
});
|
|
1514
|
+
setCopyTextObj(obj);
|
|
1515
|
+
}, 3000);
|
|
1516
|
+
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1517
|
+
},
|
|
1518
|
+
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1519
|
+
})
|
|
1520
|
+
]
|
|
1521
|
+
})
|
|
1522
|
+
}),
|
|
1523
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1524
|
+
className: styles.content,
|
|
1525
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
1526
|
+
dangerouslySetInnerHTML: {
|
|
1527
|
+
__html: remarkable.render(message)
|
|
1528
|
+
},
|
|
1529
|
+
className: styles.content_child
|
|
1530
|
+
})
|
|
1531
|
+
}),
|
|
1532
|
+
//引用消息
|
|
1533
|
+
item.quotedMessage && /*#__PURE__*/ _jsx("div", {
|
|
1534
|
+
className: styles.citation_content,
|
|
1535
|
+
children: getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
1536
|
+
overlayClassName: styles.popover_main_content,
|
|
1537
|
+
title: item.quotedMessage,
|
|
1538
|
+
placement: "leftTop",
|
|
1409
1539
|
children: /*#__PURE__*/ _jsxs("p", {
|
|
1410
|
-
className: styles.operate,
|
|
1411
1540
|
children: [
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
onClick: function() {
|
|
1415
|
-
setCitationContent({
|
|
1416
|
-
content: item.message,
|
|
1417
|
-
id: item.id
|
|
1418
|
-
});
|
|
1419
|
-
resettingBottomHei();
|
|
1420
|
-
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1421
|
-
},
|
|
1422
|
-
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1423
|
-
}),
|
|
1424
|
-
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
1425
|
-
return list == item.id;
|
|
1426
|
-
}) ? /*#__PURE__*/ _jsx("i", {
|
|
1427
|
-
className: "tongyong-xuanzhongdui",
|
|
1428
|
-
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1429
|
-
}) : /*#__PURE__*/ _jsx("i", {
|
|
1430
|
-
className: "fuzhi21",
|
|
1431
|
-
onClick: function() {
|
|
1432
|
-
var bol = copyText(item.message);
|
|
1433
|
-
if (bol) {
|
|
1434
|
-
var obj = copyTextOBJ;
|
|
1435
|
-
obj = obj.filter(function(list) {
|
|
1436
|
-
return list != item.id;
|
|
1437
|
-
});
|
|
1438
|
-
obj.push(item.id);
|
|
1439
|
-
setCopyTextObj(obj);
|
|
1440
|
-
}
|
|
1441
|
-
setTimeout(function() {
|
|
1442
|
-
var obj = copyTextOBJ;
|
|
1443
|
-
obj = obj.filter(function(list) {
|
|
1444
|
-
return list != item.id;
|
|
1445
|
-
});
|
|
1446
|
-
setCopyTextObj(obj);
|
|
1447
|
-
}, 3000);
|
|
1448
|
-
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1449
|
-
},
|
|
1450
|
-
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1451
|
-
})
|
|
1541
|
+
item.quotedMessage,
|
|
1542
|
+
">"
|
|
1452
1543
|
]
|
|
1453
1544
|
})
|
|
1454
|
-
}),
|
|
1455
|
-
/*#__PURE__*/ _jsx("div", {
|
|
1456
|
-
className: styles.content,
|
|
1457
|
-
children: /*#__PURE__*/ _jsx("p", {
|
|
1458
|
-
dangerouslySetInnerHTML: {
|
|
1459
|
-
__html: remarkable.render(message)
|
|
1460
|
-
},
|
|
1461
|
-
className: styles.content_child
|
|
1462
|
-
})
|
|
1463
|
-
})
|
|
1464
|
-
]
|
|
1465
|
-
}),
|
|
1466
|
-
//引用消息
|
|
1467
|
-
item.quotedMessage != "" && item.quotedMessage != null && item.quotedMessage != undefined ? /*#__PURE__*/ _jsx("div", {
|
|
1468
|
-
className: styles.citation_content,
|
|
1469
|
-
children: getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
1470
|
-
overlayClassName: styles.popover_main_content,
|
|
1471
|
-
title: item.quotedMessage,
|
|
1472
|
-
placement: "leftTop",
|
|
1473
|
-
children: /*#__PURE__*/ _jsx("p", {
|
|
1545
|
+
}) : /*#__PURE__*/ _jsx("p", {
|
|
1474
1546
|
children: item.quotedMessage
|
|
1475
1547
|
})
|
|
1476
|
-
}) : /*#__PURE__*/ _jsx("p", {
|
|
1477
|
-
children: item.quotedMessage
|
|
1478
1548
|
})
|
|
1479
|
-
|
|
1480
|
-
|
|
1549
|
+
]
|
|
1550
|
+
})
|
|
1481
1551
|
}),
|
|
1482
1552
|
showType == 2 || showType == 4 ? /*#__PURE__*/ _jsx("div", {
|
|
1483
1553
|
className: styles.head_sculpture,
|
|
@@ -1502,7 +1572,12 @@ var CustomerService = function(props) {
|
|
|
1502
1572
|
headImg = chatWindow[0].headImg;
|
|
1503
1573
|
}
|
|
1504
1574
|
//是否在智能客服窗口
|
|
1505
|
-
var isAiChatWindow = chatWindow[0].sender == "AI" ? true : false;
|
|
1575
|
+
var isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
1576
|
+
var header = 2; //代表是ai头像
|
|
1577
|
+
if (isAiChatWindow && item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
|
|
1578
|
+
//使用AI头像
|
|
1579
|
+
header = 1;
|
|
1580
|
+
}
|
|
1506
1581
|
li = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
1507
1582
|
children: [
|
|
1508
1583
|
dataTime ? /*#__PURE__*/ _jsx("li", {
|
|
@@ -1513,12 +1588,12 @@ var CustomerService = function(props) {
|
|
|
1513
1588
|
className: styles.right,
|
|
1514
1589
|
id: lastId == item.id ? "li_flag" : "",
|
|
1515
1590
|
children: [
|
|
1516
|
-
showType == 2 || showType == 4 && /*#__PURE__*/ _jsx("div", {
|
|
1591
|
+
(showType == 2 || showType == 4) && /*#__PURE__*/ _jsx("div", {
|
|
1517
1592
|
className: styles.head_sculpture,
|
|
1518
1593
|
style: {
|
|
1519
1594
|
marginRight: "12px"
|
|
1520
1595
|
},
|
|
1521
|
-
children: isAiChatWindow ? item.extraInfo == null ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
|
|
1596
|
+
children: isAiChatWindow ? item.extraInfo == null || header == 1 ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
|
|
1522
1597
|
src: knowledge_icon
|
|
1523
1598
|
}) : /*#__PURE__*/ _jsx("img", {
|
|
1524
1599
|
src: headImg
|
|
@@ -1531,125 +1606,8 @@ var CustomerService = function(props) {
|
|
|
1531
1606
|
children: [
|
|
1532
1607
|
/*#__PURE__*/ _jsx("div", {
|
|
1533
1608
|
className: styles.operate_modal,
|
|
1534
|
-
children:
|
|
1535
|
-
|
|
1536
|
-
children: [
|
|
1537
|
-
/*#__PURE__*/ _jsx("span", {
|
|
1538
|
-
className: styles.ask_question,
|
|
1539
|
-
onClick: function() {
|
|
1540
|
-
setAnswerMode(1);
|
|
1541
|
-
setProblem({
|
|
1542
|
-
question: historyMessageList[i - 1].message,
|
|
1543
|
-
user: problem.user
|
|
1544
|
-
});
|
|
1545
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
1546
|
-
var newHistoryMessageList = historyMessageList.concat({
|
|
1547
|
-
id: -1,
|
|
1548
|
-
roomId: roomId,
|
|
1549
|
-
sender: "AI",
|
|
1550
|
-
recevier: mid,
|
|
1551
|
-
message: "请在输入框中输入您要召唤的老师的姓名",
|
|
1552
|
-
createdAt: getDataTime(-1),
|
|
1553
|
-
findTeacher: true
|
|
1554
|
-
});
|
|
1555
|
-
return newHistoryMessageList;
|
|
1556
|
-
});
|
|
1557
|
-
scrollToBottom();
|
|
1558
|
-
},
|
|
1559
|
-
children: "召唤老师回答"
|
|
1560
|
-
}),
|
|
1561
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1562
|
-
className: "yinyong_quote1",
|
|
1563
|
-
onClick: function() {
|
|
1564
|
-
setCitationContent({
|
|
1565
|
-
content: item.message,
|
|
1566
|
-
id: item.id
|
|
1567
|
-
});
|
|
1568
|
-
resettingBottomHei();
|
|
1569
|
-
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1570
|
-
console.log("引用222222");
|
|
1571
|
-
},
|
|
1572
|
-
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1573
|
-
}),
|
|
1574
|
-
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
1575
|
-
return list == item.id;
|
|
1576
|
-
}) ? /*#__PURE__*/ _jsx("i", {
|
|
1577
|
-
className: "tongyong-xuanzhongdui",
|
|
1578
|
-
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1579
|
-
}) : /*#__PURE__*/ _jsx("i", {
|
|
1580
|
-
className: "fuzhi21",
|
|
1581
|
-
onClick: function() {
|
|
1582
|
-
var bol = copyText(item.message);
|
|
1583
|
-
if (bol) {
|
|
1584
|
-
var obj = copyTextOBJ;
|
|
1585
|
-
obj = obj.filter(function(list) {
|
|
1586
|
-
return list != item.id;
|
|
1587
|
-
});
|
|
1588
|
-
obj.push(item.id);
|
|
1589
|
-
setCopyTextObj(obj);
|
|
1590
|
-
}
|
|
1591
|
-
setTimeout(function() {
|
|
1592
|
-
var obj = copyTextOBJ;
|
|
1593
|
-
obj = obj.filter(function(list) {
|
|
1594
|
-
return list != item.id;
|
|
1595
|
-
});
|
|
1596
|
-
setCopyTextObj(obj);
|
|
1597
|
-
}, 3000);
|
|
1598
|
-
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1599
|
-
},
|
|
1600
|
-
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1601
|
-
}),
|
|
1602
|
-
/*#__PURE__*/ _jsx("span", {
|
|
1603
|
-
children: "|"
|
|
1604
|
-
}),
|
|
1605
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1606
|
-
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
1607
|
-
onClick: function() {
|
|
1608
|
-
likeMessage(item.id, item.upvoted);
|
|
1609
|
-
console.log("判断是AI还是智能回答", item);
|
|
1610
|
-
//只有最后一条回答,支持发送点赞或踩
|
|
1611
|
-
if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1612
|
-
console.log("判断是AI还是智能回答", item);
|
|
1613
|
-
if (!item.extraInfo && item.sender == "AI") {
|
|
1614
|
-
aiSendQuestions(1, {
|
|
1615
|
-
roomId: roomId,
|
|
1616
|
-
message: "你给出的答案我非常满意,赞!",
|
|
1617
|
-
quotedMessage: "",
|
|
1618
|
-
regenerate: false,
|
|
1619
|
-
generateUpvoteOrDownvoteMessage: true
|
|
1620
|
-
}, 1);
|
|
1621
|
-
} else {
|
|
1622
|
-
console.log("AI回答2255555");
|
|
1623
|
-
sendGreetingMessage(2);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
},
|
|
1627
|
-
children: /*#__PURE__*/ _jsx(CustomLike, {})
|
|
1628
|
-
}),
|
|
1629
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1630
|
-
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
1631
|
-
onClick: function() {
|
|
1632
|
-
disagreeMessage(item.id, item.downvoted);
|
|
1633
|
-
//只有最后一条回答,支持发送点赞或踩
|
|
1634
|
-
console.log(item, "dlfkvmdflkv");
|
|
1635
|
-
if (!item.downvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1636
|
-
if (!item.extraInfo && item.sender == "AI") {
|
|
1637
|
-
aiSendQuestions(1, {
|
|
1638
|
-
roomId: roomId,
|
|
1639
|
-
message: "你给出的答案很糟糕,我不满意,踩!",
|
|
1640
|
-
quotedMessage: "",
|
|
1641
|
-
regenerate: false,
|
|
1642
|
-
generateUpvoteOrDownvoteMessage: true
|
|
1643
|
-
}, 1);
|
|
1644
|
-
} else {
|
|
1645
|
-
sendGreetingMessage(3);
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
},
|
|
1649
|
-
children: /*#__PURE__*/ _jsx(CustomDislike, {})
|
|
1650
|
-
})
|
|
1651
|
-
]
|
|
1652
|
-
})
|
|
1609
|
+
children: // 不是最后一行,
|
|
1610
|
+
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
1653
1611
|
}),
|
|
1654
1612
|
/*#__PURE__*/ _jsxs("div", {
|
|
1655
1613
|
className: styles.content,
|
|
@@ -1660,7 +1618,7 @@ var CustomerService = function(props) {
|
|
|
1660
1618
|
},
|
|
1661
1619
|
className: styles.content_child
|
|
1662
1620
|
}),
|
|
1663
|
-
item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase"
|
|
1621
|
+
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", {
|
|
1664
1622
|
className: styles.association_problem,
|
|
1665
1623
|
children: JSON.parse(item.extraInfo).map(function(list, index) {
|
|
1666
1624
|
return /*#__PURE__*/ _jsxs("li", {
|
|
@@ -1674,175 +1632,32 @@ var CustomerService = function(props) {
|
|
|
1674
1632
|
]
|
|
1675
1633
|
}, i + "_" + index + "_" + list.value);
|
|
1676
1634
|
})
|
|
1677
|
-
})
|
|
1635
|
+
})
|
|
1678
1636
|
]
|
|
1679
1637
|
}),
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
}
|
|
1696
|
-
} catch (error) {}
|
|
1697
|
-
clearTimeout(receiveMessageTimer.current);
|
|
1698
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
1699
|
-
return historyMessageList.filter(function(item) {
|
|
1700
|
-
return item.id != "123456";
|
|
1701
|
-
});
|
|
1702
|
-
});
|
|
1703
|
-
setFinished(true);
|
|
1704
|
-
// return;
|
|
1705
|
-
// }
|
|
1706
|
-
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
1707
|
-
}
|
|
1708
|
-
}),
|
|
1709
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1710
|
-
onClick: function() {
|
|
1711
|
-
// aiSendQuestions(3,{},1);
|
|
1712
|
-
try {
|
|
1713
|
-
if (ctrl && ctrl.current) {
|
|
1714
|
-
ctrl.current.abort();
|
|
1715
|
-
}
|
|
1716
|
-
} catch (error) {}
|
|
1717
|
-
clearTimeout(receiveMessageTimer.current);
|
|
1718
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
1719
|
-
return historyMessageList.filter(function(item) {
|
|
1720
|
-
return item.id != "123456";
|
|
1721
|
-
});
|
|
1722
|
-
});
|
|
1723
|
-
setFinished(true);
|
|
1724
|
-
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
1725
|
-
},
|
|
1726
|
-
children: "停止生成"
|
|
1727
|
-
})
|
|
1728
|
-
]
|
|
1729
|
-
}) : ""
|
|
1730
|
-
}),
|
|
1731
|
-
finished ? /*#__PURE__*/ _jsxs("p", {
|
|
1732
|
-
className: "".concat(styles.operate),
|
|
1733
|
-
children: [
|
|
1734
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1735
|
-
onClick: function() {
|
|
1736
|
-
setFinished(false);
|
|
1737
|
-
aiSendQuestions(2, {
|
|
1738
|
-
roomId: roomId,
|
|
1739
|
-
message: historyMessageList[i - 1].message,
|
|
1740
|
-
quotedMessage: citationContent.content || "",
|
|
1741
|
-
regenerate: true,
|
|
1742
|
-
generateUpvoteOrDownvoteMessage: false
|
|
1743
|
-
}, item.id);
|
|
1744
|
-
onEvent(serverName + serverUrl(), "click_智能问答_重新生成", "提交");
|
|
1745
|
-
},
|
|
1746
|
-
children: /*#__PURE__*/ _jsx(CustomReloading, {})
|
|
1747
|
-
}),
|
|
1748
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1749
|
-
className: "yinyong_quote1",
|
|
1750
|
-
onClick: function() {
|
|
1751
|
-
setCitationContent({
|
|
1752
|
-
content: item.message,
|
|
1753
|
-
id: item.id
|
|
1754
|
-
});
|
|
1755
|
-
resettingBottomHei();
|
|
1756
|
-
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1757
|
-
},
|
|
1758
|
-
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1759
|
-
}),
|
|
1760
|
-
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
1761
|
-
return list == item.id;
|
|
1762
|
-
}) ? /*#__PURE__*/ _jsx("i", {
|
|
1763
|
-
className: "tongyong-xuanzhongdui",
|
|
1764
|
-
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1765
|
-
}) : /*#__PURE__*/ _jsx("i", {
|
|
1766
|
-
className: "fuzhi21",
|
|
1767
|
-
onClick: function() {
|
|
1768
|
-
var bol = copyText(item.message);
|
|
1769
|
-
if (bol) {
|
|
1770
|
-
var obj = copyTextOBJ;
|
|
1771
|
-
obj = obj.filter(function(list) {
|
|
1772
|
-
return list != item.id;
|
|
1773
|
-
});
|
|
1774
|
-
obj.push(item.id);
|
|
1775
|
-
setCopyTextObj(obj);
|
|
1776
|
-
}
|
|
1777
|
-
setTimeout(function() {
|
|
1778
|
-
var obj = copyTextOBJ;
|
|
1779
|
-
obj = obj.filter(function(list) {
|
|
1780
|
-
return list != item.id;
|
|
1781
|
-
});
|
|
1782
|
-
setCopyTextObj(obj);
|
|
1783
|
-
}, 3000);
|
|
1784
|
-
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1785
|
-
},
|
|
1786
|
-
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1787
|
-
}),
|
|
1788
|
-
/*#__PURE__*/ _jsx("span", {
|
|
1789
|
-
children: "|"
|
|
1790
|
-
}),
|
|
1791
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1792
|
-
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
1793
|
-
onClick: function() {
|
|
1794
|
-
likeMessage(item.id, item.upvoted);
|
|
1795
|
-
console.log("判断是AI还是智能回答", item);
|
|
1796
|
-
//只有最后一条回答,支持发送点赞或踩
|
|
1797
|
-
if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1798
|
-
console.log("判断是AI还是智能回答", item);
|
|
1799
|
-
if (!item.extraInfo && item.sender == "AI") {
|
|
1800
|
-
aiSendQuestions(1, {
|
|
1801
|
-
roomId: roomId,
|
|
1802
|
-
message: "你给出的答案我非常满意,赞!",
|
|
1803
|
-
quotedMessage: "",
|
|
1804
|
-
regenerate: false,
|
|
1805
|
-
generateUpvoteOrDownvoteMessage: true
|
|
1806
|
-
}, 1);
|
|
1807
|
-
} else {
|
|
1808
|
-
console.log("AI回答2255555");
|
|
1809
|
-
sendGreetingMessage(2);
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
},
|
|
1813
|
-
children: /*#__PURE__*/ _jsx(CustomLike, {})
|
|
1814
|
-
}),
|
|
1815
|
-
/*#__PURE__*/ _jsx("i", {
|
|
1816
|
-
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
1817
|
-
onClick: function() {
|
|
1818
|
-
disagreeMessage(item.id, item.downvoted);
|
|
1819
|
-
//只有最后一条回答,支持发送点赞或踩
|
|
1820
|
-
console.log(item, "dlfkvmdflkv");
|
|
1821
|
-
if (!item.downvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1822
|
-
if (!item.extraInfo && item.sender == "AI") {
|
|
1823
|
-
console.log("AI回答2222");
|
|
1824
|
-
//AI回答
|
|
1825
|
-
aiSendQuestions(1, {
|
|
1826
|
-
roomId: roomId,
|
|
1827
|
-
message: "你给出的答案很糟糕,我不满意,踩!",
|
|
1828
|
-
quotedMessage: "",
|
|
1829
|
-
regenerate: false,
|
|
1830
|
-
generateUpvoteOrDownvoteMessage: true
|
|
1831
|
-
}, 1);
|
|
1832
|
-
} else {
|
|
1833
|
-
sendGreetingMessage(3);
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
},
|
|
1837
|
-
children: /*#__PURE__*/ _jsx(CustomDislike, {})
|
|
1838
|
-
})
|
|
1839
|
-
]
|
|
1840
|
-
}) : ""
|
|
1841
|
-
]
|
|
1638
|
+
//引用消息
|
|
1639
|
+
item.quotedMessage && /*#__PURE__*/ _jsx("div", {
|
|
1640
|
+
className: styles.citation_content,
|
|
1641
|
+
children: getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
1642
|
+
overlayClassName: styles.popover_main_content,
|
|
1643
|
+
title: item.quotedMessage,
|
|
1644
|
+
placement: "leftTop",
|
|
1645
|
+
children: /*#__PURE__*/ _jsxs("p", {
|
|
1646
|
+
children: [
|
|
1647
|
+
item.quotedMessage,
|
|
1648
|
+
">"
|
|
1649
|
+
]
|
|
1650
|
+
})
|
|
1651
|
+
}) : /*#__PURE__*/ _jsx("p", {
|
|
1652
|
+
children: item.quotedMessage
|
|
1842
1653
|
})
|
|
1843
|
-
})
|
|
1654
|
+
}),
|
|
1655
|
+
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1656
|
+
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1844
1657
|
//召唤老师回答按钮
|
|
1845
|
-
item.findTeacher
|
|
1658
|
+
isAiChatWindow && item.findTeacher && userData.modules.some(function(item) {
|
|
1659
|
+
return item.short == "TeacherAnswer";
|
|
1660
|
+
}) ? /*#__PURE__*/ _jsx("div", {
|
|
1846
1661
|
className: "".concat(styles.operate_modal_bottom),
|
|
1847
1662
|
children: /*#__PURE__*/ _jsx("p", {
|
|
1848
1663
|
className: styles.stop_findTeacher,
|
|
@@ -1875,6 +1690,357 @@ var CustomerService = function(props) {
|
|
|
1875
1690
|
return "";
|
|
1876
1691
|
}
|
|
1877
1692
|
};
|
|
1693
|
+
//渲染相关操作按钮
|
|
1694
|
+
var renderOperateBtn = function(item, isAiChatWindow, i) {
|
|
1695
|
+
//问候语及点赞下面不需要展示相关按钮
|
|
1696
|
+
var extraInfo = item.extraInfo;
|
|
1697
|
+
//JSON.parse(extraInfo)[0].key == 'questionId' 是联想问题
|
|
1698
|
+
if (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
|
|
1699
|
+
return "";
|
|
1700
|
+
}
|
|
1701
|
+
return /*#__PURE__*/ _jsxs("p", {
|
|
1702
|
+
className: styles.operate,
|
|
1703
|
+
children: [
|
|
1704
|
+
// 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
|
|
1705
|
+
isAiChatWindow && answerMode != 1 && userData.modules.some(function(item) {
|
|
1706
|
+
return item.short == "TeacherAnswer";
|
|
1707
|
+
}) && /*#__PURE__*/ _jsx("span", {
|
|
1708
|
+
className: styles.ask_question,
|
|
1709
|
+
onClick: function() {
|
|
1710
|
+
setAnswerMode(1);
|
|
1711
|
+
setProblem({
|
|
1712
|
+
question: historyMessageList[i - 1].message,
|
|
1713
|
+
user: problem.user
|
|
1714
|
+
});
|
|
1715
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
1716
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
1717
|
+
id: -1,
|
|
1718
|
+
roomId: roomId,
|
|
1719
|
+
sender: "AI",
|
|
1720
|
+
recevier: mid,
|
|
1721
|
+
message: "请告诉我您要召唤的老师名字",
|
|
1722
|
+
createdAt: getDataTime(-1),
|
|
1723
|
+
findTeacher: true
|
|
1724
|
+
});
|
|
1725
|
+
return newHistoryMessageList;
|
|
1726
|
+
});
|
|
1727
|
+
setTimeout(function() {
|
|
1728
|
+
scrollToBottom();
|
|
1729
|
+
}, 200);
|
|
1730
|
+
},
|
|
1731
|
+
children: "召唤老师回答"
|
|
1732
|
+
}),
|
|
1733
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1734
|
+
className: "yinyong_quote1",
|
|
1735
|
+
onClick: function() {
|
|
1736
|
+
setCitationContent({
|
|
1737
|
+
content: item.message,
|
|
1738
|
+
id: item.id
|
|
1739
|
+
});
|
|
1740
|
+
resettingBottomHei();
|
|
1741
|
+
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1742
|
+
console.log("引用222222");
|
|
1743
|
+
},
|
|
1744
|
+
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1745
|
+
}),
|
|
1746
|
+
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
1747
|
+
return list == item.id;
|
|
1748
|
+
}) ? /*#__PURE__*/ _jsx("i", {
|
|
1749
|
+
className: "tongyong-xuanzhongdui",
|
|
1750
|
+
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1751
|
+
}) : /*#__PURE__*/ _jsx("i", {
|
|
1752
|
+
className: "fuzhi21",
|
|
1753
|
+
onClick: function() {
|
|
1754
|
+
var bol = copyText(item.message);
|
|
1755
|
+
if (bol) {
|
|
1756
|
+
var obj = copyTextOBJ;
|
|
1757
|
+
obj = obj.filter(function(list) {
|
|
1758
|
+
return list != item.id;
|
|
1759
|
+
});
|
|
1760
|
+
obj.push(item.id);
|
|
1761
|
+
setCopyTextObj(obj);
|
|
1762
|
+
}
|
|
1763
|
+
setTimeout(function() {
|
|
1764
|
+
var obj = copyTextOBJ;
|
|
1765
|
+
obj = obj.filter(function(list) {
|
|
1766
|
+
return list != item.id;
|
|
1767
|
+
});
|
|
1768
|
+
setCopyTextObj(obj);
|
|
1769
|
+
}, 3000);
|
|
1770
|
+
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1771
|
+
},
|
|
1772
|
+
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1773
|
+
}),
|
|
1774
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1775
|
+
children: "|"
|
|
1776
|
+
}),
|
|
1777
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1778
|
+
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
1779
|
+
onClick: function() {
|
|
1780
|
+
likeMessage(item.id, item.upvoted);
|
|
1781
|
+
//老师的聊天窗口中不需要点赞和踩消息
|
|
1782
|
+
if (!isAiChatWindow) return;
|
|
1783
|
+
//只有最后一条回答,支持发送点赞或踩
|
|
1784
|
+
if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1785
|
+
console.log("判断是AI还是智能回答", item);
|
|
1786
|
+
if (!item.extraInfo && item.sender == "AI") {
|
|
1787
|
+
aiSendQuestions(1, {
|
|
1788
|
+
roomId: roomId,
|
|
1789
|
+
message: "你给出的答案我非常满意,赞!",
|
|
1790
|
+
quotedMessage: "",
|
|
1791
|
+
regenerate: false,
|
|
1792
|
+
generateUpvoteOrDownvoteMessage: true
|
|
1793
|
+
}, 1);
|
|
1794
|
+
} else {
|
|
1795
|
+
console.log("AI回答2255555");
|
|
1796
|
+
sendGreetingMessage(2);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
},
|
|
1800
|
+
children: /*#__PURE__*/ _jsx(CustomLike, {})
|
|
1801
|
+
}),
|
|
1802
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1803
|
+
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
1804
|
+
onClick: function() {
|
|
1805
|
+
disagreeMessage(item.id, item.downvoted);
|
|
1806
|
+
//老师的聊天窗口中不需要点赞和踩消息
|
|
1807
|
+
if (!isAiChatWindow) return;
|
|
1808
|
+
//只有最后一条回答,支持发送点赞或踩
|
|
1809
|
+
if (!item.downvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1810
|
+
if (!item.extraInfo && item.sender == "AI") {
|
|
1811
|
+
aiSendQuestions(1, {
|
|
1812
|
+
roomId: roomId,
|
|
1813
|
+
message: "你给出的答案很糟糕,我不满意,踩!",
|
|
1814
|
+
quotedMessage: "",
|
|
1815
|
+
regenerate: false,
|
|
1816
|
+
generateUpvoteOrDownvoteMessage: true
|
|
1817
|
+
}, 1);
|
|
1818
|
+
} else {
|
|
1819
|
+
sendGreetingMessage(3);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
},
|
|
1823
|
+
children: /*#__PURE__*/ _jsx(CustomDislike, {})
|
|
1824
|
+
})
|
|
1825
|
+
]
|
|
1826
|
+
});
|
|
1827
|
+
};
|
|
1828
|
+
//渲染最后一条的操作按钮
|
|
1829
|
+
var renderLastOperateBtn = function(item, isAiChatWindow, i) {
|
|
1830
|
+
{}
|
|
1831
|
+
//问候语及点赞下面不需要展示相关按钮
|
|
1832
|
+
var extraInfo = item.extraInfo;
|
|
1833
|
+
//JSON.parse(extraInfo)[0].key == 'questionId' 是联想问题
|
|
1834
|
+
if (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
|
|
1835
|
+
return "";
|
|
1836
|
+
}
|
|
1837
|
+
//1、是否显示停止生成按钮 finished 是否生产完成
|
|
1838
|
+
var showStopBtn = false;
|
|
1839
|
+
if (!finished && item.sender == "AI" && item.extraInfo == null) {
|
|
1840
|
+
showStopBtn = true;
|
|
1841
|
+
}
|
|
1842
|
+
//2、是否展示重新生成按钮
|
|
1843
|
+
var regenerationBtn = false;
|
|
1844
|
+
if (finished && item.sender == "AI" && item.extraInfo == null) {
|
|
1845
|
+
regenerationBtn = true;
|
|
1846
|
+
}
|
|
1847
|
+
//3、是否显示召唤老师回答按钮
|
|
1848
|
+
var findTeacherBtn = false;
|
|
1849
|
+
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
|
|
1850
|
+
findTeacherBtn = true;
|
|
1851
|
+
}
|
|
1852
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
1853
|
+
className: "".concat(styles.operate_modal_bottom),
|
|
1854
|
+
children: [
|
|
1855
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
1856
|
+
className: styles.stop_generate,
|
|
1857
|
+
children: [
|
|
1858
|
+
showStopBtn && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
1859
|
+
children: [
|
|
1860
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1861
|
+
className: styles.icon,
|
|
1862
|
+
onClick: function() {
|
|
1863
|
+
try {
|
|
1864
|
+
if (ctrl && ctrl.current) {
|
|
1865
|
+
ctrl.current.abort();
|
|
1866
|
+
}
|
|
1867
|
+
} catch (error) {}
|
|
1868
|
+
clearTimeout(receiveMessageTimer.current);
|
|
1869
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
1870
|
+
return historyMessageList.filter(function(item) {
|
|
1871
|
+
return item.id != "123456";
|
|
1872
|
+
});
|
|
1873
|
+
});
|
|
1874
|
+
setFinished(true);
|
|
1875
|
+
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
1876
|
+
}
|
|
1877
|
+
}),
|
|
1878
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1879
|
+
onClick: function() {
|
|
1880
|
+
// aiSendQuestions(3,{},1);
|
|
1881
|
+
try {
|
|
1882
|
+
if (ctrl && ctrl.current) {
|
|
1883
|
+
ctrl.current.abort();
|
|
1884
|
+
}
|
|
1885
|
+
} catch (error) {}
|
|
1886
|
+
clearTimeout(receiveMessageTimer.current);
|
|
1887
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
1888
|
+
return historyMessageList.filter(function(item) {
|
|
1889
|
+
return item.id != "123456";
|
|
1890
|
+
});
|
|
1891
|
+
});
|
|
1892
|
+
setFinished(true);
|
|
1893
|
+
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
1894
|
+
},
|
|
1895
|
+
children: "停止生成"
|
|
1896
|
+
})
|
|
1897
|
+
]
|
|
1898
|
+
}),
|
|
1899
|
+
//在ai窗口并ai已经生成完答案
|
|
1900
|
+
findTeacherBtn && /*#__PURE__*/ _jsx("span", {
|
|
1901
|
+
className: styles.find_teacher,
|
|
1902
|
+
onClick: function() {
|
|
1903
|
+
setAnswerMode(1);
|
|
1904
|
+
setProblem({
|
|
1905
|
+
question: historyMessageList[i - 1].message,
|
|
1906
|
+
user: problem.user
|
|
1907
|
+
});
|
|
1908
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
1909
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
1910
|
+
id: -1,
|
|
1911
|
+
roomId: roomId,
|
|
1912
|
+
sender: "AI",
|
|
1913
|
+
recevier: mid,
|
|
1914
|
+
message: "请告诉我您要召唤的老师名字",
|
|
1915
|
+
createdAt: getDataTime(-1),
|
|
1916
|
+
findTeacher: true
|
|
1917
|
+
});
|
|
1918
|
+
return newHistoryMessageList;
|
|
1919
|
+
});
|
|
1920
|
+
setTimeout(function() {
|
|
1921
|
+
scrollToBottom();
|
|
1922
|
+
}, 200);
|
|
1923
|
+
},
|
|
1924
|
+
children: "召唤老师回答"
|
|
1925
|
+
})
|
|
1926
|
+
]
|
|
1927
|
+
}),
|
|
1928
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
1929
|
+
className: "".concat(styles.operate),
|
|
1930
|
+
children: [
|
|
1931
|
+
regenerationBtn && /*#__PURE__*/ _jsx("i", {
|
|
1932
|
+
onClick: function() {
|
|
1933
|
+
setFinished(false);
|
|
1934
|
+
aiSendQuestions(2, {
|
|
1935
|
+
roomId: roomId,
|
|
1936
|
+
message: historyMessageList[i - 1].message,
|
|
1937
|
+
quotedMessage: citationContent.content || "",
|
|
1938
|
+
regenerate: true,
|
|
1939
|
+
generateUpvoteOrDownvoteMessage: false
|
|
1940
|
+
}, item.id);
|
|
1941
|
+
onEvent(serverName + serverUrl(), "click_智能问答_重新生成", "提交");
|
|
1942
|
+
},
|
|
1943
|
+
children: /*#__PURE__*/ _jsx(CustomReloading, {})
|
|
1944
|
+
}),
|
|
1945
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1946
|
+
className: "yinyong_quote1",
|
|
1947
|
+
onClick: function() {
|
|
1948
|
+
setCitationContent({
|
|
1949
|
+
content: item.message,
|
|
1950
|
+
id: item.id
|
|
1951
|
+
});
|
|
1952
|
+
resettingBottomHei();
|
|
1953
|
+
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
1954
|
+
},
|
|
1955
|
+
children: /*#__PURE__*/ _jsx(CustomQuote, {})
|
|
1956
|
+
}),
|
|
1957
|
+
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
1958
|
+
return list == item.id;
|
|
1959
|
+
}) ? /*#__PURE__*/ _jsx("i", {
|
|
1960
|
+
className: "tongyong-xuanzhongdui",
|
|
1961
|
+
children: /*#__PURE__*/ _jsx(CustomDuihao, {})
|
|
1962
|
+
}) : /*#__PURE__*/ _jsx("i", {
|
|
1963
|
+
className: "fuzhi21",
|
|
1964
|
+
onClick: function() {
|
|
1965
|
+
var bol = copyText(item.message);
|
|
1966
|
+
if (bol) {
|
|
1967
|
+
var obj = copyTextOBJ;
|
|
1968
|
+
obj = obj.filter(function(list) {
|
|
1969
|
+
return list != item.id;
|
|
1970
|
+
});
|
|
1971
|
+
obj.push(item.id);
|
|
1972
|
+
setCopyTextObj(obj);
|
|
1973
|
+
}
|
|
1974
|
+
setTimeout(function() {
|
|
1975
|
+
var obj = copyTextOBJ;
|
|
1976
|
+
obj = obj.filter(function(list) {
|
|
1977
|
+
return list != item.id;
|
|
1978
|
+
});
|
|
1979
|
+
setCopyTextObj(obj);
|
|
1980
|
+
}, 3000);
|
|
1981
|
+
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
1982
|
+
},
|
|
1983
|
+
children: /*#__PURE__*/ _jsx(CustomCopy, {})
|
|
1984
|
+
}),
|
|
1985
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1986
|
+
children: "|"
|
|
1987
|
+
}),
|
|
1988
|
+
/*#__PURE__*/ _jsx("i", {
|
|
1989
|
+
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
1990
|
+
onClick: function() {
|
|
1991
|
+
likeMessage(item.id, item.upvoted);
|
|
1992
|
+
//老师的聊天窗口中不需要点赞和踩消息
|
|
1993
|
+
if (!isAiChatWindow) return;
|
|
1994
|
+
//只有最后一条回答,支持发送点赞或踩
|
|
1995
|
+
if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1996
|
+
console.log("判断是AI还是智能回答", item);
|
|
1997
|
+
if (!item.extraInfo && item.sender == "AI") {
|
|
1998
|
+
aiSendQuestions(1, {
|
|
1999
|
+
roomId: roomId,
|
|
2000
|
+
message: "你给出的答案我非常满意,赞!",
|
|
2001
|
+
quotedMessage: "",
|
|
2002
|
+
regenerate: false,
|
|
2003
|
+
generateUpvoteOrDownvoteMessage: true
|
|
2004
|
+
}, 1);
|
|
2005
|
+
} else {
|
|
2006
|
+
console.log("AI回答2255555");
|
|
2007
|
+
sendGreetingMessage(2);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
},
|
|
2011
|
+
children: /*#__PURE__*/ _jsx(CustomLike, {})
|
|
2012
|
+
}),
|
|
2013
|
+
/*#__PURE__*/ _jsx("i", {
|
|
2014
|
+
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
2015
|
+
onClick: function() {
|
|
2016
|
+
disagreeMessage(item.id, item.downvoted);
|
|
2017
|
+
//老师的聊天窗口中不需要点赞和踩消息
|
|
2018
|
+
if (!isAiChatWindow) return;
|
|
2019
|
+
//只有最后一条回答,支持发送点赞或踩
|
|
2020
|
+
console.log(item, "dlfkvmdflkv");
|
|
2021
|
+
if (!item.downvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
2022
|
+
if (!item.extraInfo && item.sender == "AI") {
|
|
2023
|
+
console.log("AI回答2222");
|
|
2024
|
+
//AI回答
|
|
2025
|
+
aiSendQuestions(1, {
|
|
2026
|
+
roomId: roomId,
|
|
2027
|
+
message: "你给出的答案很糟糕,我不满意,踩!",
|
|
2028
|
+
quotedMessage: "",
|
|
2029
|
+
regenerate: false,
|
|
2030
|
+
generateUpvoteOrDownvoteMessage: true
|
|
2031
|
+
}, 1);
|
|
2032
|
+
} else {
|
|
2033
|
+
sendGreetingMessage(3);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
},
|
|
2037
|
+
children: /*#__PURE__*/ _jsx(CustomDislike, {})
|
|
2038
|
+
})
|
|
2039
|
+
]
|
|
2040
|
+
})
|
|
2041
|
+
]
|
|
2042
|
+
});
|
|
2043
|
+
};
|
|
1878
2044
|
//渲染底部按钮
|
|
1879
2045
|
var renderBottomAnt = function() {
|
|
1880
2046
|
var placeholder = "";
|
|
@@ -1913,6 +2079,7 @@ var CustomerService = function(props) {
|
|
|
1913
2079
|
setKeyWord(e.target.value);
|
|
1914
2080
|
if (e.target.value == "") {
|
|
1915
2081
|
setQuestionsList([]);
|
|
2082
|
+
setTeacherList([]);
|
|
1916
2083
|
clearTimeout(timer.current);
|
|
1917
2084
|
} else {
|
|
1918
2085
|
clearTimeout(timer.current);
|
|
@@ -1928,7 +2095,7 @@ var CustomerService = function(props) {
|
|
|
1928
2095
|
},
|
|
1929
2096
|
onPressEnter: function(e) {
|
|
1930
2097
|
// console.log('发送内容22222',props)
|
|
1931
|
-
console.log(roomList,
|
|
2098
|
+
// console.log(roomList,roomId,'发送内容22222wewewewewewewe');
|
|
1932
2099
|
if (!e.shiftKey && !e.altKey && !e.ctrlKey && keyWord.trim() != "") {
|
|
1933
2100
|
e.stopPropagation();
|
|
1934
2101
|
e.preventDefault();
|
|
@@ -1980,10 +2147,7 @@ var CustomerService = function(props) {
|
|
|
1980
2147
|
className: styles.voice,
|
|
1981
2148
|
children: [
|
|
1982
2149
|
voiceRecordingStatus == 1 || voiceRecordingStatus == 3 ? /*#__PURE__*/ _jsx("i", {
|
|
1983
|
-
className: "
|
|
1984
|
-
style: {
|
|
1985
|
-
color: disabled ? "rgba(0, 0, 0, 0.65)" : "rgba(0, 0, 0, 0.25)"
|
|
1986
|
-
},
|
|
2150
|
+
className: "".concat(!disabled ? styles.disabled : ""),
|
|
1987
2151
|
onClick: function() {
|
|
1988
2152
|
//开始录音
|
|
1989
2153
|
if (!disabled) return;
|
|
@@ -2018,7 +2182,7 @@ var CustomerService = function(props) {
|
|
|
2018
2182
|
/*#__PURE__*/ _jsx("p", {
|
|
2019
2183
|
className: "".concat(styles.sending),
|
|
2020
2184
|
children: /*#__PURE__*/ _jsx("i", {
|
|
2021
|
-
className: "".concat(!disabled ? styles.disabled : ""),
|
|
2185
|
+
className: "".concat(!disabled || keyWord.trim() == "" ? styles.disabled : ""),
|
|
2022
2186
|
onClick: function() {
|
|
2023
2187
|
if (!disabled) return;
|
|
2024
2188
|
setCitationContent({});
|
|
@@ -2066,10 +2230,18 @@ var CustomerService = function(props) {
|
|
|
2066
2230
|
//setUpdateRecords(true);
|
|
2067
2231
|
setAnswerMode(-1);
|
|
2068
2232
|
setChatWith(item);
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
setRoomId(id); //新的聊天室id
|
|
2233
|
+
var list = roomList.filter(function(e) {
|
|
2234
|
+
return e.sender == item.uid;
|
|
2072
2235
|
});
|
|
2236
|
+
if (list.length > 0) {
|
|
2237
|
+
setRoomId(list[0].roomId); //已有聊天室
|
|
2238
|
+
} else {
|
|
2239
|
+
createRooms(item.uid).then(function(res) {
|
|
2240
|
+
childRef.current.roomsListTimer();
|
|
2241
|
+
var id = res.data.id;
|
|
2242
|
+
setRoomId(id); //新的聊天室id
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2073
2245
|
},
|
|
2074
2246
|
dangerouslySetInnerHTML: {
|
|
2075
2247
|
__html: span
|
|
@@ -2085,7 +2257,6 @@ var CustomerService = function(props) {
|
|
|
2085
2257
|
bottom: "".concat(buttomHei + 6, "px")
|
|
2086
2258
|
},
|
|
2087
2259
|
children: questionsList.map(function(item) {
|
|
2088
|
-
console.log(item, 44444444);
|
|
2089
2260
|
var span = item.question.replaceAll(keyWord, function() {
|
|
2090
2261
|
return "<span class=".concat(styles.sign, ">").concat(keyWord, "</span>");
|
|
2091
2262
|
});
|
|
@@ -2107,12 +2278,18 @@ var CustomerService = function(props) {
|
|
|
2107
2278
|
}
|
|
2108
2279
|
};
|
|
2109
2280
|
//加载指定数据,点击历史记录
|
|
2110
|
-
var loadSpecifiedData = function(renewRoomId, page, id) {
|
|
2281
|
+
var loadSpecifiedData = function(renewRoomId, page, id, receiver) {
|
|
2282
|
+
if (page != 1) {
|
|
2283
|
+
setPageNumHistory(page);
|
|
2284
|
+
}
|
|
2285
|
+
createRooms(receiver);
|
|
2286
|
+
if (childRef.current) {
|
|
2287
|
+
childRef.current.roomsListTimer();
|
|
2288
|
+
}
|
|
2111
2289
|
setPageNum(page);
|
|
2112
2290
|
setLastId(id); //用于定位
|
|
2113
2291
|
//如果是当前聊天室
|
|
2114
2292
|
if (renewRoomId == roomId) {
|
|
2115
|
-
console.log("当前聊天窗口111111");
|
|
2116
2293
|
getHistoryMessage(page, 1);
|
|
2117
2294
|
} else {
|
|
2118
2295
|
setRoomId(renewRoomId);
|
|
@@ -2133,7 +2310,7 @@ var CustomerService = function(props) {
|
|
|
2133
2310
|
// maskClosable={false}
|
|
2134
2311
|
rootClassName: styles.service_ChatWindow_Drawer,
|
|
2135
2312
|
children: [
|
|
2136
|
-
/*#__PURE__*/ _jsx("div", {
|
|
2313
|
+
showType == 1 && /*#__PURE__*/ _jsx("div", {
|
|
2137
2314
|
style: {
|
|
2138
2315
|
display: "".concat(showContacts && roomId != "" ? "block" : "none")
|
|
2139
2316
|
},
|
|
@@ -2148,7 +2325,8 @@ var CustomerService = function(props) {
|
|
|
2148
2325
|
},
|
|
2149
2326
|
// roomIdAi={roomIdAi}
|
|
2150
2327
|
switchChatRoom: switchChatRoom,
|
|
2151
|
-
saveContactsList: saveContactsList
|
|
2328
|
+
saveContactsList: saveContactsList,
|
|
2329
|
+
ref: childRef
|
|
2152
2330
|
})
|
|
2153
2331
|
}),
|
|
2154
2332
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -2169,7 +2347,14 @@ var CustomerService = function(props) {
|
|
|
2169
2347
|
alt: ""
|
|
2170
2348
|
})
|
|
2171
2349
|
}) : "",
|
|
2172
|
-
renderQuestion()
|
|
2350
|
+
renderQuestion(),
|
|
2351
|
+
bottomLoading ? /*#__PURE__*/ _jsx("div", {
|
|
2352
|
+
className: styles.loading,
|
|
2353
|
+
children: /*#__PURE__*/ _jsx("img", {
|
|
2354
|
+
src: "/new_yun/images/loading_d.gif",
|
|
2355
|
+
alt: ""
|
|
2356
|
+
})
|
|
2357
|
+
}) : ""
|
|
2173
2358
|
]
|
|
2174
2359
|
}),
|
|
2175
2360
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -2205,7 +2390,7 @@ var CustomerService = function(props) {
|
|
|
2205
2390
|
onEvent(serverName + serverUrl(), "click_智能问答_收起侧边栏", "提交");
|
|
2206
2391
|
},
|
|
2207
2392
|
centered: true,
|
|
2208
|
-
width:
|
|
2393
|
+
width: window.innerWidth - 252 > 1214 ? window.innerWidth - 252 : 1214,
|
|
2209
2394
|
height: window.innerHeight - 160,
|
|
2210
2395
|
wrapClassName: styles.ChatWindow_Modal,
|
|
2211
2396
|
footer: false,
|
|
@@ -2236,7 +2421,8 @@ var CustomerService = function(props) {
|
|
|
2236
2421
|
setShowContacts(false);
|
|
2237
2422
|
},
|
|
2238
2423
|
switchChatRoom: switchChatRoom,
|
|
2239
|
-
saveContactsList: saveContactsList
|
|
2424
|
+
saveContactsList: saveContactsList,
|
|
2425
|
+
ref: childRef
|
|
2240
2426
|
}),
|
|
2241
2427
|
/*#__PURE__*/ _jsxs("div", {
|
|
2242
2428
|
className: styles.chat_content,
|
|
@@ -2280,7 +2466,7 @@ var CustomerService = function(props) {
|
|
|
2280
2466
|
})
|
|
2281
2467
|
]
|
|
2282
2468
|
}),
|
|
2283
|
-
showType == 3
|
|
2469
|
+
showType == 3 ? /*#__PURE__*/ _jsxs("div", {
|
|
2284
2470
|
className: "".concat(styles.ChatWindow_Drawer),
|
|
2285
2471
|
id: "",
|
|
2286
2472
|
children: [
|
|
@@ -2292,7 +2478,13 @@ var CustomerService = function(props) {
|
|
|
2292
2478
|
/*#__PURE__*/ _jsx("div", {
|
|
2293
2479
|
className: styles.user,
|
|
2294
2480
|
children: /*#__PURE__*/ _jsx("p", {
|
|
2295
|
-
children:
|
|
2481
|
+
children: roomList.filter(function(e) {
|
|
2482
|
+
return e.roomId == roomId;
|
|
2483
|
+
}).length > 0 && roomList.filter(function(e) {
|
|
2484
|
+
return e.roomId == roomId;
|
|
2485
|
+
})[0].name != undefined ? roomList.filter(function(e) {
|
|
2486
|
+
return e.roomId == roomId;
|
|
2487
|
+
})[0].name : "智能回答"
|
|
2296
2488
|
})
|
|
2297
2489
|
}),
|
|
2298
2490
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -2310,9 +2502,11 @@ var CustomerService = function(props) {
|
|
|
2310
2502
|
/*#__PURE__*/ _jsx("i", {
|
|
2311
2503
|
onClick: function() {
|
|
2312
2504
|
onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
|
|
2505
|
+
setFirstLoad(false);
|
|
2313
2506
|
setShowType(4);
|
|
2507
|
+
childRef.current.roomsListTimer();
|
|
2314
2508
|
},
|
|
2315
|
-
children: /*#__PURE__*/ _jsx(
|
|
2509
|
+
children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
|
|
2316
2510
|
}),
|
|
2317
2511
|
/*#__PURE__*/ _jsx("i", {
|
|
2318
2512
|
className: "lianxiren21",
|
|
@@ -2330,7 +2524,7 @@ var CustomerService = function(props) {
|
|
|
2330
2524
|
className: "".concat(styles.Drawer_main, " ").concat(styles.Drawer_main_newlabo),
|
|
2331
2525
|
id: "chat_content",
|
|
2332
2526
|
style: {
|
|
2333
|
-
maxHeight: "
|
|
2527
|
+
maxHeight: "".concat(window.innerHeight - 110 - buttomHei, "px)")
|
|
2334
2528
|
},
|
|
2335
2529
|
children: [
|
|
2336
2530
|
loading ? /*#__PURE__*/ _jsx("div", {
|
|
@@ -2366,7 +2560,7 @@ var CustomerService = function(props) {
|
|
|
2366
2560
|
loadSpecifiedData: loadSpecifiedData,
|
|
2367
2561
|
roomList: roomList
|
|
2368
2562
|
}),
|
|
2369
|
-
/*#__PURE__*/ _jsx("div", {
|
|
2563
|
+
showType == 3 && /*#__PURE__*/ _jsx("div", {
|
|
2370
2564
|
style: {
|
|
2371
2565
|
display: "".concat(showType == 3 && showContacts && roomId != "" ? "block" : "none")
|
|
2372
2566
|
},
|
|
@@ -2380,11 +2574,12 @@ var CustomerService = function(props) {
|
|
|
2380
2574
|
setShowContacts(false);
|
|
2381
2575
|
},
|
|
2382
2576
|
switchChatRoom: switchChatRoom,
|
|
2383
|
-
saveContactsList: saveContactsList
|
|
2577
|
+
saveContactsList: saveContactsList,
|
|
2578
|
+
ref: childRef
|
|
2384
2579
|
})
|
|
2385
2580
|
})
|
|
2386
2581
|
]
|
|
2387
|
-
}),
|
|
2582
|
+
}) : "",
|
|
2388
2583
|
showType == 4 && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
2389
2584
|
children: [
|
|
2390
2585
|
/*#__PURE__*/ _jsxs(Modal, {
|
|
@@ -2395,7 +2590,7 @@ var CustomerService = function(props) {
|
|
|
2395
2590
|
onEvent(serverName + serverUrl(), "click_智能问答_收起侧边栏", "提交");
|
|
2396
2591
|
},
|
|
2397
2592
|
centered: true,
|
|
2398
|
-
width:
|
|
2593
|
+
width: window.innerWidth - 252 > 1214 ? window.innerWidth - 252 : 1214,
|
|
2399
2594
|
height: window.innerHeight - 160,
|
|
2400
2595
|
wrapClassName: "".concat(styles.ChatWindow_Modal),
|
|
2401
2596
|
footer: false,
|
|
@@ -2426,7 +2621,8 @@ var CustomerService = function(props) {
|
|
|
2426
2621
|
setShowContacts(false);
|
|
2427
2622
|
},
|
|
2428
2623
|
switchChatRoom: switchChatRoom,
|
|
2429
|
-
saveContactsList: saveContactsList
|
|
2624
|
+
saveContactsList: saveContactsList,
|
|
2625
|
+
ref: childRef
|
|
2430
2626
|
}),
|
|
2431
2627
|
/*#__PURE__*/ _jsxs("div", {
|
|
2432
2628
|
className: styles.chat_content,
|
|
@@ -2482,7 +2678,13 @@ var CustomerService = function(props) {
|
|
|
2482
2678
|
/*#__PURE__*/ _jsx("div", {
|
|
2483
2679
|
className: styles.user,
|
|
2484
2680
|
children: /*#__PURE__*/ _jsx("p", {
|
|
2485
|
-
children:
|
|
2681
|
+
children: roomList.filter(function(e) {
|
|
2682
|
+
return e.roomId == roomId;
|
|
2683
|
+
}).length > 0 && !roomList.filter(function(e) {
|
|
2684
|
+
return e.roomId == roomId;
|
|
2685
|
+
})[0].name ? roomList.filter(function(e) {
|
|
2686
|
+
return e.roomId == roomId;
|
|
2687
|
+
})[0].name : "智能回答"
|
|
2486
2688
|
})
|
|
2487
2689
|
}),
|
|
2488
2690
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -2501,8 +2703,9 @@ var CustomerService = function(props) {
|
|
|
2501
2703
|
onClick: function() {
|
|
2502
2704
|
onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
|
|
2503
2705
|
setShowType(4);
|
|
2706
|
+
childRef.current.roomsListTimer();
|
|
2504
2707
|
},
|
|
2505
|
-
children: /*#__PURE__*/ _jsx(
|
|
2708
|
+
children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
|
|
2506
2709
|
}),
|
|
2507
2710
|
/*#__PURE__*/ _jsx("i", {
|
|
2508
2711
|
className: "lianxiren21",
|
|
@@ -2517,10 +2720,10 @@ var CustomerService = function(props) {
|
|
|
2517
2720
|
})
|
|
2518
2721
|
}),
|
|
2519
2722
|
/*#__PURE__*/ _jsxs("div", {
|
|
2520
|
-
className: "".concat(styles.Drawer_main, " ").concat(styles.Drawer_main_newlabo),
|
|
2521
|
-
id: "
|
|
2723
|
+
className: "".concat(styles.Drawer_main, " ").concat(styles.Drawer_main_newlabo, " ").concat(styles.Drawer_main_newlabo_no_pic),
|
|
2724
|
+
id: "",
|
|
2522
2725
|
style: {
|
|
2523
|
-
maxHeight: "
|
|
2726
|
+
maxHeight: "".concat(window.innerHeight - 100 - buttomHei, "px)")
|
|
2524
2727
|
},
|
|
2525
2728
|
children: [
|
|
2526
2729
|
loading ? /*#__PURE__*/ _jsx("div", {
|
|
@@ -2558,7 +2761,8 @@ var CustomerService = function(props) {
|
|
|
2558
2761
|
setShowContacts(false);
|
|
2559
2762
|
},
|
|
2560
2763
|
switchChatRoom: switchChatRoom,
|
|
2561
|
-
saveContactsList: saveContactsList
|
|
2764
|
+
saveContactsList: saveContactsList,
|
|
2765
|
+
ref: childRef
|
|
2562
2766
|
})
|
|
2563
2767
|
})
|
|
2564
2768
|
]
|