bhd-components 0.6.1 → 0.6.3
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/{ab2a98d6.esm.es5.development.js → a0cd97b9.esm.es5.development.js} +1 -1
- package/dist/{b8edd934.esm.es5.production.js → e88a10a0.esm.es5.production.js} +1 -1
- package/dist/index.esm.es5.development.css +1711 -827
- package/dist/index.esm.es5.development.js +515 -384
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/bhdSelect/index.d.ts +3 -0
- package/es2017/bhdSelect/index.js +18 -13
- package/es2017/bhdSelect/index.module.less +4 -1
- package/es2017/customerService/{contactsList/index.js → contactsList.js} +92 -77
- package/es2017/customerService/function.d.ts +1 -1
- package/es2017/customerService/function.js +10 -2
- package/es2017/customerService/{historyFun/index.d.ts → historyFun.d.ts} +0 -1
- package/es2017/customerService/{historyFun/index.js → historyFun.js} +62 -16
- package/es2017/customerService/index.d.ts +3 -3
- package/es2017/customerService/index.js +144 -81
- package/es2017/customerService/index.module.less +496 -5
- package/es2017/customerService/index2.module.less +1282 -0
- package/es2017/typings.d.ts +12 -0
- package/esm/bhdSelect/index.d.ts +3 -0
- package/esm/bhdSelect/index.js +18 -13
- package/esm/bhdSelect/index.module.less +4 -1
- package/esm/customerService/{contactsList/index.js → contactsList.js} +83 -66
- package/esm/customerService/function.d.ts +1 -1
- package/esm/customerService/function.js +10 -1
- package/esm/customerService/{historyFun/index.d.ts → historyFun.d.ts} +0 -1
- package/esm/customerService/{historyFun/index.js → historyFun.js} +64 -17
- package/esm/customerService/index.d.ts +3 -3
- package/esm/customerService/index.js +176 -111
- package/esm/customerService/index.module.less +496 -5
- package/esm/customerService/index2.module.less +1282 -0
- package/esm/typings.d.ts +12 -0
- package/package.json +1 -1
- package/es2017/customerService/contactsList/index.module.less +0 -206
- package/es2017/customerService/historyFun/index.module.less +0 -223
- package/esm/customerService/contactsList/index.module.less +0 -206
- package/esm/customerService/historyFun/index.module.less +0 -223
- /package/es2017/customerService/{contactsList/index.d.ts → contactsList.d.ts} +0 -0
- /package/esm/customerService/{contactsList/index.d.ts → contactsList.d.ts} +0 -0
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
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
6
|
import { Modal, Drawer, Input, Tooltip } from "antd";
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import cssStyle from "./index.module.less";
|
|
8
|
+
import cssStyleOnline from "./index2.module.less";
|
|
9
|
+
var styles = cssStyle;
|
|
10
|
+
if (false) {
|
|
11
|
+
styles = cssStyleOnline;
|
|
12
|
+
}
|
|
9
13
|
import { CustomAiIcon, CustomRecord, CustomFullScreen, CustomExitFullScreen, CustomReloading, CustomCopy, CustomLike, CustomDislike, CustomQuote, CustomSending, CustomContacts, CustomDuihao, CustomSoundRecording, CustomRoundClose } from "../icons/index";
|
|
10
|
-
import { CloseOutlined } from "@ant-design/icons";
|
|
11
|
-
import HistoryFun from "./historyFun
|
|
12
|
-
import ContactsList from "./contactsList
|
|
14
|
+
import { CloseOutlined, RightOutlined } from "@ant-design/icons";
|
|
15
|
+
import HistoryFun from "./historyFun";
|
|
16
|
+
import ContactsList from "./contactsList";
|
|
13
17
|
import { parseDate } from "../utils/Date";
|
|
14
18
|
import { Remarkable } from "remarkable";
|
|
15
19
|
import hljs from "highlight.js";
|
|
@@ -22,35 +26,34 @@ import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
|
22
26
|
import { readMessage, getByteLen, serverUrl, copyText, getDataTime } from "./function"; //一些方法
|
|
23
27
|
var CustomerService = function(props) {
|
|
24
28
|
var userData = props.userData, http = props.http, urllocation = props.urllocation, onCancel = props.onCancel, serverName = props.serverName, fetchEventSource = props.fetchEventSource, initShowType = props.initShowType, onEvent = props.onEvent, stepIds = props.stepIds, stepId = props.stepId;
|
|
25
|
-
var _useState = _sliced_to_array(useState(props.userData.mid), 2), mid = _useState[0], setmid = _useState[1]; //当前用户id
|
|
26
29
|
var _useMediaRecorder = useMediaRecorder(), bese64String = _useMediaRecorder.bese64String, startRecord = _useMediaRecorder.startRecord, stopRecord = _useMediaRecorder.stopRecord; //语音转文字
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
30
|
+
var _useState = _sliced_to_array(useState(3), 2), voiceRecordingStatus = _useState[0], setVoiceRecordingStatus = _useState[1]; //语音录制状态 3,语音识别完成 2,录制中, 1,录制结束
|
|
31
|
+
var _useState1 = _sliced_to_array(useState([]), 2), copyTextOBJ = _useState1[0], setCopyTextObj = _useState1[1]; //复制的消息id
|
|
32
|
+
var _useState2 = _sliced_to_array(useState({}), 2), citationContent = _useState2[0], setCitationContent = _useState2[1]; //引用内容
|
|
33
|
+
var _useState3 = _sliced_to_array(useState(""), 2), roomId = _useState3[0], setRoomId = _useState3[1]; //聊天室id
|
|
34
|
+
var _useState4 = _sliced_to_array(useState([]), 2), historyMessageList = _useState4[0], setHistoryMessageList = _useState4[1]; //历史消息
|
|
35
|
+
var _useState5 = _sliced_to_array(useState(""), 2), keyWord = _useState5[0], setKeyWord = _useState5[1]; //搜索内容
|
|
36
|
+
var _useState6 = _sliced_to_array(useState([]), 2), questionsList = _useState6[0], setQuestionsList = _useState6[1]; //问题列表
|
|
37
|
+
var _useState7 = _sliced_to_array(useState([]), 2), hotQuestionsList = _useState7[0], setHotQuestionsList = _useState7[1]; //热门问题
|
|
38
|
+
var _useState8 = _sliced_to_array(useState(false), 2), greetingMessage = _useState8[0], setGreetingMessage = _useState8[1]; //聊天记录列表是否请求完成
|
|
39
|
+
var _useState9 = _sliced_to_array(useState(1), 2), pageNum = _useState9[0], setPageNum = _useState9[1]; //页码
|
|
40
|
+
var _useState10 = _sliced_to_array(useState(0), 2), pageNumHistory = _useState10[0], setPageNumHistory = _useState10[1]; //用于搜索历史记录后的页码
|
|
41
|
+
var _useState11 = _sliced_to_array(useState(0), 2), pageCount = _useState11[0], setPageCount = _useState11[1]; //总页数
|
|
42
|
+
var _useState12 = _sliced_to_array(useState(false), 2), loading = _useState12[0], setLoading = _useState12[1]; //上拉显示加载图标
|
|
43
|
+
var _useState13 = _sliced_to_array(useState(false), 2), bottomLoading = _useState13[0], setBottomLoading = _useState13[1]; //下拉显示加载图标
|
|
44
|
+
var _useState14 = _sliced_to_array(useState(true), 2), finished = _useState14[0], setFinished = _useState14[1]; //是否结束生成
|
|
45
|
+
var _useState15 = _sliced_to_array(useState(""), 2), lastId = _useState15[0], setLastId = _useState15[1]; //最后一条数据的id,可用于定位当前位置
|
|
46
|
+
var _useState16 = _sliced_to_array(useState({}), 2), chatWith = _useState16[0], setChatWith = _useState16[1]; //聊天的老师id或ai
|
|
47
|
+
var _useState17 = _sliced_to_array(useState(false), 2), firstLoad = _useState17[0], setFirstLoad = _useState17[1]; //第一次切换全屏时滚动到页面底部
|
|
48
|
+
var _useState18 = _sliced_to_array(useState(45), 2), buttomHei = _useState18[0], setButtomHei = _useState18[1]; //底部输入框的高度
|
|
49
|
+
var _useState19 = _sliced_to_array(useState(false), 2), showHistory = _useState19[0], setShowHistory = _useState19[1]; //是否显示历史记录
|
|
50
|
+
var _useState20 = _sliced_to_array(useState(false), 2), showContacts = _useState20[0], setShowContacts = _useState20[1]; //是否显示关联老师
|
|
51
|
+
var _useState21 = _sliced_to_array(useState(-1), 2), showType = _useState21[0], setShowType = _useState21[1]; //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
|
|
52
|
+
var _useState22 = _sliced_to_array(useState(-1), 2), answerMode = _useState22[0], setAnswerMode = _useState22[1]; //设置回答模式。1,召唤老师回答
|
|
53
|
+
var _useState23 = _sliced_to_array(useState([]), 2), teacherList = _useState23[0], setTeacherList = _useState23[1]; //老师列表
|
|
54
|
+
var _useState24 = _sliced_to_array(useState({}), 2), problem = _useState24[0], setProblem = _useState24[1]; //召唤老师回答的问题
|
|
55
|
+
var _useState25 = _sliced_to_array(useState([]), 2), roomList = _useState25[0], setRoomList = _useState25[1]; //聊天列表
|
|
56
|
+
var _useState26 = _sliced_to_array(useState([]), 2), chatObj = _useState26[0], setChatObj = _useState26[1]; //聊天记录id保存,用来在实验报告中记录
|
|
54
57
|
var timer = useRef(null); //文本框输入时
|
|
55
58
|
var receiveMessageTimer = useRef(null); //接收ai发回的消息
|
|
56
59
|
var voiceCountdownTimer = useRef(null); //语音录制倒计时
|
|
@@ -58,6 +61,8 @@ var CustomerService = function(props) {
|
|
|
58
61
|
var roomMessage = useRef(null); //循环当前页面的新消息
|
|
59
62
|
var ctrl = useRef(); //停止生成ai回答时使用
|
|
60
63
|
var childRef = useRef(null); //获取子组件方法
|
|
64
|
+
// const [mid, setmid] = useState(props.userData.mid); //当前用户id
|
|
65
|
+
var mid = props.userData.mid;
|
|
61
66
|
var remarkable = new Remarkable({
|
|
62
67
|
highlight: function highlight(str, lang) {
|
|
63
68
|
if (lang && hljs.getLanguage(lang)) {
|
|
@@ -85,37 +90,39 @@ var CustomerService = function(props) {
|
|
|
85
90
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
86
91
|
var scrollTop = container.scrollTop;
|
|
87
92
|
// const scrollBottom = container.scroll;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
93
|
+
var clientHeight = container.clientHeight;
|
|
94
|
+
var scrollHeight = container.scrollHeight;
|
|
95
|
+
// console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
96
|
+
if (clientHeight + scrollTop + 0.5 >= scrollHeight) {
|
|
97
|
+
console.log("到底部了22222");
|
|
98
|
+
// console.log(11111111,pageNumHistory)
|
|
99
|
+
if (pageNumHistory > 1) {
|
|
100
|
+
// console.log(pageNumHistory,'pageNumpageNumpageNum')
|
|
101
|
+
var number = pageNumHistory - 1;
|
|
102
|
+
setPageNumHistory(number);
|
|
103
|
+
clearTimeout(listTimer.current);
|
|
104
|
+
setBottomLoading(true);
|
|
105
|
+
listTimer.current = setTimeout(function() {
|
|
106
|
+
// console.log("加载下一页", number);
|
|
107
|
+
getHistoryMessage(number, 4);
|
|
108
|
+
}, 1000);
|
|
109
|
+
} else {
|
|
110
|
+
setLastId("");
|
|
107
111
|
}
|
|
108
|
-
}
|
|
112
|
+
}
|
|
109
113
|
if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
|
|
114
|
+
console.log("到顶了", pageNum);
|
|
115
|
+
// if(pageNum == 1){
|
|
116
|
+
// setFirstpage(true);//代表是否存在第一页
|
|
117
|
+
// }
|
|
110
118
|
setLoading(true);
|
|
111
|
-
var
|
|
119
|
+
var number1 = pageNum + 1;
|
|
112
120
|
setPageNum(function(pageNum) {
|
|
113
121
|
return pageNum + 1;
|
|
114
122
|
});
|
|
115
|
-
clearTimeout(listTimer.current);
|
|
116
123
|
listTimer.current = setTimeout(function() {
|
|
117
|
-
console.log("下拉加载下一页",
|
|
118
|
-
getHistoryMessage(
|
|
124
|
+
console.log("下拉加载下一页", number1);
|
|
125
|
+
getHistoryMessage(number1, 2);
|
|
119
126
|
}, 1000);
|
|
120
127
|
}
|
|
121
128
|
};
|
|
@@ -407,19 +414,23 @@ var CustomerService = function(props) {
|
|
|
407
414
|
}
|
|
408
415
|
}).then(function(res) {
|
|
409
416
|
if (res.data.id) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
417
|
+
console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
|
|
418
|
+
if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
|
|
419
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
420
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
421
|
+
id: res.data.id,
|
|
422
|
+
upvoted: false,
|
|
423
|
+
downvoted: false,
|
|
424
|
+
createdAt: getDataTime(-1)
|
|
425
|
+
}));
|
|
426
|
+
return newHistoryMessageList;
|
|
427
|
+
});
|
|
428
|
+
if (!lastId) {
|
|
429
|
+
setTimeout(function() {
|
|
430
|
+
scrollToBottom();
|
|
431
|
+
}, 100);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
423
434
|
//判断当前窗口是否是
|
|
424
435
|
if (type == 1) {
|
|
425
436
|
var roomList = [
|
|
@@ -435,7 +446,6 @@ var CustomerService = function(props) {
|
|
|
435
446
|
return list2.concat(roomList);
|
|
436
447
|
});
|
|
437
448
|
}
|
|
438
|
-
// }
|
|
439
449
|
}
|
|
440
450
|
}).catch(function(err) {
|
|
441
451
|
console.log(err);
|
|
@@ -898,6 +908,7 @@ var CustomerService = function(props) {
|
|
|
898
908
|
var getHistoryMessage = function(pageNum, flag) {
|
|
899
909
|
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1";
|
|
900
910
|
clearTimeout(roomMessage.current);
|
|
911
|
+
console.log(pageNum, flag, "dkfjvndfjvndfkvdf");
|
|
901
912
|
// flag == 1 时已经设置好了位置标记
|
|
902
913
|
var last_id = "";
|
|
903
914
|
if (flag == 2 && historyMessageList.length > 0) {
|
|
@@ -1003,7 +1014,7 @@ var CustomerService = function(props) {
|
|
|
1003
1014
|
return item.roomId == rid;
|
|
1004
1015
|
});
|
|
1005
1016
|
var isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
1006
|
-
if (!isAiChatWindow && roomList.length > 0) {
|
|
1017
|
+
if (!isAiChatWindow && roomList.length > 0 && (pageNum == 1 || pageNumHistory == 0)) {
|
|
1007
1018
|
getRoomidHistoryMessage(totalNumber, rid);
|
|
1008
1019
|
}
|
|
1009
1020
|
}).catch(function(res) {
|
|
@@ -1022,7 +1033,7 @@ var CustomerService = function(props) {
|
|
|
1022
1033
|
params: {
|
|
1023
1034
|
roomId: rid,
|
|
1024
1035
|
page: 1,
|
|
1025
|
-
maxPageSize: totalNumber
|
|
1036
|
+
maxPageSize: totalNumber,
|
|
1026
1037
|
direction: "desc"
|
|
1027
1038
|
},
|
|
1028
1039
|
headers: {
|
|
@@ -1035,17 +1046,24 @@ var CustomerService = function(props) {
|
|
|
1035
1046
|
var newHistoryMessageList = [];
|
|
1036
1047
|
if (res.data.messages.length > 0) {
|
|
1037
1048
|
var dataList = res.data.messages.reverse();
|
|
1049
|
+
var originList = 0;
|
|
1050
|
+
var newList = 0;
|
|
1038
1051
|
setHistoryMessageList(function(historyMessageList) {
|
|
1039
|
-
|
|
1052
|
+
originList = historyMessageList.length;
|
|
1053
|
+
newHistoryMessageList = historyMessageList.concat(dataList);
|
|
1040
1054
|
//去重
|
|
1041
1055
|
var _$res = new Map();
|
|
1042
1056
|
newHistoryMessageList = newHistoryMessageList.filter(function(a) {
|
|
1043
1057
|
return !_$res.has(a.id) && _$res.set(a.id, 1);
|
|
1044
1058
|
});
|
|
1059
|
+
newList = newHistoryMessageList.length;
|
|
1045
1060
|
return newHistoryMessageList;
|
|
1046
1061
|
});
|
|
1047
|
-
|
|
1048
|
-
|
|
1062
|
+
console.log(dataList.length, originList, lastId, "dfkvdnfkvdfj44444");
|
|
1063
|
+
if (!lastId && originList != newList) {
|
|
1064
|
+
setTimeout(function() {
|
|
1065
|
+
scrollToBottom();
|
|
1066
|
+
}, 100);
|
|
1049
1067
|
}
|
|
1050
1068
|
}
|
|
1051
1069
|
try {
|
|
@@ -1105,7 +1123,7 @@ var CustomerService = function(props) {
|
|
|
1105
1123
|
});
|
|
1106
1124
|
console.log(result, "存储的消息");
|
|
1107
1125
|
result.map(function(item) {
|
|
1108
|
-
testLabQuestion(item.question, item.answer, item.id);
|
|
1126
|
+
testLabQuestion(item.question, item.answer, String(item.id));
|
|
1109
1127
|
});
|
|
1110
1128
|
}
|
|
1111
1129
|
}
|
|
@@ -1268,7 +1286,7 @@ var CustomerService = function(props) {
|
|
|
1268
1286
|
var list = roomList.filter(function(e) {
|
|
1269
1287
|
return e.roomId == roomId;
|
|
1270
1288
|
});
|
|
1271
|
-
var title = "
|
|
1289
|
+
var title = "智能问答";
|
|
1272
1290
|
if (list.length > 0 && list[0].name) {
|
|
1273
1291
|
title = list[0].name;
|
|
1274
1292
|
}
|
|
@@ -1319,6 +1337,7 @@ var CustomerService = function(props) {
|
|
|
1319
1337
|
]
|
|
1320
1338
|
});
|
|
1321
1339
|
} else {
|
|
1340
|
+
// console.log(roomList,'777668888900')
|
|
1322
1341
|
return /*#__PURE__*/ _jsxs("div", {
|
|
1323
1342
|
className: styles.top,
|
|
1324
1343
|
children: [
|
|
@@ -1329,7 +1348,7 @@ var CustomerService = function(props) {
|
|
|
1329
1348
|
showType == 1 && /*#__PURE__*/ _jsxs("i", {
|
|
1330
1349
|
className: "lianxiren21",
|
|
1331
1350
|
onClick: function() {
|
|
1332
|
-
setShowContacts(
|
|
1351
|
+
setShowContacts(!showContacts);
|
|
1333
1352
|
},
|
|
1334
1353
|
children: [
|
|
1335
1354
|
/*#__PURE__*/ _jsx(CustomContacts, {}),
|
|
@@ -1350,6 +1369,7 @@ var CustomerService = function(props) {
|
|
|
1350
1369
|
className: "_lishixiao22",
|
|
1351
1370
|
onClick: function() {
|
|
1352
1371
|
setShowHistory(true);
|
|
1372
|
+
onEvent(serverName + serverUrl(), "click_智能问答_历史记录", "提交");
|
|
1353
1373
|
},
|
|
1354
1374
|
children: /*#__PURE__*/ _jsx(CustomRecord, {})
|
|
1355
1375
|
}),
|
|
@@ -1537,9 +1557,10 @@ var CustomerService = function(props) {
|
|
|
1537
1557
|
title: item.quotedMessage,
|
|
1538
1558
|
placement: "leftTop",
|
|
1539
1559
|
children: /*#__PURE__*/ _jsxs("p", {
|
|
1560
|
+
className: styles.text_exceed,
|
|
1540
1561
|
children: [
|
|
1541
1562
|
item.quotedMessage,
|
|
1542
|
-
|
|
1563
|
+
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
1543
1564
|
]
|
|
1544
1565
|
})
|
|
1545
1566
|
}) : /*#__PURE__*/ _jsx("p", {
|
|
@@ -1641,11 +1662,12 @@ var CustomerService = function(props) {
|
|
|
1641
1662
|
children: getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
1642
1663
|
overlayClassName: styles.popover_main_content,
|
|
1643
1664
|
title: item.quotedMessage,
|
|
1644
|
-
placement: "
|
|
1665
|
+
placement: "rightTop",
|
|
1645
1666
|
children: /*#__PURE__*/ _jsxs("p", {
|
|
1667
|
+
className: styles.text_exceed,
|
|
1646
1668
|
children: [
|
|
1647
1669
|
item.quotedMessage,
|
|
1648
|
-
|
|
1670
|
+
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
1649
1671
|
]
|
|
1650
1672
|
})
|
|
1651
1673
|
}) : /*#__PURE__*/ _jsx("p", {
|
|
@@ -1690,7 +1712,7 @@ var CustomerService = function(props) {
|
|
|
1690
1712
|
return "";
|
|
1691
1713
|
}
|
|
1692
1714
|
};
|
|
1693
|
-
//渲染相关操作按钮
|
|
1715
|
+
//渲染相关操作按钮 header == 1 ai ,== 2 知识库
|
|
1694
1716
|
var renderOperateBtn = function(item, isAiChatWindow, i) {
|
|
1695
1717
|
//问候语及点赞下面不需要展示相关按钮
|
|
1696
1718
|
var extraInfo = item.extraInfo;
|
|
@@ -1720,7 +1742,13 @@ var CustomerService = function(props) {
|
|
|
1720
1742
|
recevier: mid,
|
|
1721
1743
|
message: "请告诉我您要召唤的老师名字",
|
|
1722
1744
|
createdAt: getDataTime(-1),
|
|
1723
|
-
findTeacher: true
|
|
1745
|
+
findTeacher: true,
|
|
1746
|
+
extraInfo: item.extraInfo == null ? null : JSON.stringify([
|
|
1747
|
+
{
|
|
1748
|
+
key: "questionId",
|
|
1749
|
+
value: "questionId"
|
|
1750
|
+
}
|
|
1751
|
+
])
|
|
1724
1752
|
});
|
|
1725
1753
|
return newHistoryMessageList;
|
|
1726
1754
|
});
|
|
@@ -1782,7 +1810,7 @@ var CustomerService = function(props) {
|
|
|
1782
1810
|
if (!isAiChatWindow) return;
|
|
1783
1811
|
//只有最后一条回答,支持发送点赞或踩
|
|
1784
1812
|
if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1785
|
-
console.log("判断是AI
|
|
1813
|
+
console.log("判断是AI还是智能问答", item);
|
|
1786
1814
|
if (!item.extraInfo && item.sender == "AI") {
|
|
1787
1815
|
aiSendQuestions(1, {
|
|
1788
1816
|
roomId: roomId,
|
|
@@ -1897,7 +1925,9 @@ var CustomerService = function(props) {
|
|
|
1897
1925
|
]
|
|
1898
1926
|
}),
|
|
1899
1927
|
//在ai窗口并ai已经生成完答案
|
|
1900
|
-
findTeacherBtn &&
|
|
1928
|
+
findTeacherBtn && userData.modules.some(function(item) {
|
|
1929
|
+
return item.short == "TeacherAnswer";
|
|
1930
|
+
}) && /*#__PURE__*/ _jsx("span", {
|
|
1901
1931
|
className: styles.find_teacher,
|
|
1902
1932
|
onClick: function() {
|
|
1903
1933
|
setAnswerMode(1);
|
|
@@ -1905,6 +1935,8 @@ var CustomerService = function(props) {
|
|
|
1905
1935
|
question: historyMessageList[i - 1].message,
|
|
1906
1936
|
user: problem.user
|
|
1907
1937
|
});
|
|
1938
|
+
console.log(item, "88888999999");
|
|
1939
|
+
// if(item.extraInfo == null){
|
|
1908
1940
|
setHistoryMessageList(function(historyMessageList) {
|
|
1909
1941
|
var newHistoryMessageList = historyMessageList.concat({
|
|
1910
1942
|
id: -1,
|
|
@@ -1913,10 +1945,40 @@ var CustomerService = function(props) {
|
|
|
1913
1945
|
recevier: mid,
|
|
1914
1946
|
message: "请告诉我您要召唤的老师名字",
|
|
1915
1947
|
createdAt: getDataTime(-1),
|
|
1916
|
-
findTeacher: true
|
|
1948
|
+
findTeacher: true,
|
|
1949
|
+
extraInfo: item.extraInfo == null ? null : JSON.stringify([
|
|
1950
|
+
{
|
|
1951
|
+
key: "questionId",
|
|
1952
|
+
value: "questionId"
|
|
1953
|
+
}
|
|
1954
|
+
])
|
|
1917
1955
|
});
|
|
1918
1956
|
return newHistoryMessageList;
|
|
1919
1957
|
});
|
|
1958
|
+
// }else{
|
|
1959
|
+
// setHistoryMessageList(
|
|
1960
|
+
// (historyMessageList) => {
|
|
1961
|
+
// let newHistoryMessageList =
|
|
1962
|
+
// historyMessageList.concat({
|
|
1963
|
+
// id: -1,
|
|
1964
|
+
// roomId: roomId,
|
|
1965
|
+
// sender: "AI",
|
|
1966
|
+
// recevier: mid,
|
|
1967
|
+
// message:
|
|
1968
|
+
// "请告诉我您要召唤的老师名字",
|
|
1969
|
+
// createdAt: getDataTime(-1),
|
|
1970
|
+
// findTeacher:true,
|
|
1971
|
+
// extraInfo: JSON.stringify([
|
|
1972
|
+
// {
|
|
1973
|
+
// key: "questionId",
|
|
1974
|
+
// value: "questionId",
|
|
1975
|
+
// },
|
|
1976
|
+
// ])
|
|
1977
|
+
// });
|
|
1978
|
+
// return newHistoryMessageList;
|
|
1979
|
+
// }
|
|
1980
|
+
// );
|
|
1981
|
+
// }
|
|
1920
1982
|
setTimeout(function() {
|
|
1921
1983
|
scrollToBottom();
|
|
1922
1984
|
}, 200);
|
|
@@ -1993,7 +2055,7 @@ var CustomerService = function(props) {
|
|
|
1993
2055
|
if (!isAiChatWindow) return;
|
|
1994
2056
|
//只有最后一条回答,支持发送点赞或踩
|
|
1995
2057
|
if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
1996
|
-
console.log("判断是AI
|
|
2058
|
+
console.log("判断是AI还是智能问答", item);
|
|
1997
2059
|
if (!item.extraInfo && item.sender == "AI") {
|
|
1998
2060
|
aiSendQuestions(1, {
|
|
1999
2061
|
roomId: roomId,
|
|
@@ -2046,7 +2108,7 @@ var CustomerService = function(props) {
|
|
|
2046
2108
|
var placeholder = "";
|
|
2047
2109
|
var disabled = false;
|
|
2048
2110
|
if (voiceRecordingStatus == 2) {
|
|
2049
|
-
placeholder = "
|
|
2111
|
+
placeholder = "语音录制中,请说话...";
|
|
2050
2112
|
} else if (voiceRecordingStatus == 1) {
|
|
2051
2113
|
placeholder = "正在语音识别文字,请稍后...";
|
|
2052
2114
|
} else if (!finished) {
|
|
@@ -2106,7 +2168,7 @@ var CustomerService = function(props) {
|
|
|
2106
2168
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
2107
2169
|
sendToTeacher(2);
|
|
2108
2170
|
} else {
|
|
2109
|
-
sendMessage();
|
|
2171
|
+
sendMessage("", 0);
|
|
2110
2172
|
}
|
|
2111
2173
|
setButtomHei(45);
|
|
2112
2174
|
} else {
|
|
@@ -2193,7 +2255,7 @@ var CustomerService = function(props) {
|
|
|
2193
2255
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
2194
2256
|
sendToTeacher(2);
|
|
2195
2257
|
} else {
|
|
2196
|
-
sendMessage();
|
|
2258
|
+
sendMessage("", 0);
|
|
2197
2259
|
}
|
|
2198
2260
|
onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
|
|
2199
2261
|
}
|
|
@@ -2210,7 +2272,7 @@ var CustomerService = function(props) {
|
|
|
2210
2272
|
return /*#__PURE__*/ _jsx("div", {
|
|
2211
2273
|
className: "".concat(styles.issues_list, " ").concat(styles.issues_list_teacherList),
|
|
2212
2274
|
style: {
|
|
2213
|
-
bottom: "".concat(buttomHei +
|
|
2275
|
+
bottom: "".concat(buttomHei + 14, "px")
|
|
2214
2276
|
},
|
|
2215
2277
|
children: teacherList.map(function(item) {
|
|
2216
2278
|
var span = item.name.replaceAll(keyWord, function() {
|
|
@@ -2282,10 +2344,6 @@ var CustomerService = function(props) {
|
|
|
2282
2344
|
if (page != 1) {
|
|
2283
2345
|
setPageNumHistory(page);
|
|
2284
2346
|
}
|
|
2285
|
-
createRooms(receiver);
|
|
2286
|
-
if (childRef.current) {
|
|
2287
|
-
childRef.current.roomsListTimer();
|
|
2288
|
-
}
|
|
2289
2347
|
setPageNum(page);
|
|
2290
2348
|
setLastId(id); //用于定位
|
|
2291
2349
|
//如果是当前聊天室
|
|
@@ -2293,12 +2351,20 @@ var CustomerService = function(props) {
|
|
|
2293
2351
|
getHistoryMessage(page, 1);
|
|
2294
2352
|
} else {
|
|
2295
2353
|
setRoomId(renewRoomId);
|
|
2354
|
+
if (childRef.current) {
|
|
2355
|
+
if (receiver != mid) {
|
|
2356
|
+
createRooms(receiver);
|
|
2357
|
+
}
|
|
2358
|
+
setTimeout(function() {
|
|
2359
|
+
childRef.current.roomsListTimer();
|
|
2360
|
+
}, 500);
|
|
2361
|
+
}
|
|
2296
2362
|
}
|
|
2297
2363
|
};
|
|
2298
2364
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
2299
2365
|
children: [
|
|
2300
2366
|
/*#__PURE__*/ _jsxs(Drawer, {
|
|
2301
|
-
title: "
|
|
2367
|
+
title: "智能问答",
|
|
2302
2368
|
width: 560,
|
|
2303
2369
|
onClose: function() {
|
|
2304
2370
|
onCancel();
|
|
@@ -2377,13 +2443,12 @@ var CustomerService = function(props) {
|
|
|
2377
2443
|
onClose: function() {
|
|
2378
2444
|
setShowHistory(false);
|
|
2379
2445
|
},
|
|
2380
|
-
loadSpecifiedData: loadSpecifiedData
|
|
2381
|
-
roomList: roomList
|
|
2446
|
+
loadSpecifiedData: loadSpecifiedData
|
|
2382
2447
|
})
|
|
2383
2448
|
]
|
|
2384
2449
|
}),
|
|
2385
2450
|
/*#__PURE__*/ _jsxs(Modal, {
|
|
2386
|
-
title: "
|
|
2451
|
+
title: "智能问答",
|
|
2387
2452
|
open: showType == 2 ? true : false,
|
|
2388
2453
|
onCancel: function() {
|
|
2389
2454
|
onCancel();
|
|
@@ -2391,6 +2456,7 @@ var CustomerService = function(props) {
|
|
|
2391
2456
|
},
|
|
2392
2457
|
centered: true,
|
|
2393
2458
|
width: window.innerWidth - 252 > 1214 ? window.innerWidth - 252 : 1214,
|
|
2459
|
+
// @ts-ignore
|
|
2394
2460
|
height: window.innerHeight - 160,
|
|
2395
2461
|
wrapClassName: styles.ChatWindow_Modal,
|
|
2396
2462
|
footer: false,
|
|
@@ -2459,8 +2525,7 @@ var CustomerService = function(props) {
|
|
|
2459
2525
|
onClose: function() {
|
|
2460
2526
|
setShowHistory(false);
|
|
2461
2527
|
},
|
|
2462
|
-
loadSpecifiedData: loadSpecifiedData
|
|
2463
|
-
roomList: roomList
|
|
2528
|
+
loadSpecifiedData: loadSpecifiedData
|
|
2464
2529
|
})
|
|
2465
2530
|
]
|
|
2466
2531
|
})
|
|
@@ -2484,7 +2549,7 @@ var CustomerService = function(props) {
|
|
|
2484
2549
|
return e.roomId == roomId;
|
|
2485
2550
|
})[0].name != undefined ? roomList.filter(function(e) {
|
|
2486
2551
|
return e.roomId == roomId;
|
|
2487
|
-
})[0].name : "
|
|
2552
|
+
})[0].name : "智能问答"
|
|
2488
2553
|
})
|
|
2489
2554
|
}),
|
|
2490
2555
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -2493,6 +2558,7 @@ var CustomerService = function(props) {
|
|
|
2493
2558
|
/*#__PURE__*/ _jsx("i", {
|
|
2494
2559
|
onClick: function() {
|
|
2495
2560
|
setShowHistory(true);
|
|
2561
|
+
onEvent(serverName + serverUrl(), "click_智能问答_历史记录", "提交");
|
|
2496
2562
|
},
|
|
2497
2563
|
children: /*#__PURE__*/ _jsx(CustomRecord, {})
|
|
2498
2564
|
}),
|
|
@@ -2511,7 +2577,7 @@ var CustomerService = function(props) {
|
|
|
2511
2577
|
/*#__PURE__*/ _jsx("i", {
|
|
2512
2578
|
className: "lianxiren21",
|
|
2513
2579
|
onClick: function() {
|
|
2514
|
-
setShowContacts(
|
|
2580
|
+
setShowContacts(!showContacts);
|
|
2515
2581
|
},
|
|
2516
2582
|
children: /*#__PURE__*/ _jsx(CustomContacts, {})
|
|
2517
2583
|
})
|
|
@@ -2557,8 +2623,7 @@ var CustomerService = function(props) {
|
|
|
2557
2623
|
onClose: function() {
|
|
2558
2624
|
setShowHistory(false);
|
|
2559
2625
|
},
|
|
2560
|
-
loadSpecifiedData: loadSpecifiedData
|
|
2561
|
-
roomList: roomList
|
|
2626
|
+
loadSpecifiedData: loadSpecifiedData
|
|
2562
2627
|
}),
|
|
2563
2628
|
showType == 3 && /*#__PURE__*/ _jsx("div", {
|
|
2564
2629
|
style: {
|
|
@@ -2583,7 +2648,7 @@ var CustomerService = function(props) {
|
|
|
2583
2648
|
showType == 4 && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
2584
2649
|
children: [
|
|
2585
2650
|
/*#__PURE__*/ _jsxs(Modal, {
|
|
2586
|
-
title: "
|
|
2651
|
+
title: "智能问答",
|
|
2587
2652
|
open: true,
|
|
2588
2653
|
onCancel: function() {
|
|
2589
2654
|
onCancel();
|
|
@@ -2591,6 +2656,7 @@ var CustomerService = function(props) {
|
|
|
2591
2656
|
},
|
|
2592
2657
|
centered: true,
|
|
2593
2658
|
width: window.innerWidth - 252 > 1214 ? window.innerWidth - 252 : 1214,
|
|
2659
|
+
// @ts-ignore
|
|
2594
2660
|
height: window.innerHeight - 160,
|
|
2595
2661
|
wrapClassName: "".concat(styles.ChatWindow_Modal),
|
|
2596
2662
|
footer: false,
|
|
@@ -2659,8 +2725,7 @@ var CustomerService = function(props) {
|
|
|
2659
2725
|
onClose: function() {
|
|
2660
2726
|
setShowHistory(false);
|
|
2661
2727
|
},
|
|
2662
|
-
loadSpecifiedData: loadSpecifiedData
|
|
2663
|
-
roomList: roomList
|
|
2728
|
+
loadSpecifiedData: loadSpecifiedData
|
|
2664
2729
|
})
|
|
2665
2730
|
]
|
|
2666
2731
|
})
|
|
@@ -2684,7 +2749,7 @@ var CustomerService = function(props) {
|
|
|
2684
2749
|
return e.roomId == roomId;
|
|
2685
2750
|
})[0].name ? roomList.filter(function(e) {
|
|
2686
2751
|
return e.roomId == roomId;
|
|
2687
|
-
})[0].name : "
|
|
2752
|
+
})[0].name : "智能问答"
|
|
2688
2753
|
})
|
|
2689
2754
|
}),
|
|
2690
2755
|
/*#__PURE__*/ _jsxs("div", {
|