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