bhd-components 0.5.6 → 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.
Files changed (115) hide show
  1. package/dist/5764783e.esm.es5.production.js +468 -0
  2. package/dist/f2b01b9c.esm.es5.development.js +167840 -0
  3. package/dist/index.esm.es5.development.css +8467 -0
  4. package/dist/index.esm.es5.development.js +5835 -0
  5. package/dist/index.esm.es5.production.css +1 -0
  6. package/dist/index.esm.es5.production.js +1 -0
  7. package/dist/vendor.esm.es5.development.esm.es5.development.css +117 -0
  8. package/dist/vendor.esm.es5.production.esm.es5.production.css +9 -0
  9. package/es2017/customerService/contactsList/index.d.ts +14 -0
  10. package/es2017/customerService/contactsList/index.js +316 -0
  11. package/es2017/customerService/contactsList/index.module.less +206 -0
  12. package/es2017/customerService/function.d.ts +17 -0
  13. package/es2017/customerService/function.js +72 -0
  14. package/es2017/customerService/historyFun/index.d.ts +14 -0
  15. package/es2017/customerService/historyFun/index.js +276 -0
  16. package/es2017/customerService/historyFun/index.module.less +223 -0
  17. package/es2017/customerService/images/knowledge_icon.png +0 -0
  18. package/es2017/customerService/images/voice_btn.gif +0 -0
  19. package/es2017/customerService/index.d.ts +16 -0
  20. package/es2017/customerService/index.js +2687 -0
  21. package/es2017/customerService/index.module.less +790 -0
  22. package/es2017/customerService/useMediaRecorder.d.ts +9 -0
  23. package/es2017/customerService/useMediaRecorder.js +78 -0
  24. package/es2017/customerService/voice_btn.gif +0 -0
  25. package/es2017/icons/components/custom-ai_icon.d.ts +4 -0
  26. package/es2017/icons/components/custom-ai_icon.js +58 -0
  27. package/es2017/icons/components/custom-contacts.d.ts +4 -0
  28. package/es2017/icons/components/custom-contacts.js +29 -0
  29. package/es2017/icons/components/custom-copy.d.ts +4 -0
  30. package/es2017/icons/components/custom-copy.js +36 -0
  31. package/es2017/icons/components/custom-dislike.d.ts +4 -0
  32. package/es2017/icons/components/custom-dislike.js +22 -0
  33. package/es2017/icons/components/custom-duihao.d.ts +4 -0
  34. package/es2017/icons/components/custom-duihao.js +22 -0
  35. package/es2017/icons/components/custom-exit_full_screen.d.ts +4 -0
  36. package/es2017/icons/components/custom-exit_full_screen.js +26 -0
  37. package/es2017/icons/components/custom-full_screen.d.ts +4 -0
  38. package/es2017/icons/components/custom-full_screen.js +22 -0
  39. package/es2017/icons/components/custom-like.d.ts +4 -0
  40. package/es2017/icons/components/custom-like.js +22 -0
  41. package/es2017/icons/components/custom-quote.d.ts +4 -0
  42. package/es2017/icons/components/custom-quote.js +31 -0
  43. package/es2017/icons/components/custom-record.d.ts +4 -0
  44. package/es2017/icons/components/custom-record.js +37 -0
  45. package/es2017/icons/components/custom-reloading.d.ts +4 -0
  46. package/es2017/icons/components/custom-reloading.js +26 -0
  47. package/es2017/icons/components/custom-retract.d.ts +4 -0
  48. package/es2017/icons/components/custom-retract.js +27 -0
  49. package/es2017/icons/components/custom-round_close.d.ts +4 -0
  50. package/es2017/icons/components/custom-round_close.js +24 -0
  51. package/es2017/icons/components/custom-sending.d.ts +4 -0
  52. package/es2017/icons/components/custom-sending.js +22 -0
  53. package/es2017/icons/components/custom-sound_recording.d.ts +4 -0
  54. package/es2017/icons/components/custom-sound_recording.js +22 -0
  55. package/es2017/icons/components/index.d.ts +15 -0
  56. package/es2017/icons/components/index.js +15 -0
  57. package/es2017/index.d.ts +1 -0
  58. package/es2017/index.js +1 -0
  59. package/esm/customerService/contactsList/index.d.ts +14 -0
  60. package/esm/customerService/contactsList/index.js +333 -0
  61. package/esm/customerService/contactsList/index.module.less +206 -0
  62. package/esm/customerService/function.d.ts +17 -0
  63. package/esm/customerService/function.js +74 -0
  64. package/esm/customerService/historyFun/index.d.ts +14 -0
  65. package/esm/customerService/historyFun/index.js +289 -0
  66. package/esm/customerService/historyFun/index.module.less +223 -0
  67. package/esm/customerService/images/knowledge_icon.png +0 -0
  68. package/esm/customerService/images/voice_btn.gif +0 -0
  69. package/esm/customerService/index.d.ts +16 -0
  70. package/esm/customerService/index.js +2793 -0
  71. package/esm/customerService/index.module.less +790 -0
  72. package/esm/customerService/useMediaRecorder.d.ts +9 -0
  73. package/esm/customerService/useMediaRecorder.js +121 -0
  74. package/esm/customerService/voice_btn.gif +0 -0
  75. package/esm/icons/components/custom-ai_icon.d.ts +4 -0
  76. package/esm/icons/components/custom-ai_icon.js +60 -0
  77. package/esm/icons/components/custom-contacts.d.ts +4 -0
  78. package/esm/icons/components/custom-contacts.js +31 -0
  79. package/esm/icons/components/custom-copy.d.ts +4 -0
  80. package/esm/icons/components/custom-copy.js +38 -0
  81. package/esm/icons/components/custom-dislike.d.ts +4 -0
  82. package/esm/icons/components/custom-dislike.js +24 -0
  83. package/esm/icons/components/custom-duihao.d.ts +4 -0
  84. package/esm/icons/components/custom-duihao.js +24 -0
  85. package/esm/icons/components/custom-exit_full_screen.d.ts +4 -0
  86. package/esm/icons/components/custom-exit_full_screen.js +28 -0
  87. package/esm/icons/components/custom-full_screen.d.ts +4 -0
  88. package/esm/icons/components/custom-full_screen.js +24 -0
  89. package/esm/icons/components/custom-like.d.ts +4 -0
  90. package/esm/icons/components/custom-like.js +24 -0
  91. package/esm/icons/components/custom-quote.d.ts +4 -0
  92. package/esm/icons/components/custom-quote.js +33 -0
  93. package/esm/icons/components/custom-record.d.ts +4 -0
  94. package/esm/icons/components/custom-record.js +39 -0
  95. package/esm/icons/components/custom-reloading.d.ts +4 -0
  96. package/esm/icons/components/custom-reloading.js +28 -0
  97. package/esm/icons/components/custom-retract.d.ts +4 -0
  98. package/esm/icons/components/custom-retract.js +29 -0
  99. package/esm/icons/components/custom-round_close.d.ts +4 -0
  100. package/esm/icons/components/custom-round_close.js +26 -0
  101. package/esm/icons/components/custom-sending.d.ts +4 -0
  102. package/esm/icons/components/custom-sending.js +24 -0
  103. package/esm/icons/components/custom-sound_recording.d.ts +4 -0
  104. package/esm/icons/components/custom-sound_recording.js +24 -0
  105. package/esm/icons/components/index.d.ts +15 -0
  106. package/esm/icons/components/index.js +15 -0
  107. package/esm/index.d.ts +1 -0
  108. package/esm/index.js +1 -0
  109. package/package.json +11 -2
  110. package/dist/1951bd5c.esm.es5.development.js +0 -45417
  111. package/dist/28cd83d3.esm.es5.production.js +0 -256
  112. package/dist/table.esm.es5.development.css +0 -772
  113. package/dist/table.esm.es5.development.js +0 -289
  114. package/dist/table.esm.es5.production.css +0 -1
  115. package/dist/table.esm.es5.production.js +0 -1
@@ -0,0 +1,2793 @@
1
+ /* eslint-disable import/first */ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
+ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
+ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
5
+ import React, { useEffect, useState, useRef } from "react";
6
+ import { Modal, Drawer, Input, Tooltip } from "antd";
7
+ import styles from "./index.module.less";
8
+ // const inOnline = process.env.NODE_TYPE === "online";
9
+ 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/index";
12
+ import ContactsList from "./contactsList/index";
13
+ // import dayjs from 'dayjs';
14
+ import { Remarkable } from "remarkable";
15
+ import hljs from "highlight.js";
16
+ import "highlight.js/styles/default.css";
17
+ import { render } from "react-dom";
18
+ import Provider from "../provider";
19
+ var TextArea = Input.TextArea;
20
+ import knowledge_icon from "./images/knowledge_icon.png";
21
+ import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
22
+ import { readMessage, getByteLen, serverUrl, copyText, getDataTime } from "./function"; //一些方法
23
+ var CustomerService = function(props) {
24
+ var userData = props.userData, http = props.http, urllocation = props.urllocation, onCancel = props.onCancel, serverName = props.serverName, fetchEventSource = props.fetchEventSource, initShowType = props.initShowType, onEvent = props.onEvent, stepIds = props.stepIds, stepId = props.stepId;
25
+ // urllocation = "/zhong";
26
+ var _useState = _sliced_to_array(useState(props.userData.mid), 2), mid = _useState[0], setmid = _useState[1]; //当前用户id
27
+ var _useMediaRecorder = useMediaRecorder(), bese64String = _useMediaRecorder.bese64String, startRecord = _useMediaRecorder.startRecord, stopRecord = _useMediaRecorder.stopRecord; //语音转文字
28
+ var _useState1 = _sliced_to_array(useState(3), 2), voiceRecordingStatus = _useState1[0], setVoiceRecordingStatus = _useState1[1]; //语音录制状态 3,语音识别完成 2,录制中, 1,录制结束
29
+ var _useState2 = _sliced_to_array(useState([]), 2), copyTextOBJ = _useState2[0], setCopyTextObj = _useState2[1]; //复制的消息id
30
+ var _useState3 = _sliced_to_array(useState({}), 2), citationContent = _useState3[0], setCitationContent = _useState3[1]; //引用内容
31
+ var _useState4 = _sliced_to_array(useState(""), 2), roomId = _useState4[0], setRoomId = _useState4[1]; //聊天室id
32
+ var _useState5 = _sliced_to_array(useState([]), 2), historyMessageList = _useState5[0], setHistoryMessageList = _useState5[1]; //历史消息
33
+ var _useState6 = _sliced_to_array(useState(""), 2), keyWord = _useState6[0], setKeyWord = _useState6[1]; //搜索内容
34
+ var _useState7 = _sliced_to_array(useState([]), 2), questionsList = _useState7[0], setQuestionsList = _useState7[1]; //问题列表
35
+ var _useState8 = _sliced_to_array(useState([]), 2), hotQuestionsList = _useState8[0], setHotQuestionsList = _useState8[1]; //热门问题
36
+ var _useState9 = _sliced_to_array(useState(false), 2), greetingMessage = _useState9[0], setGreetingMessage = _useState9[1]; //聊天记录列表是否请求完成
37
+ var _useState10 = _sliced_to_array(useState(1), 2), pageNum = _useState10[0], setPageNum = _useState10[1]; //页码
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保存,用来在实验报告中记录
55
+ var timer = useRef(null); //文本框输入时
56
+ var receiveMessageTimer = useRef(null); //接收ai发回的消息
57
+ var voiceCountdownTimer = useRef(null); //语音录制倒计时
58
+ var listTimer = useRef(null); // 请求列表倒计时
59
+ var roomMessage = useRef(null); //循环当前页面的新消息
60
+ var ctrl = useRef(); //停止生成ai回答时使用
61
+ var childRef = useRef(null); //获取子组件方法
62
+ var remarkable = new Remarkable({
63
+ highlight: function highlight(str, lang) {
64
+ if (lang && hljs.getLanguage(lang)) {
65
+ try {
66
+ return hljs.highlight(lang, str).value;
67
+ } catch (err) {}
68
+ }
69
+ try {
70
+ return hljs.highlightAuto(str).value;
71
+ } catch (err) {}
72
+ return ""; // use external default escaping
73
+ }
74
+ });
75
+ useEffect(function() {
76
+ return function() {
77
+ clearTimeout(receiveMessageTimer.current);
78
+ clearTimeout(voiceCountdownTimer.current);
79
+ clearTimeout(listTimer.current);
80
+ clearTimeout(timer.current);
81
+ clearTimeout(roomMessage.current);
82
+ };
83
+ }, []);
84
+ useEffect(function() {
85
+ var handleScroll = function handleScroll() {
86
+ var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
87
+ var scrollTop = container.scrollTop;
88
+ // const scrollBottom = container.scroll;
89
+ // console.log(container,'sdcsdcsdcsdc');
90
+ container.onscroll = function(e) {
91
+ //元素内部页面滚动到达底部
92
+ if (e.target.clientHeight + e.target.scrollTop >= e.target.scrollHeight) {
93
+ //console.log('元素内部页面滚动到达底部');
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);
101
+ clearTimeout(listTimer.current);
102
+ setBottomLoading(true);
103
+ listTimer.current = setTimeout(function() {
104
+ console.log("加载下一页", number);
105
+ getHistoryMessage(number, 4);
106
+ }, 1000);
107
+ }
108
+ }
109
+ };
110
+ if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
111
+ setLoading(true);
112
+ var number = pageNum + 1;
113
+ setPageNum(function(pageNum) {
114
+ return pageNum + 1;
115
+ });
116
+ clearTimeout(listTimer.current);
117
+ listTimer.current = setTimeout(function() {
118
+ console.log("下拉加载下一页", number);
119
+ getHistoryMessage(number, 2);
120
+ }, 1000);
121
+ }
122
+ };
123
+ if (showType != 1 && !firstLoad && pageCount > 0) {
124
+ setFirstLoad(true);
125
+ setTimeout(function() {
126
+ scrollToBottom();
127
+ }, 100);
128
+ }
129
+ var content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
130
+ if (content) {
131
+ content.addEventListener("scroll", handleScroll);
132
+ }
133
+ return function() {
134
+ var content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
135
+ if (content) {
136
+ content.removeEventListener("scroll", handleScroll);
137
+ }
138
+ };
139
+ }, [
140
+ historyMessageList,
141
+ showType,
142
+ pageCount
143
+ ]);
144
+ useEffect(function() {
145
+ resettingBottomHei();
146
+ var dom = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
147
+ if (dom) {
148
+ if (showType == 1) {
149
+ dom.style.maxHeight = "".concat(window.innerHeight - 60 - buttomHei, "px");
150
+ } else if (showType == 3) {
151
+ dom.style.maxHeight = "".concat(window.innerHeight - 114 - buttomHei, "px");
152
+ } else {
153
+ dom.style.maxHeight = "".concat(window.innerHeight - 160 - 62 - buttomHei, "px");
154
+ }
155
+ }
156
+ }, [
157
+ buttomHei,
158
+ showType
159
+ ]);
160
+ useEffect(function() {
161
+ // console.log(props,'lsdkcmsdlcksd')
162
+ getQuestiionsList("", 1);
163
+ scrollToBottom();
164
+ // less.modifyVars({ "@color-border-Tr": "#f4523b" });
165
+ setShowType(initShowType);
166
+ }, [
167
+ initShowType
168
+ ]);
169
+ useEffect(function() {
170
+ // console.log(roomId,1111111)
171
+ if (roomId != "") {
172
+ if (lastId == "") {
173
+ getHistoryMessage(pageNum, 2);
174
+ } else {
175
+ //查看历史记录,需要定位到当前记录
176
+ getHistoryMessage(pageNum, 1);
177
+ }
178
+ }
179
+ }, [
180
+ roomId
181
+ ]);
182
+ useEffect(function() {
183
+ if (roomList.length == 0) {
184
+ createRooms("AI").then(function(res) {
185
+ setRoomId(res.data.id);
186
+ setRoomList([
187
+ {
188
+ roomId: res.data.id,
189
+ unreadCount: 0,
190
+ uid: mid,
191
+ sender: "AI"
192
+ }
193
+ ]);
194
+ });
195
+ } else {
196
+ setRoomList(roomList);
197
+ }
198
+ // recordRef.current.roomList=JSON.parse(JSON.stringify(roomList))
199
+ }, [
200
+ roomList
201
+ ]);
202
+ //进入页面,发送打招呼信息
203
+ useEffect(function() {
204
+ // console.log(historyMessageList, "dkjvndfkjvd33333f");
205
+ //老师的聊天窗口不发送打招呼信息
206
+ if (!(roomList.length > 0 && roomList[0].roomId != roomId)) {
207
+ //是否发送打招呼信息
208
+ if (greetingMessage && historyMessageList.length == 0) {
209
+ sendGreetingMessage(1);
210
+ } else {
211
+ try {
212
+ if (historyMessageList[historyMessageList.length - 1].extraInfo == null) {
213
+ sendGreetingMessage(1);
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")) {
215
+ // console.log(
216
+ // JSON.parse(
217
+ // historyMessageList[historyMessageList.length - 1].extraInfo,
218
+ // "sdklsdksd"
219
+ // )
220
+ // );
221
+ sendGreetingMessage(1);
222
+ }
223
+ } catch (error) {}
224
+ }
225
+ }
226
+ scrollToBottom();
227
+ }, [
228
+ greetingMessage,
229
+ hotQuestionsList
230
+ ]);
231
+ //语音转文字
232
+ useEffect(function() {
233
+ if (bese64String != "") {
234
+ speechToText();
235
+ }
236
+ //发送给后端语音brse64
237
+ }, [
238
+ bese64String
239
+ ]);
240
+ //AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
241
+ var sendGreetingMessage = function(type) {
242
+ var questionsList = [];
243
+ var obj = {};
244
+ if (type == 1) {
245
+ questionsList = hotQuestionsList.map(function(item, index) {
246
+ if (index < 3) {
247
+ return {
248
+ key: "messageSource",
249
+ value: item.id,
250
+ question: item.question,
251
+ answer: item.answer
252
+ };
253
+ } else {
254
+ return null;
255
+ }
256
+ });
257
+ questionsList = questionsList.filter(function(i) {
258
+ return i != null;
259
+ });
260
+ obj = {
261
+ roomId: roomId,
262
+ sender: "AI",
263
+ recevier: mid,
264
+ message: "Hi!我是有问必答的实训云智能客服,请问您遇到了什么问题?",
265
+ extraInfos: questionsList
266
+ };
267
+ } else if (type == 2) {
268
+ obj = {
269
+ roomId: roomId,
270
+ sender: "AI",
271
+ recevier: mid,
272
+ message: "您的点赞是我最大的鼓励!",
273
+ createdAt: getDataTime(-1),
274
+ extraInfos: [
275
+ {
276
+ key: "messageSource",
277
+ value: "knowledgebase"
278
+ }
279
+ ]
280
+ };
281
+ } else if (type == 3) {
282
+ obj = {
283
+ roomId: roomId,
284
+ sender: "AI",
285
+ recevier: mid,
286
+ message: "谢谢您的反馈,我会努力改进的!",
287
+ createdAt: getDataTime(-1),
288
+ extraInfos: [
289
+ {
290
+ key: "messageSource",
291
+ value: "knowledgebase"
292
+ }
293
+ ]
294
+ };
295
+ } else if (type == 4) {
296
+ obj = {
297
+ roomId: roomId,
298
+ sender: mid,
299
+ recevier: "AI",
300
+ message: keyWord,
301
+ createdAt: getDataTime(-1),
302
+ quotedMessage: citationContent.content,
303
+ extraInfos: [
304
+ {
305
+ key: "messageSource",
306
+ value: "knowledgebase"
307
+ }
308
+ ]
309
+ };
310
+ } else if (type == 5) {
311
+ obj = {
312
+ roomId: roomId,
313
+ sender: "AI",
314
+ recevier: mid,
315
+ message: "抱歉!您今日的提问量已经达到最大限额,请您明日再来提问。",
316
+ createdAt: getDataTime(-1),
317
+ quotedMessage: citationContent.content,
318
+ extraInfos: [
319
+ {
320
+ key: "messageSource",
321
+ value: "knowledgebase"
322
+ }
323
+ ]
324
+ };
325
+ } else if (type == 6) {
326
+ questionsList = hotQuestionsList.map(function(item) {
327
+ return {
328
+ key: "messageSource",
329
+ value: item.id,
330
+ question: item.question,
331
+ answer: item.answer
332
+ };
333
+ });
334
+ obj = {
335
+ roomId: roomId,
336
+ sender: "AI",
337
+ recevier: mid,
338
+ message: "猜你想问:",
339
+ extraInfos: questionsList
340
+ };
341
+ }
342
+ setKeyWord("");
343
+ setQuestionsList([]);
344
+ setCitationContent({});
345
+ http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj, {
346
+ headers: {
347
+ "x-module-id": userData.modules.find(function(ele) {
348
+ return ele.short == "IntelligentCustomerService";
349
+ }).id,
350
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
351
+ }
352
+ }).then(function(res) {
353
+ if (res.data.id) {
354
+ setHistoryMessageList(function(historyMessageList) {
355
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
356
+ id: res.data.id,
357
+ upvoted: false,
358
+ downvoted: false,
359
+ quotedMessage: "",
360
+ createdAt: getDataTime(-1),
361
+ extraInfo: JSON.stringify(obj.extraInfos)
362
+ }));
363
+ return newHistoryMessageList;
364
+ });
365
+ scrollToBottom();
366
+ if (type == 4) {
367
+ sendGreetingMessage(6);
368
+ }
369
+ }
370
+ }).catch(function(err) {
371
+ console.log(err);
372
+ });
373
+ };
374
+ //消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
375
+ var sendToTeacher = function(type) {
376
+ console.log("消息发送给老师111");
377
+ var obj = {};
378
+ if (type == 1) {
379
+ obj = {
380
+ roomId: roomId,
381
+ sender: mid,
382
+ recevier: chatWith.uid,
383
+ message: problem.question
384
+ };
385
+ setProblem({});
386
+ } else if (type == 2) {
387
+ var list = roomList.filter(function(item) {
388
+ return item.roomId == roomId;
389
+ });
390
+ var recevier = "";
391
+ if (list.length > 0) {
392
+ recevier = list[0].sender;
393
+ }
394
+ obj = {
395
+ roomId: roomId,
396
+ sender: mid,
397
+ recevier: recevier,
398
+ message: keyWord,
399
+ quotedMessage: citationContent.content || ""
400
+ };
401
+ }
402
+ http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj, {
403
+ headers: {
404
+ "x-module-id": userData.modules.find(function(ele) {
405
+ return ele.short == "TeacherAnswer";
406
+ }).id,
407
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
408
+ }
409
+ }).then(function(res) {
410
+ if (res.data.id) {
411
+ setHistoryMessageList(function(historyMessageList) {
412
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
413
+ id: res.data.id,
414
+ upvoted: false,
415
+ downvoted: false,
416
+ createdAt: getDataTime(-1)
417
+ }));
418
+ return newHistoryMessageList;
419
+ });
420
+ scrollToBottom();
421
+ //记录一个问题id,用于记录老师和学生之间的聊天保存到实验报告中
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 = [
427
+ {
428
+ "roomId": roomId,
429
+ "id": res.data.id
430
+ }
431
+ ];
432
+ setChatObj(function(list) {
433
+ var list2 = list.filter(function(item) {
434
+ return item.id != roomList[0].id;
435
+ });
436
+ return list2.concat(roomList);
437
+ });
438
+ }
439
+ // }
440
+ }
441
+ }).catch(function(err) {
442
+ console.log(err);
443
+ });
444
+ };
445
+ //发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2 是普通消息
446
+ var sendMessage = function(item, flag) {
447
+ var questions = [];
448
+ if (item && flag) {
449
+ questions = [
450
+ item
451
+ ];
452
+ }
453
+ //点击知识库的问题,或者是点击问候消息
454
+ if (questions.length > 0) {
455
+ questions = questions[0];
456
+ //向知识库发送问题 type 1,发送问题 2 发送答案 obj 需要的参数
457
+ var obj = {
458
+ roomId: roomId,
459
+ sender: mid,
460
+ recevier: "AI",
461
+ message: questions.question,
462
+ extraInfos: [
463
+ {
464
+ key: "questionId",
465
+ value: flag == 1 ? questions.value : questions.id
466
+ }
467
+ ]
468
+ };
469
+ //发送问题 1 类型,发送问题需要的参数,问题的答案id等
470
+ sendingExistingIssues(1, obj, {
471
+ key: "questionId",
472
+ value: flag == 1 ? questions.value : questions.id,
473
+ answer: questions.answer
474
+ });
475
+ setKeyWord("");
476
+ setQuestionsList([]);
477
+ setCitationContent({});
478
+ } else if (userData.modules.some(function(item) {
479
+ return item.short == "AIservice";
480
+ })) {
481
+ setHistoryMessageList(function(historyMessageList) {
482
+ var newHistoryMessageList = historyMessageList.concat({
483
+ roomId: roomId,
484
+ sender: mid,
485
+ recevier: "AI",
486
+ message: keyWord,
487
+ quotedMessage: citationContent.content,
488
+ id: "654321",
489
+ upvoted: false,
490
+ downvoted: false,
491
+ createdAt: getDataTime(-1),
492
+ extraInfo: JSON.stringify([])
493
+ });
494
+ return newHistoryMessageList;
495
+ });
496
+ setFinished(false);
497
+ aiSendQuestions(3, {
498
+ //相关数据
499
+ roomId: roomId,
500
+ message: keyWord,
501
+ quotedMessage: citationContent.content || "",
502
+ regenerate: citationContent.content != "" ? false : true,
503
+ generateUpvoteOrDownvoteMessage: false
504
+ }, 1);
505
+ //存在AI客服
506
+ } else {
507
+ //不存在AI客服
508
+ sendGreetingMessage(4);
509
+ }
510
+ };
511
+ //向知识库发送问题 或答案 type:1 发送问题 2 接受答案
512
+ var sendingExistingIssues = function(type, obj, questions) {
513
+ setHistoryMessageList(function(historyMessageList) {
514
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
515
+ id: null,
516
+ upvoted: false,
517
+ downvoted: false,
518
+ createdAt: getDataTime(-1),
519
+ extraInfo: JSON.stringify(obj.extraInfos)
520
+ }));
521
+ return newHistoryMessageList;
522
+ });
523
+ scrollToBottom();
524
+ http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj, {
525
+ headers: {
526
+ "x-module-id": userData.modules.find(function(ele) {
527
+ return ele.short == "IntelligentCustomerService";
528
+ }).id,
529
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
530
+ }
531
+ }).then(function(res) {
532
+ if (res.data.id) {
533
+ //更新聊天记录id
534
+ setHistoryMessageList(function(historyMessageList) {
535
+ var newHistoryMessageList = historyMessageList.map(function(item) {
536
+ if (item.id == null) {
537
+ return _object_spread_props(_object_spread({}, item), {
538
+ id: res.data.id
539
+ });
540
+ } else {
541
+ return item;
542
+ }
543
+ });
544
+ return newHistoryMessageList;
545
+ });
546
+ }
547
+ if (type == 1) {
548
+ //发送答案,调用自动回答
549
+ var dataObj = {
550
+ roomId: roomId,
551
+ sender: "AI",
552
+ recevier: mid,
553
+ message: questions.answer,
554
+ extraInfos: [
555
+ {
556
+ key: "questionId",
557
+ value: questions.value
558
+ }
559
+ ]
560
+ };
561
+ sendingExistingIssues(2, dataObj, "");
562
+ testLabQuestion(obj.message, questions.answer, "");
563
+ }
564
+ }).then(function(res) {
565
+ console.log(res);
566
+ });
567
+ };
568
+ //向AI发送问题 type == 1 发送点赞或踩消息,type == 2 发送重新生成消息,type == 3 正常发送消息
569
+ var content = ""; //用于实验报告的问题记录
570
+ var aiSendQuestions = function(type, obj, id) {
571
+ content = "";
572
+ // if (type == 3) {
573
+ // try {
574
+ // if (ctrl && ctrl.current) {
575
+ // ctrl.current.abort();
576
+ // }
577
+ // } catch (error) {}
578
+ // clearTimeout(receiveMessageTimer.current);
579
+ // setHistoryMessageList((historyMessageList) => {
580
+ // return historyMessageList.filter((item) => item.id != "123456");
581
+ // });
582
+ // setFinished(true);
583
+ // return;
584
+ // }
585
+ ctrl.current = new AbortController();
586
+ clearTimeout(receiveMessageTimer.current);
587
+ receiveMessageTimer.current = setTimeout(function() {
588
+ // console.log('超时终止1111')
589
+ setHistoryMessageList(function(historyMessageList) {
590
+ return historyMessageList.filter(function(item) {
591
+ return item.id != "123456" && item.id != "654321";
592
+ });
593
+ });
594
+ setFinished(true);
595
+ ctrl.current.abort();
596
+ setHistoryMessageList(function(historyMessageList) {
597
+ return historyMessageList.concat({
598
+ roomId: roomId,
599
+ sender: "AI",
600
+ recevier: mid,
601
+ message: "网络异常,请稍后重试!",
602
+ id: "123456",
603
+ createdAt: getDataTime(-1),
604
+ extraInfo: null
605
+ });
606
+ });
607
+ }, 60 * 1000);
608
+ var data = JSON.stringify(obj);
609
+ // if (type == 1 || type == 2) {
610
+ // data = JSON.stringify(obj);
611
+ // } else if(type == 3){
612
+ // data = JSON.stringify({
613
+ // //相关数据
614
+ // roomId: roomId,
615
+ // message: keyWord,
616
+ // quotedMessage: citationContent.content || "",
617
+ // regenerate: citationContent.content != "" ? false : true,
618
+ // generateUpvoteOrDownvoteMessage: false,
619
+ // });
620
+ // }
621
+ setKeyWord("");
622
+ setQuestionsList([]);
623
+ setTimeout(function() {
624
+ setQuestionsList([]);
625
+ }, 2000);
626
+ //占位信息
627
+ setHistoryMessageList(function(historyMessageList) {
628
+ if (type == 2) {
629
+ return historyMessageList.map(function(item) {
630
+ if (item.id == id) {
631
+ return {
632
+ roomId: roomId,
633
+ sender: "AI",
634
+ recevier: mid,
635
+ message: "正在输入...",
636
+ id: "123456",
637
+ createdAt: getDataTime(-1),
638
+ extraInfo: null
639
+ };
640
+ } else {
641
+ return item;
642
+ }
643
+ });
644
+ } else {
645
+ return historyMessageList.concat({
646
+ roomId: roomId,
647
+ sender: "AI",
648
+ recevier: mid,
649
+ message: "正在输入...",
650
+ id: "123456",
651
+ createdAt: getDataTime(-1),
652
+ extraInfo: null
653
+ });
654
+ }
655
+ });
656
+ setTimeout(function() {
657
+ scrollToBottom();
658
+ }, 10);
659
+ //使用fetchEventSource接收数据
660
+ var eventSource = fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
661
+ method: "POST",
662
+ headers: {
663
+ "Content-Type": "application/json",
664
+ Accept: "text/event-stream,application/json",
665
+ "X-Auth-Jwt": window.localStorage.getItem("usertoken") || "",
666
+ "Auth-Token": userData.token,
667
+ "X-Module-Id": userData.modules.find(function(ele) {
668
+ return ele.short == "AIservice";
669
+ }).id
670
+ },
671
+ body: data,
672
+ signal: ctrl.current.signal,
673
+ openWhenHidden: true,
674
+ onopen: function onopen(res) {
675
+ console.info("eventSource open: ", res);
676
+ clearTimeout(receiveMessageTimer.current);
677
+ if (res.status >= 300) {
678
+ console.log("sdckjsdncskdcjsdc", res.status);
679
+ setFinished(true);
680
+ setHistoryMessageList(function(historyMessageList) {
681
+ return historyMessageList.filter(function(item) {
682
+ return item.id != "123456" && item.id != "654321";
683
+ });
684
+ });
685
+ ctrl.current.abort();
686
+ }
687
+ if (res.status == 200) {
688
+ setFinished(false);
689
+ }
690
+ if (res.status == 401) {
691
+ //身份认证未通过,从新请求新的token后再次发送请求
692
+ verifyJWT(urllocation).then(function() {
693
+ console.log("重新请求");
694
+ setHistoryMessageList(function(historyMessageList) {
695
+ return historyMessageList.filter(function(item) {
696
+ return item.id != "123456" && item.id != "654321";
697
+ });
698
+ });
699
+ aiSendQuestions(type, obj, id);
700
+ });
701
+ }
702
+ if (res.status == 403) {
703
+ //暂无权限
704
+ console.log("暂无权限");
705
+ setHistoryMessageList(function(historyMessageList) {
706
+ return historyMessageList.concat({
707
+ roomId: roomId,
708
+ sender: "AI",
709
+ recevier: mid,
710
+ message: "暂无权限",
711
+ id: "123456",
712
+ createdAt: "",
713
+ extraInfo: null
714
+ });
715
+ });
716
+ }
717
+ if (res.status == 429) {
718
+ //同一时间只允许进行一个对话。
719
+ }
720
+ if (res.status == 429) {
721
+ //每天问答的 Token 数必须小于等于 10 万。
722
+ sendGreetingMessage(5);
723
+ }
724
+ if (res.status == 500) {
725
+ // 系统错误,请稍后再试。
726
+ setHistoryMessageList(function(historyMessageList) {
727
+ return historyMessageList.concat({
728
+ roomId: roomId,
729
+ sender: "AI",
730
+ recevier: mid,
731
+ message: "系统出错了,请稍后重试!",
732
+ id: "123456",
733
+ createdAt: "",
734
+ extraInfo: null
735
+ });
736
+ });
737
+ }
738
+ },
739
+ onerror: function onerror(err) {
740
+ console.log(err, "dflkvdmfvlkdfv");
741
+ var state = err.response;
742
+ setHistoryMessageList(function(historyMessageList) {
743
+ return historyMessageList.concat({
744
+ roomId: roomId,
745
+ sender: "AI",
746
+ recevier: mid,
747
+ message: "系统出错了,请稍后重试!",
748
+ id: "123456",
749
+ createdAt: "",
750
+ extraInfo: null
751
+ });
752
+ });
753
+ },
754
+ onmessage: function onmessage(event) {
755
+ //识别的内容
756
+ // console.log("eventSource msg: ", event.data);
757
+ var msg = JSON.parse(event.data);
758
+ if (msg.message) {
759
+ content = content + msg.message;
760
+ renderAiAnswer(msg, id, type);
761
+ }
762
+ if (msg.finished) {
763
+ setFinished(true); //发送结束
764
+ testLabQuestion(JSON.parse(data).message, content, "");
765
+ }
766
+ },
767
+ onclose: function onclose() {
768
+ setFinished(true); //发送结束
769
+ setHistoryMessageList(function(historyMessageList) {
770
+ return historyMessageList.filter(function(item) {
771
+ return item.id != "123456";
772
+ });
773
+ });
774
+ }
775
+ });
776
+ };
777
+ //渲染AI回答
778
+ var renderAiAnswer = function(msg, message_id, type) {
779
+ // console.log(aiSendQuestions().abort(),'slkdsdsdsd')
780
+ var obj = msg;
781
+ var id = msg.messageId;
782
+ setHistoryMessageList(function(historyMessageList) {
783
+ var list1 = historyMessageList;
784
+ //删除临时数据
785
+ list1 = list1.filter(function(item) {
786
+ return item.id != "123456";
787
+ });
788
+ //重新生成答案时,使用原来的消息
789
+ if (message_id != undefined) {
790
+ list1 = list1.filter(function(item) {
791
+ return item.id != message_id;
792
+ });
793
+ }
794
+ var list = historyMessageList.filter(function(item) {
795
+ return item.id == id;
796
+ });
797
+ var message = "";
798
+ if (list.length == 0) {
799
+ message = obj.message;
800
+ var newHistoryMessageList = list1.concat({
801
+ roomId: roomId,
802
+ sender: "AI",
803
+ recevier: mid,
804
+ message: message,
805
+ id: id,
806
+ upvoted: false,
807
+ downvoted: false,
808
+ createdAt: getDataTime(-1),
809
+ extraInfo: type == 1 ? JSON.stringify([
810
+ {
811
+ key: "isVoteMessage",
812
+ value: true
813
+ }
814
+ ]) : null
815
+ });
816
+ return newHistoryMessageList;
817
+ } else {
818
+ var newHistoryMessageList2 = list1.map(function(item) {
819
+ message = item.message + obj.message;
820
+ if (item.id == id) {
821
+ return _object_spread_props(_object_spread({}, item), {
822
+ message: message
823
+ });
824
+ } else {
825
+ return item;
826
+ }
827
+ });
828
+ return newHistoryMessageList2;
829
+ }
830
+ });
831
+ setTimeout(function() {
832
+ scrollToBottom();
833
+ }, 10);
834
+ };
835
+ //问题记录到实验报告中
836
+ var testLabQuestion = function(title, content, teachId) {
837
+ // console.log(title,content,'记录到实验报告中')
838
+ if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
839
+ http.post("".concat(urllocation, "/sandboxes/public/v1.0/labquestion"), {
840
+ title: title,
841
+ content: content,
842
+ teachId: teachId != undefined ? teachId : chatWith.uid | mid,
843
+ stepId: stepId,
844
+ stepIds: stepIds
845
+ }, {
846
+ headers: {
847
+ "x-module-id": userData.modules.find(function(ele) {
848
+ return ele.short == "IntelligentCustomerService";
849
+ }).id,
850
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
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
+ });
860
+ });
861
+ }
862
+ };
863
+ //语音转文字
864
+ var speechToText = function() {
865
+ http.post("".concat(urllocation, "/chat-service/public/v1.0/speech:recognize"), {
866
+ audio: bese64String
867
+ }, {
868
+ headers: {
869
+ "x-module-id": userData.modules.find(function(ele) {
870
+ return ele.short == "AIservice";
871
+ }).id,
872
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
873
+ }
874
+ }).then(function(res) {
875
+ setVoiceRecordingStatus(3);
876
+ if (res.data) {
877
+ setKeyWord(res.data.text);
878
+ resettingBottomHei();
879
+ }
880
+ }).catch(function(err) {
881
+ setKeyWord("");
882
+ setVoiceRecordingStatus(3);
883
+ });
884
+ };
885
+ //创建聊天室
886
+ var createRooms = function(uid) {
887
+ return http.post("".concat(urllocation, "/chat-service/public/v1.0/rooms"), {
888
+ chatWith: uid
889
+ }, {
890
+ headers: {
891
+ "x-module-id": userData.modules.find(function(ele) {
892
+ return ele.short == "IntelligentCustomerService";
893
+ }).id,
894
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
895
+ }
896
+ });
897
+ };
898
+ //获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
899
+ var getHistoryMessage = function(pageNum, flag) {
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;
916
+ return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
917
+ params: {
918
+ roomId: rid,
919
+ page: pageNum ? pageNum : 1,
920
+ maxPageSize: 30,
921
+ direction: "desc"
922
+ },
923
+ headers: {
924
+ "x-module-id": userData.modules.find(function(ele) {
925
+ return ele.short == "IntelligentCustomerService";
926
+ }).id,
927
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
928
+ }
929
+ }).then(function(res) {
930
+ var totalNumber = 0;
931
+ var roomList = [];
932
+ setRoomList(function(list) {
933
+ roomList = list;
934
+ return list;
935
+ });
936
+ if (res.data.messages.length > 0) {
937
+ clearTimeout(listTimer.current);
938
+ var total = res.data.total;
939
+ var maxPageSize = 30;
940
+ var dataList = res.data.messages.reverse();
941
+ setPageCount(Math.ceil(total / maxPageSize));
942
+ var newHistoryMessageList = [];
943
+ setHistoryMessageList(function(historyMessageList) {
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;
955
+ } else {
956
+ newHistoryMessageList = dataList.concat(historyMessageList);
957
+ }
958
+ }
959
+ if (flag == 3) {
960
+ newHistoryMessageList = dataList;
961
+ }
962
+ //去重
963
+ var _$res = new Map();
964
+ newHistoryMessageList = newHistoryMessageList.filter(function(a) {
965
+ return !_$res.has(a.id) && _$res.set(a.id, 1);
966
+ });
967
+ totalNumber = newHistoryMessageList.length;
968
+ return newHistoryMessageList;
969
+ });
970
+ //如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
971
+ try {
972
+ if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
973
+ fildChatRecords(newHistoryMessageList);
974
+ }
975
+ } catch (error) {}
976
+ if (flag != 4) {
977
+ if (pageNum == 1 && (flag == 2 || flag == 3)) {
978
+ scrollToBottom();
979
+ } else {
980
+ scrollTo("li_flag");
981
+ }
982
+ }
983
+ setBottomLoading(false);
984
+ setLoading(false);
985
+ setGreetingMessage(true);
986
+ //召唤老师回答
987
+ if (problem != undefined && problem.user != undefined && problem.question != undefined) {
988
+ sendToTeacher(1);
989
+ }
990
+ } else {
991
+ setPageCount(0);
992
+ setGreetingMessage(true);
993
+ setBottomLoading(false);
994
+ setLoading(false);
995
+ setHistoryMessageList([]);
996
+ //召唤老师回答
997
+ if (problem != undefined && problem.user != undefined && problem.question != undefined) {
998
+ sendToTeacher(1);
999
+ }
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
+ }
1010
+ }).catch(function(res) {
1011
+ setLoading(false);
1012
+ });
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
+ };
1059
+ //在聊天对话框中查找需要记录的问题及答案
1060
+ var fildChatRecords = function(newHistoryMessageList) {
1061
+ //1、找到对应的聊天室
1062
+ //2、找到与老师对话的新聊天
1063
+ //3、保存聊天到实验报告
1064
+ // console.log('查找聊天111',chatObj,newHistoryMessageList);
1065
+ try {
1066
+ var chatObj = [];
1067
+ setChatObj(function(item) {
1068
+ chatObj = item;
1069
+ return item;
1070
+ });
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;
1085
+ }
1086
+ });
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
+ }
1106
+ });
1107
+ console.log(result, "存储的消息");
1108
+ result.map(function(item) {
1109
+ testLabQuestion(item.question, item.answer, item.id);
1110
+ });
1111
+ }
1112
+ }
1113
+ } catch (error) {}
1114
+ };
1115
+ //点赞消息
1116
+ var likeMessage = function(id, state) {
1117
+ var url = "";
1118
+ //点赞状态
1119
+ if (!state) {
1120
+ url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:upvote");
1121
+ } else {
1122
+ url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:cancelUpvote");
1123
+ }
1124
+ http.post(url, {
1125
+ messageId: id
1126
+ }, {
1127
+ headers: {
1128
+ "x-module-id": userData.modules.find(function(ele) {
1129
+ return ele.short == "IntelligentCustomerService";
1130
+ }).id,
1131
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1132
+ }
1133
+ }).then(function(res) {
1134
+ setHistoryMessageList(function(historyMessageList) {
1135
+ var list = historyMessageList;
1136
+ list = list.map(function(item) {
1137
+ return _object_spread_props(_object_spread({}, item), {
1138
+ upvoted: item.id == id ? !state : item.upvoted,
1139
+ downvoted: item.id == id && !state ? state : item.downvoted
1140
+ });
1141
+ });
1142
+ return list;
1143
+ });
1144
+ });
1145
+ };
1146
+ //踩
1147
+ var disagreeMessage = function(id, state) {
1148
+ var url = "";
1149
+ //点赞状态
1150
+ if (!state) {
1151
+ url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:downvote");
1152
+ } else {
1153
+ url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:cancelDownvote");
1154
+ }
1155
+ http.post(url, {
1156
+ messageId: id
1157
+ }, {
1158
+ headers: {
1159
+ "x-module-id": userData.modules.find(function(ele) {
1160
+ return ele.short == "IntelligentCustomerService";
1161
+ }).id,
1162
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1163
+ }
1164
+ }).then(function(res) {
1165
+ setHistoryMessageList(function(historyMessageList) {
1166
+ var list = historyMessageList;
1167
+ list = list.map(function(item) {
1168
+ return _object_spread_props(_object_spread({}, item), {
1169
+ downvoted: item.id == id ? !state : item.downvoted,
1170
+ upvoted: item.id == id && !state ? state : item.upvoted
1171
+ });
1172
+ });
1173
+ return list;
1174
+ });
1175
+ });
1176
+ };
1177
+ //获取问题列表flag ==1 是问候消息 2,搜索列表 展示相关问题
1178
+ var getQuestiionsList = function(value, flag) {
1179
+ var data = {};
1180
+ if (flag == 1) {
1181
+ data = {
1182
+ page: 1,
1183
+ maxPageSize: 5
1184
+ };
1185
+ } else {
1186
+ data = {
1187
+ page: 1,
1188
+ maxPageSize: 4,
1189
+ question: value
1190
+ };
1191
+ }
1192
+ http.get("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions"), {
1193
+ params: data,
1194
+ headers: {
1195
+ "x-module-id": userData.modules.find(function(ele) {
1196
+ return ele.short == "IntelligentCustomerService";
1197
+ }).id,
1198
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1199
+ }
1200
+ }).then(function(res) {
1201
+ if (res.data.questions) {
1202
+ if (flag == 1) {
1203
+ setHotQuestionsList(res.data.questions);
1204
+ } else {
1205
+ setQuestionsList(res.data.questions);
1206
+ }
1207
+ }
1208
+ });
1209
+ };
1210
+ //获取老师列表
1211
+ var getTeacherList = function(keyWord) {
1212
+ http.get("".concat(urllocation, "/chat-service/public/v1.0/teachers"), {
1213
+ params: {
1214
+ name: keyWord
1215
+ },
1216
+ headers: {
1217
+ "x-module-id": userData.modules.find(function(ele) {
1218
+ return ele.short == "TeacherAnswer";
1219
+ }).id,
1220
+ "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1221
+ }
1222
+ }).then(function(res) {
1223
+ console.log(res);
1224
+ if (res.data) {
1225
+ setTeacherList(res.data.teachers);
1226
+ }
1227
+ });
1228
+ };
1229
+ //设置滚动条滚动到底部
1230
+ var scrollToBottom = function() {
1231
+ var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
1232
+ if (container) {
1233
+ container.scrollTop = container.scrollHeight;
1234
+ }
1235
+ };
1236
+ var scrollTo = function(id) {
1237
+ var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
1238
+ var container2 = document.getElementById(id);
1239
+ if (container && container2) {
1240
+ container.scrollTop = 60;
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) {}
1249
+ setLoading(false);
1250
+ }
1251
+ };
1252
+ // 获取新的JWT
1253
+ var verifyJWT = function(url) {
1254
+ return new Promise(function(resolve) {
1255
+ http.get("".concat(url, "/regusers/login/Refreshtoken")).then(function(res) {
1256
+ if (res.data.code == 200) {
1257
+ window.localStorage.setItem("usertoken", res.data.data);
1258
+ resolve(res.data.data);
1259
+ } else {
1260
+ throw new Error(res.data.code);
1261
+ }
1262
+ }).catch(function(err) {
1263
+ resolve(err);
1264
+ });
1265
+ });
1266
+ };
1267
+ //渲染头部
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
+ });
1280
+ if (showType == 4) {
1281
+ return /*#__PURE__*/ _jsxs("div", {
1282
+ className: styles.top,
1283
+ children: [
1284
+ /*#__PURE__*/ _jsx("div", {
1285
+ className: styles.user,
1286
+ children: /*#__PURE__*/ _jsx("p", {
1287
+ children: title
1288
+ })
1289
+ }),
1290
+ /*#__PURE__*/ _jsxs("div", {
1291
+ className: styles.operate,
1292
+ children: [
1293
+ /*#__PURE__*/ _jsx("i", {
1294
+ onClick: function() {
1295
+ setShowHistory(true);
1296
+ },
1297
+ children: /*#__PURE__*/ _jsx(CustomRecord, {})
1298
+ }),
1299
+ /*#__PURE__*/ _jsx("span", {
1300
+ className: styles.line
1301
+ }),
1302
+ /*#__PURE__*/ _jsx("i", {
1303
+ onClick: function() {
1304
+ onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
1305
+ setFirstLoad(false); //重启滚动条在最上方
1306
+ setShowType(3);
1307
+ },
1308
+ children: /*#__PURE__*/ _jsx(CustomExitFullScreen, {})
1309
+ }),
1310
+ /*#__PURE__*/ _jsx("i", {
1311
+ onClick: function() {
1312
+ onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
1313
+ setShowType(3);
1314
+ setFirstLoad(false); //重启滚动条在最上方
1315
+ },
1316
+ children: /*#__PURE__*/ _jsx(CloseOutlined, {})
1317
+ })
1318
+ ]
1319
+ })
1320
+ ]
1321
+ });
1322
+ } else {
1323
+ return /*#__PURE__*/ _jsxs("div", {
1324
+ className: styles.top,
1325
+ children: [
1326
+ /*#__PURE__*/ _jsx("div", {
1327
+ className: styles.user,
1328
+ children: /*#__PURE__*/ _jsxs("p", {
1329
+ children: [
1330
+ showType == 1 && /*#__PURE__*/ _jsxs("i", {
1331
+ className: "lianxiren21",
1332
+ onClick: function() {
1333
+ setShowContacts(true);
1334
+ },
1335
+ children: [
1336
+ /*#__PURE__*/ _jsx(CustomContacts, {}),
1337
+ count > 0 ? /*#__PURE__*/ _jsx("span", {
1338
+ className: styles.count,
1339
+ children: count > 99 ? "99+" : count
1340
+ }) : ""
1341
+ ]
1342
+ }),
1343
+ title
1344
+ ]
1345
+ })
1346
+ }),
1347
+ /*#__PURE__*/ _jsxs("div", {
1348
+ className: styles.operate,
1349
+ children: [
1350
+ /*#__PURE__*/ _jsx("i", {
1351
+ className: "_lishixiao22",
1352
+ onClick: function() {
1353
+ setShowHistory(true);
1354
+ },
1355
+ children: /*#__PURE__*/ _jsx(CustomRecord, {})
1356
+ }),
1357
+ /*#__PURE__*/ _jsx("span", {
1358
+ className: styles.line
1359
+ }),
1360
+ showType == 1 ? /*#__PURE__*/ _jsx("i", {
1361
+ onClick: function() {
1362
+ onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
1363
+ // switchDialogBox(3, true);
1364
+ setShowType(2);
1365
+ childRef.current.roomsListTimer();
1366
+ },
1367
+ children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
1368
+ }) : /*#__PURE__*/ _jsx("i", {
1369
+ onClick: function() {
1370
+ onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
1371
+ // switchDialogBox(1, true);
1372
+ setShowType(1);
1373
+ },
1374
+ children: /*#__PURE__*/ _jsx(CustomExitFullScreen, {})
1375
+ }),
1376
+ /*#__PURE__*/ _jsx("i", {
1377
+ onClick: onCancel,
1378
+ children: /*#__PURE__*/ _jsx(CloseOutlined, {})
1379
+ })
1380
+ ]
1381
+ })
1382
+ ]
1383
+ });
1384
+ }
1385
+ };
1386
+ //重置底部输入框高度
1387
+ var resettingBottomHei = function() {
1388
+ setTimeout(function() {
1389
+ if (showType == 1 || showType == 3) {
1390
+ if (document.getElementById("Drawer_buttom_modal")) {
1391
+ var hei = document.getElementById("Drawer_buttom").offsetHeight;
1392
+ setButtomHei(hei);
1393
+ }
1394
+ } else {
1395
+ if (document.getElementById("Drawer_buttom_modal")) {
1396
+ var hei1 = document.getElementById("Drawer_buttom_modal").offsetHeight;
1397
+ setButtomHei(hei1);
1398
+ }
1399
+ }
1400
+ }, 50);
1401
+ };
1402
+ //切换聊天室 type == renew ,存在新消息
1403
+ var switchChatRoom = function(id, type) {
1404
+ setLastId("");
1405
+ setPageNum(1);
1406
+ setPageCount(0);
1407
+ setRoomId(id);
1408
+ //
1409
+ // if (type == "renew") {
1410
+ // getHistoryMessage(1, 3,id);
1411
+ // }else{
1412
+ // setRoomId(id);
1413
+ // }
1414
+ readMessage(id, urllocation, userData, http);
1415
+ };
1416
+ var saveContactsList = function(list) {
1417
+ if (list != undefined) {
1418
+ setRoomList(list);
1419
+ }
1420
+ };
1421
+ //渲染问答
1422
+ var renderQuestion = function() {
1423
+ // console.log(lastId,'lastIdlastIdlastId')
1424
+ // console.log(mid, historyMessageList, "ddkfdscksdcs");
1425
+ if (historyMessageList.length > 0) {
1426
+ return /*#__PURE__*/ _jsx("ul", {
1427
+ className: styles.message_con,
1428
+ children: historyMessageList.map(function(item, i) {
1429
+ // console.log(item.message);
1430
+ var message = item.message;
1431
+ var li;
1432
+ // 是否需要显示日期
1433
+ var itemIndex = historyMessageList.findIndex(function(ite) {
1434
+ return ite.id === item.id;
1435
+ });
1436
+ var time = "";
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
+ // }
1470
+ var dataTime = time;
1471
+ if (item.sender == mid) {
1472
+ //只有引用和复制功能
1473
+ li = /*#__PURE__*/ _jsxs(_Fragment, {
1474
+ children: [
1475
+ dataTime ? /*#__PURE__*/ _jsx("li", {
1476
+ className: styles.time,
1477
+ children: dataTime
1478
+ }) : "",
1479
+ /*#__PURE__*/ _jsxs("li", {
1480
+ className: styles.left,
1481
+ id: lastId == item.id ? "li_flag" : "",
1482
+ children: [
1483
+ /*#__PURE__*/ _jsx("div", {
1484
+ className: styles.main,
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",
1552
+ children: /*#__PURE__*/ _jsxs("p", {
1553
+ children: [
1554
+ item.quotedMessage,
1555
+ ">"
1556
+ ]
1557
+ })
1558
+ }) : /*#__PURE__*/ _jsx("p", {
1559
+ children: item.quotedMessage
1560
+ })
1561
+ })
1562
+ ]
1563
+ })
1564
+ }),
1565
+ showType == 2 || showType == 4 ? /*#__PURE__*/ _jsx("div", {
1566
+ className: styles.head_sculpture,
1567
+ style: {
1568
+ marginLeft: "12px"
1569
+ },
1570
+ children: /*#__PURE__*/ _jsx("img", {
1571
+ src: userData.avatar
1572
+ })
1573
+ }) : ""
1574
+ ]
1575
+ }, item.id)
1576
+ ]
1577
+ });
1578
+ } else {
1579
+ //获取用户头像
1580
+ var headImg = "";
1581
+ var chatWindow = roomList.filter(function(item) {
1582
+ return item.roomId == roomId;
1583
+ });
1584
+ if (chatWindow.length > 0 && chatWindow[0].headImg != "") {
1585
+ headImg = chatWindow[0].headImg;
1586
+ }
1587
+ //是否在智能客服窗口
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
+ }
1594
+ li = /*#__PURE__*/ _jsxs(_Fragment, {
1595
+ children: [
1596
+ dataTime ? /*#__PURE__*/ _jsx("li", {
1597
+ className: styles.time,
1598
+ children: dataTime
1599
+ }) : "",
1600
+ /*#__PURE__*/ _jsxs("li", {
1601
+ className: styles.right,
1602
+ id: lastId == item.id ? "li_flag" : "",
1603
+ children: [
1604
+ (showType == 2 || showType == 4) && /*#__PURE__*/ _jsx("div", {
1605
+ className: styles.head_sculpture,
1606
+ style: {
1607
+ marginRight: "12px"
1608
+ },
1609
+ children: isAiChatWindow ? item.extraInfo == null || header == 1 ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
1610
+ src: knowledge_icon
1611
+ }) : /*#__PURE__*/ _jsx("img", {
1612
+ src: headImg
1613
+ })
1614
+ }),
1615
+ /*#__PURE__*/ _jsx("div", {
1616
+ className: styles.main,
1617
+ children: /*#__PURE__*/ _jsxs("div", {
1618
+ className: styles.main_content,
1619
+ children: [
1620
+ /*#__PURE__*/ _jsx("div", {
1621
+ className: styles.operate_modal,
1622
+ children: // 不是最后一行,
1623
+ historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
1624
+ }),
1625
+ /*#__PURE__*/ _jsxs("div", {
1626
+ className: styles.content,
1627
+ children: [
1628
+ /*#__PURE__*/ _jsx("p", {
1629
+ dangerouslySetInnerHTML: {
1630
+ __html: remarkable.render(message)
1631
+ },
1632
+ className: styles.content_child
1633
+ }),
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", {
1635
+ className: styles.association_problem,
1636
+ children: JSON.parse(item.extraInfo).map(function(list, index) {
1637
+ return /*#__PURE__*/ _jsxs("li", {
1638
+ onClick: function() {
1639
+ sendMessage(list, 1);
1640
+ },
1641
+ children: [
1642
+ index + 1,
1643
+ ".",
1644
+ list.question
1645
+ ]
1646
+ }, i + "_" + index + "_" + list.value);
1647
+ })
1648
+ })
1649
+ ]
1650
+ }),
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
1666
+ })
1667
+ }),
1668
+ //findTeacher//是否在召唤老师过程中,是否是最后一条消息
1669
+ !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
1670
+ //召唤老师回答按钮
1671
+ isAiChatWindow && item.findTeacher && userData.modules.some(function(item) {
1672
+ return item.short == "TeacherAnswer";
1673
+ }) ? /*#__PURE__*/ _jsx("div", {
1674
+ className: "".concat(styles.operate_modal_bottom),
1675
+ children: /*#__PURE__*/ _jsx("p", {
1676
+ className: styles.stop_findTeacher,
1677
+ children: /*#__PURE__*/ _jsx("span", {
1678
+ onClick: function() {
1679
+ setAnswerMode(-1);
1680
+ setTeacherList([]);
1681
+ setHistoryMessageList(function(historyMessageList) {
1682
+ return historyMessageList.filter(function(item) {
1683
+ return item.id != "-1";
1684
+ });
1685
+ });
1686
+ },
1687
+ children: "停止召唤老师"
1688
+ })
1689
+ })
1690
+ }) : ""
1691
+ ]
1692
+ })
1693
+ })
1694
+ ]
1695
+ }, item.id)
1696
+ ]
1697
+ });
1698
+ }
1699
+ return li;
1700
+ })
1701
+ });
1702
+ } else {
1703
+ return "";
1704
+ }
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
+ };
2057
+ //渲染底部按钮
2058
+ var renderBottomAnt = function() {
2059
+ var placeholder = "";
2060
+ var disabled = false;
2061
+ if (voiceRecordingStatus == 2) {
2062
+ placeholder = "录制中...";
2063
+ } else if (voiceRecordingStatus == 1) {
2064
+ placeholder = "正在语音识别文字,请稍后...";
2065
+ } else if (!finished) {
2066
+ placeholder = "答案生成中,请稍后再发送...";
2067
+ } else {
2068
+ placeholder = "请输入问题,按Enter发送,Shift+Enter换行";
2069
+ disabled = true;
2070
+ }
2071
+ return /*#__PURE__*/ _jsxs(_Fragment, {
2072
+ children: [
2073
+ /*#__PURE__*/ _jsxs("div", {
2074
+ className: styles.input_wrap,
2075
+ onChange: function() {
2076
+ resettingBottomHei();
2077
+ },
2078
+ children: [
2079
+ /*#__PURE__*/ _jsxs("div", {
2080
+ className: "".concat(styles.input, " ").concat(userData.modules.some(function(item) {
2081
+ return item.short == "AIservice";
2082
+ }) ? "" : styles.no_AI),
2083
+ children: [
2084
+ /*#__PURE__*/ _jsx(TextArea, {
2085
+ placeholder: placeholder,
2086
+ autoSize: {
2087
+ minRows: 1,
2088
+ maxRows: 6
2089
+ },
2090
+ value: keyWord,
2091
+ onChange: function(e) {
2092
+ setKeyWord(e.target.value);
2093
+ if (e.target.value == "") {
2094
+ setQuestionsList([]);
2095
+ setTeacherList([]);
2096
+ clearTimeout(timer.current);
2097
+ } else {
2098
+ clearTimeout(timer.current);
2099
+ timer.current = setTimeout(function() {
2100
+ if (answerMode == 1) {
2101
+ getTeacherList(String(e.target.value));
2102
+ } else {
2103
+ if (roomList.length > 0 && roomList[0].roomId != roomId) return;
2104
+ getQuestiionsList(String(e.target.value), 2);
2105
+ }
2106
+ }, 1000);
2107
+ }
2108
+ },
2109
+ onPressEnter: function(e) {
2110
+ // console.log('发送内容22222',props)
2111
+ // console.log(roomList,roomId,'发送内容22222wewewewewewewe');
2112
+ if (!e.shiftKey && !e.altKey && !e.ctrlKey && keyWord.trim() != "") {
2113
+ e.stopPropagation();
2114
+ e.preventDefault();
2115
+ clearTimeout(timer.current);
2116
+ setKeyWord("");
2117
+ setCitationContent({});
2118
+ //跟老师对话
2119
+ if (roomList.length > 0 && roomList[0].roomId != roomId) {
2120
+ sendToTeacher(2);
2121
+ } else {
2122
+ sendMessage();
2123
+ }
2124
+ setButtomHei(45);
2125
+ } else {
2126
+ console.log("回车事件");
2127
+ resettingBottomHei();
2128
+ }
2129
+ },
2130
+ onFocus: function() {
2131
+ onEvent(serverName + serverUrl(), "click_智能问答_输入框", "提交");
2132
+ },
2133
+ disabled: !disabled,
2134
+ maxLength: 1000
2135
+ }),
2136
+ citationContent.content != undefined && citationContent.content != "" ? /*#__PURE__*/ _jsxs("div", {
2137
+ className: styles.content_main,
2138
+ children: [
2139
+ /*#__PURE__*/ _jsx("div", {
2140
+ className: styles.content_con,
2141
+ children: /*#__PURE__*/ _jsx("p", {
2142
+ children: citationContent.content
2143
+ })
2144
+ }),
2145
+ /*#__PURE__*/ _jsx("i", {
2146
+ className: styles.delete_quote,
2147
+ onClick: function() {
2148
+ setCitationContent({});
2149
+ resettingBottomHei();
2150
+ },
2151
+ children: /*#__PURE__*/ _jsx(CustomRoundClose, {})
2152
+ })
2153
+ ]
2154
+ }) : ""
2155
+ ]
2156
+ }),
2157
+ userData.modules.some(function(item) {
2158
+ return item.short == "AIservice";
2159
+ }) ? /*#__PURE__*/ _jsxs("p", {
2160
+ className: styles.voice,
2161
+ children: [
2162
+ voiceRecordingStatus == 1 || voiceRecordingStatus == 3 ? /*#__PURE__*/ _jsx("i", {
2163
+ className: "".concat(!disabled ? styles.disabled : ""),
2164
+ onClick: function() {
2165
+ //开始录音
2166
+ if (!disabled) return;
2167
+ startRecord();
2168
+ setVoiceRecordingStatus(2);
2169
+ setKeyWord("");
2170
+ voiceCountdownTimer.current = setTimeout(function() {
2171
+ stopRecord();
2172
+ setVoiceRecordingStatus(1);
2173
+ }, 120000);
2174
+ onEvent(serverName + serverUrl(), "click_智能问答_ 麦克风", "提交");
2175
+ },
2176
+ children: /*#__PURE__*/ _jsx(CustomSoundRecording, {})
2177
+ }) : "",
2178
+ voiceRecordingStatus == 2 ? /*#__PURE__*/ _jsx("img", {
2179
+ // src={Voice_btn}
2180
+ src: "/new_yun/images/aiService/voice_btn.gif",
2181
+ className: styles.voice_btn,
2182
+ onClick: function() {
2183
+ //结束录音
2184
+ // console.log(mediaRecorder,'3333333');
2185
+ // mediaRecorder.stop();
2186
+ stopRecord();
2187
+ setVoiceRecordingStatus(1);
2188
+ clearTimeout(voiceCountdownTimer.current);
2189
+ }
2190
+ }) : ""
2191
+ ]
2192
+ }) : ""
2193
+ ]
2194
+ }),
2195
+ /*#__PURE__*/ _jsx("p", {
2196
+ className: "".concat(styles.sending),
2197
+ children: /*#__PURE__*/ _jsx("i", {
2198
+ className: "".concat(!disabled || keyWord.trim() == "" ? styles.disabled : ""),
2199
+ onClick: function() {
2200
+ if (!disabled) return;
2201
+ setCitationContent({});
2202
+ setButtomHei(45);
2203
+ if (keyWord.trim() != "") {
2204
+ setKeyWord("");
2205
+ //跟老师对话
2206
+ if (roomList.length > 0 && roomList[0].roomId != roomId) {
2207
+ sendToTeacher(2);
2208
+ } else {
2209
+ sendMessage();
2210
+ }
2211
+ onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
2212
+ }
2213
+ },
2214
+ children: /*#__PURE__*/ _jsx(CustomSending, {})
2215
+ })
2216
+ })
2217
+ ]
2218
+ });
2219
+ };
2220
+ //渲染联想问题及联想的老师名称
2221
+ var renderAssociationProblem = function() {
2222
+ if (answerMode == 1) {
2223
+ return /*#__PURE__*/ _jsx("div", {
2224
+ className: "".concat(styles.issues_list, " ").concat(styles.issues_list_teacherList),
2225
+ style: {
2226
+ bottom: "".concat(buttomHei + 6, "px")
2227
+ },
2228
+ children: teacherList.map(function(item) {
2229
+ var span = item.name.replaceAll(keyWord, function() {
2230
+ return "<span class=".concat(styles.sign, ">").concat(keyWord, "</span>");
2231
+ });
2232
+ return /*#__PURE__*/ _jsx("p", {
2233
+ className: styles.item,
2234
+ children: /*#__PURE__*/ _jsx("span", {
2235
+ onClick: function() {
2236
+ setTeacherList([]);
2237
+ //提问的问题
2238
+ setProblem({
2239
+ question: problem.question,
2240
+ user: item.uid
2241
+ });
2242
+ setKeyWord("");
2243
+ //setUpdateRecords(true);
2244
+ setAnswerMode(-1);
2245
+ setChatWith(item);
2246
+ var list = roomList.filter(function(e) {
2247
+ return e.sender == item.uid;
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
+ }
2258
+ },
2259
+ dangerouslySetInnerHTML: {
2260
+ __html: span
2261
+ }
2262
+ })
2263
+ });
2264
+ })
2265
+ });
2266
+ } else {
2267
+ return /*#__PURE__*/ _jsx("div", {
2268
+ className: styles.issues_list,
2269
+ style: {
2270
+ bottom: "".concat(buttomHei + 6, "px")
2271
+ },
2272
+ children: questionsList.map(function(item) {
2273
+ var span = item.question.replaceAll(keyWord, function() {
2274
+ return "<span class=".concat(styles.sign, ">").concat(keyWord, "</span>");
2275
+ });
2276
+ return /*#__PURE__*/ _jsx("p", {
2277
+ className: styles.item,
2278
+ children: /*#__PURE__*/ _jsx("span", {
2279
+ onClick: function() {
2280
+ sendMessage(item, 2);
2281
+ setKeyWord("");
2282
+ onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
2283
+ },
2284
+ dangerouslySetInnerHTML: {
2285
+ __html: span
2286
+ }
2287
+ })
2288
+ });
2289
+ })
2290
+ });
2291
+ }
2292
+ };
2293
+ //加载指定数据,点击历史记录
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
+ }
2302
+ setPageNum(page);
2303
+ setLastId(id); //用于定位
2304
+ //如果是当前聊天室
2305
+ if (renewRoomId == roomId) {
2306
+ getHistoryMessage(page, 1);
2307
+ } else {
2308
+ setRoomId(renewRoomId);
2309
+ }
2310
+ };
2311
+ return /*#__PURE__*/ _jsxs(_Fragment, {
2312
+ children: [
2313
+ /*#__PURE__*/ _jsxs(Drawer, {
2314
+ title: "智能回答",
2315
+ width: 560,
2316
+ onClose: function() {
2317
+ onCancel();
2318
+ onEvent(serverName + serverUrl(), "click_智能问答_收起侧边栏", "提交");
2319
+ },
2320
+ open: showType == 1 ? true : false,
2321
+ className: styles.ChatWindow_Drawer,
2322
+ mask: false,
2323
+ // maskClosable={false}
2324
+ rootClassName: styles.service_ChatWindow_Drawer,
2325
+ children: [
2326
+ showType == 1 && /*#__PURE__*/ _jsx("div", {
2327
+ style: {
2328
+ display: "".concat(showContacts && roomId != "" ? "block" : "none")
2329
+ },
2330
+ children: /*#__PURE__*/ _jsx(ContactsList, {
2331
+ type: 1,
2332
+ roomId: roomId,
2333
+ userData: userData,
2334
+ http: http,
2335
+ urllocation: urllocation,
2336
+ onClose: function() {
2337
+ setShowContacts(false);
2338
+ },
2339
+ // roomIdAi={roomIdAi}
2340
+ switchChatRoom: switchChatRoom,
2341
+ saveContactsList: saveContactsList,
2342
+ ref: childRef
2343
+ })
2344
+ }),
2345
+ /*#__PURE__*/ _jsx("div", {
2346
+ className: styles.header_wrap,
2347
+ children: renderHeader()
2348
+ }),
2349
+ /*#__PURE__*/ _jsxs("div", {
2350
+ className: "".concat(styles.Drawer_main),
2351
+ id: "chat_content",
2352
+ style: {
2353
+ maxHeight: "calc(100vh-".concat(buttomHei + 48, "px)")
2354
+ },
2355
+ children: [
2356
+ loading ? /*#__PURE__*/ _jsx("div", {
2357
+ className: styles.loading,
2358
+ children: /*#__PURE__*/ _jsx("img", {
2359
+ src: "/new_yun/images/loading_d.gif",
2360
+ alt: ""
2361
+ })
2362
+ }) : "",
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
+ }) : ""
2371
+ ]
2372
+ }),
2373
+ /*#__PURE__*/ _jsxs("div", {
2374
+ className: styles.Drawer_buttom_Issues_List,
2375
+ children: [
2376
+ renderAssociationProblem(),
2377
+ /*#__PURE__*/ _jsx("div", {
2378
+ className: styles.Drawer_buttom,
2379
+ id: "Drawer_buttom",
2380
+ children: renderBottomAnt()
2381
+ })
2382
+ ]
2383
+ }),
2384
+ showType == 1 && showHistory && /*#__PURE__*/ _jsx(HistoryFun, {
2385
+ type: 1,
2386
+ roomId: roomId,
2387
+ userData: userData,
2388
+ http: http,
2389
+ urllocation: urllocation,
2390
+ onClose: function() {
2391
+ setShowHistory(false);
2392
+ },
2393
+ loadSpecifiedData: loadSpecifiedData,
2394
+ roomList: roomList
2395
+ })
2396
+ ]
2397
+ }),
2398
+ /*#__PURE__*/ _jsxs(Modal, {
2399
+ title: "智能回答",
2400
+ open: showType == 2 ? true : false,
2401
+ onCancel: function() {
2402
+ onCancel();
2403
+ onEvent(serverName + serverUrl(), "click_智能问答_收起侧边栏", "提交");
2404
+ },
2405
+ centered: true,
2406
+ width: window.innerWidth - 252 > 1214 ? window.innerWidth - 252 : 1214,
2407
+ height: window.innerHeight - 160,
2408
+ wrapClassName: styles.ChatWindow_Modal,
2409
+ footer: false,
2410
+ maskClosable: false,
2411
+ closeIcon: null,
2412
+ children: [
2413
+ /*#__PURE__*/ _jsx("div", {
2414
+ className: styles.header_wrap,
2415
+ children: renderHeader()
2416
+ }),
2417
+ /*#__PURE__*/ _jsxs("div", {
2418
+ className: "".concat(styles.Drawer_wrap_main),
2419
+ children: [
2420
+ /*#__PURE__*/ _jsxs("div", {
2421
+ className: "".concat(styles.Drawer_main, " ChatWindow_Modal_history_list"),
2422
+ id: "chat_content_modal",
2423
+ style: {
2424
+ maxHeight: "".concat(window.innerHeight - 148 - buttomHei, "px")
2425
+ },
2426
+ children: [
2427
+ /*#__PURE__*/ _jsx(ContactsList, {
2428
+ type: 2,
2429
+ roomId: roomId,
2430
+ userData: userData,
2431
+ http: http,
2432
+ urllocation: urllocation,
2433
+ onClose: function() {
2434
+ setShowContacts(false);
2435
+ },
2436
+ switchChatRoom: switchChatRoom,
2437
+ saveContactsList: saveContactsList,
2438
+ ref: childRef
2439
+ }),
2440
+ /*#__PURE__*/ _jsxs("div", {
2441
+ className: styles.chat_content,
2442
+ children: [
2443
+ loading ? /*#__PURE__*/ _jsx("div", {
2444
+ className: styles.loading,
2445
+ children: /*#__PURE__*/ _jsx("img", {
2446
+ src: "/new_yun/images/loading_d.gif",
2447
+ alt: ""
2448
+ })
2449
+ }) : "",
2450
+ renderQuestion()
2451
+ ]
2452
+ })
2453
+ ]
2454
+ }),
2455
+ /*#__PURE__*/ _jsxs("div", {
2456
+ className: styles.Drawer_buttom_Issues_List,
2457
+ children: [
2458
+ renderAssociationProblem(),
2459
+ /*#__PURE__*/ _jsx("div", {
2460
+ className: styles.Drawer_buttom,
2461
+ id: "Drawer_buttom_modal",
2462
+ children: renderBottomAnt()
2463
+ })
2464
+ ]
2465
+ }),
2466
+ showType == 2 && showHistory && /*#__PURE__*/ _jsx(HistoryFun, {
2467
+ type: 2,
2468
+ roomId: roomId,
2469
+ userData: userData,
2470
+ http: http,
2471
+ urllocation: urllocation,
2472
+ onClose: function() {
2473
+ setShowHistory(false);
2474
+ },
2475
+ loadSpecifiedData: loadSpecifiedData,
2476
+ roomList: roomList
2477
+ })
2478
+ ]
2479
+ })
2480
+ ]
2481
+ }),
2482
+ showType == 3 ? /*#__PURE__*/ _jsxs("div", {
2483
+ className: "".concat(styles.ChatWindow_Drawer),
2484
+ id: "",
2485
+ children: [
2486
+ /*#__PURE__*/ _jsx("div", {
2487
+ className: "".concat(styles.header_wrap, " ").concat(styles.header_wrap_newlabo),
2488
+ children: /*#__PURE__*/ _jsxs("div", {
2489
+ className: styles.top,
2490
+ children: [
2491
+ /*#__PURE__*/ _jsx("div", {
2492
+ className: styles.user,
2493
+ children: /*#__PURE__*/ _jsx("p", {
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 : "智能回答"
2501
+ })
2502
+ }),
2503
+ /*#__PURE__*/ _jsxs("div", {
2504
+ className: styles.operate,
2505
+ children: [
2506
+ /*#__PURE__*/ _jsx("i", {
2507
+ onClick: function() {
2508
+ setShowHistory(true);
2509
+ },
2510
+ children: /*#__PURE__*/ _jsx(CustomRecord, {})
2511
+ }),
2512
+ /*#__PURE__*/ _jsx("span", {
2513
+ className: styles.line
2514
+ }),
2515
+ /*#__PURE__*/ _jsx("i", {
2516
+ onClick: function() {
2517
+ onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
2518
+ setFirstLoad(false);
2519
+ setShowType(4);
2520
+ childRef.current.roomsListTimer();
2521
+ },
2522
+ children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
2523
+ }),
2524
+ /*#__PURE__*/ _jsx("i", {
2525
+ className: "lianxiren21",
2526
+ onClick: function() {
2527
+ setShowContacts(true);
2528
+ },
2529
+ children: /*#__PURE__*/ _jsx(CustomContacts, {})
2530
+ })
2531
+ ]
2532
+ })
2533
+ ]
2534
+ })
2535
+ }),
2536
+ /*#__PURE__*/ _jsxs("div", {
2537
+ className: "".concat(styles.Drawer_main, " ").concat(styles.Drawer_main_newlabo),
2538
+ id: "chat_content",
2539
+ style: {
2540
+ maxHeight: "".concat(window.innerHeight - 110 - buttomHei, "px)")
2541
+ },
2542
+ children: [
2543
+ loading ? /*#__PURE__*/ _jsx("div", {
2544
+ className: styles.loading,
2545
+ children: /*#__PURE__*/ _jsx("img", {
2546
+ src: "/new_yun/images/loading_d.gif",
2547
+ alt: ""
2548
+ })
2549
+ }) : "",
2550
+ renderQuestion()
2551
+ ]
2552
+ }),
2553
+ /*#__PURE__*/ _jsxs("div", {
2554
+ className: "".concat(styles.Drawer_buttom_Issues_List, " ").concat(styles.Drawer_buttom_Issues_List_newlabo),
2555
+ children: [
2556
+ renderAssociationProblem(),
2557
+ /*#__PURE__*/ _jsx("div", {
2558
+ className: styles.Drawer_buttom,
2559
+ id: "Drawer_buttom",
2560
+ children: renderBottomAnt()
2561
+ })
2562
+ ]
2563
+ }),
2564
+ showType == 3 && showHistory && /*#__PURE__*/ _jsx(HistoryFun, {
2565
+ type: 3,
2566
+ roomId: roomId,
2567
+ userData: userData,
2568
+ http: http,
2569
+ urllocation: urllocation,
2570
+ onClose: function() {
2571
+ setShowHistory(false);
2572
+ },
2573
+ loadSpecifiedData: loadSpecifiedData,
2574
+ roomList: roomList
2575
+ }),
2576
+ showType == 3 && /*#__PURE__*/ _jsx("div", {
2577
+ style: {
2578
+ display: "".concat(showType == 3 && showContacts && roomId != "" ? "block" : "none")
2579
+ },
2580
+ children: /*#__PURE__*/ _jsx(ContactsList, {
2581
+ type: 3,
2582
+ roomId: roomId,
2583
+ userData: userData,
2584
+ http: http,
2585
+ urllocation: urllocation,
2586
+ onClose: function() {
2587
+ setShowContacts(false);
2588
+ },
2589
+ switchChatRoom: switchChatRoom,
2590
+ saveContactsList: saveContactsList,
2591
+ ref: childRef
2592
+ })
2593
+ })
2594
+ ]
2595
+ }) : "",
2596
+ showType == 4 && /*#__PURE__*/ _jsxs(_Fragment, {
2597
+ children: [
2598
+ /*#__PURE__*/ _jsxs(Modal, {
2599
+ title: "智能回答",
2600
+ open: true,
2601
+ onCancel: function() {
2602
+ onCancel();
2603
+ onEvent(serverName + serverUrl(), "click_智能问答_收起侧边栏", "提交");
2604
+ },
2605
+ centered: true,
2606
+ width: window.innerWidth - 252 > 1214 ? window.innerWidth - 252 : 1214,
2607
+ height: window.innerHeight - 160,
2608
+ wrapClassName: "".concat(styles.ChatWindow_Modal),
2609
+ footer: false,
2610
+ maskClosable: false,
2611
+ closeIcon: null,
2612
+ children: [
2613
+ /*#__PURE__*/ _jsx("div", {
2614
+ className: styles.header_wrap,
2615
+ children: renderHeader()
2616
+ }),
2617
+ /*#__PURE__*/ _jsxs("div", {
2618
+ className: "".concat(styles.Drawer_wrap_main),
2619
+ children: [
2620
+ /*#__PURE__*/ _jsxs("div", {
2621
+ className: "".concat(styles.Drawer_main, " ").concat(styles.Drawer_main_newlabo),
2622
+ id: "chat_content_modal",
2623
+ style: {
2624
+ maxHeight: "".concat(window.innerHeight - 148 - buttomHei, "px")
2625
+ },
2626
+ children: [
2627
+ /*#__PURE__*/ _jsx(ContactsList, {
2628
+ type: 4,
2629
+ roomId: roomId,
2630
+ userData: userData,
2631
+ http: http,
2632
+ urllocation: urllocation,
2633
+ onClose: function() {
2634
+ setShowContacts(false);
2635
+ },
2636
+ switchChatRoom: switchChatRoom,
2637
+ saveContactsList: saveContactsList,
2638
+ ref: childRef
2639
+ }),
2640
+ /*#__PURE__*/ _jsxs("div", {
2641
+ className: styles.chat_content,
2642
+ children: [
2643
+ loading ? /*#__PURE__*/ _jsx("div", {
2644
+ className: styles.loading,
2645
+ children: /*#__PURE__*/ _jsx("img", {
2646
+ src: "/new_yun/images/loading_d.gif",
2647
+ alt: ""
2648
+ })
2649
+ }) : "",
2650
+ renderQuestion()
2651
+ ]
2652
+ })
2653
+ ]
2654
+ }),
2655
+ /*#__PURE__*/ _jsxs("div", {
2656
+ className: styles.Drawer_buttom_Issues_List,
2657
+ children: [
2658
+ renderAssociationProblem(),
2659
+ /*#__PURE__*/ _jsx("div", {
2660
+ className: styles.Drawer_buttom,
2661
+ id: "Drawer_buttom_modal",
2662
+ children: renderBottomAnt()
2663
+ })
2664
+ ]
2665
+ }),
2666
+ showHistory && /*#__PURE__*/ _jsx(HistoryFun, {
2667
+ type: 2,
2668
+ roomId: roomId,
2669
+ userData: userData,
2670
+ http: http,
2671
+ urllocation: urllocation,
2672
+ onClose: function() {
2673
+ setShowHistory(false);
2674
+ },
2675
+ loadSpecifiedData: loadSpecifiedData,
2676
+ roomList: roomList
2677
+ })
2678
+ ]
2679
+ })
2680
+ ]
2681
+ }),
2682
+ /*#__PURE__*/ _jsxs("div", {
2683
+ className: "".concat(styles.ChatWindow_Drawer),
2684
+ id: "",
2685
+ children: [
2686
+ /*#__PURE__*/ _jsx("div", {
2687
+ className: "".concat(styles.header_wrap, " ").concat(styles.header_wrap_newlabo),
2688
+ children: /*#__PURE__*/ _jsxs("div", {
2689
+ className: styles.top,
2690
+ children: [
2691
+ /*#__PURE__*/ _jsx("div", {
2692
+ className: styles.user,
2693
+ children: /*#__PURE__*/ _jsx("p", {
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 : "智能回答"
2701
+ })
2702
+ }),
2703
+ /*#__PURE__*/ _jsxs("div", {
2704
+ className: styles.operate,
2705
+ children: [
2706
+ /*#__PURE__*/ _jsx("i", {
2707
+ onClick: function() {
2708
+ setShowHistory(true);
2709
+ },
2710
+ children: /*#__PURE__*/ _jsx(CustomRecord, {})
2711
+ }),
2712
+ /*#__PURE__*/ _jsx("span", {
2713
+ className: styles.line
2714
+ }),
2715
+ /*#__PURE__*/ _jsx("i", {
2716
+ onClick: function() {
2717
+ onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
2718
+ setShowType(4);
2719
+ childRef.current.roomsListTimer();
2720
+ },
2721
+ children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
2722
+ }),
2723
+ /*#__PURE__*/ _jsx("i", {
2724
+ className: "lianxiren21",
2725
+ onClick: function() {
2726
+ setShowContacts(true);
2727
+ },
2728
+ children: /*#__PURE__*/ _jsx(CustomContacts, {})
2729
+ })
2730
+ ]
2731
+ })
2732
+ ]
2733
+ })
2734
+ }),
2735
+ /*#__PURE__*/ _jsxs("div", {
2736
+ className: "".concat(styles.Drawer_main, " ").concat(styles.Drawer_main_newlabo, " ").concat(styles.Drawer_main_newlabo_no_pic),
2737
+ id: "",
2738
+ style: {
2739
+ maxHeight: "".concat(window.innerHeight - 100 - buttomHei, "px)")
2740
+ },
2741
+ children: [
2742
+ loading ? /*#__PURE__*/ _jsx("div", {
2743
+ className: styles.loading,
2744
+ children: /*#__PURE__*/ _jsx("img", {
2745
+ src: "/new_yun/images/loading_d.gif",
2746
+ alt: ""
2747
+ })
2748
+ }) : "",
2749
+ renderQuestion()
2750
+ ]
2751
+ }),
2752
+ /*#__PURE__*/ _jsxs("div", {
2753
+ className: "".concat(styles.Drawer_buttom_Issues_List, " ").concat(styles.Drawer_buttom_Issues_List_newlabo),
2754
+ children: [
2755
+ renderAssociationProblem(),
2756
+ /*#__PURE__*/ _jsx("div", {
2757
+ className: styles.Drawer_buttom,
2758
+ id: "Drawer_buttom",
2759
+ children: renderBottomAnt()
2760
+ })
2761
+ ]
2762
+ }),
2763
+ /*#__PURE__*/ _jsx("div", {
2764
+ style: {
2765
+ display: "".concat(showContacts && roomId != "" ? "block" : "none")
2766
+ },
2767
+ children: /*#__PURE__*/ _jsx(ContactsList, {
2768
+ type: 3,
2769
+ roomId: roomId,
2770
+ userData: userData,
2771
+ http: http,
2772
+ urllocation: urllocation,
2773
+ onClose: function() {
2774
+ setShowContacts(false);
2775
+ },
2776
+ switchChatRoom: switchChatRoom,
2777
+ saveContactsList: saveContactsList,
2778
+ ref: childRef
2779
+ })
2780
+ })
2781
+ ]
2782
+ })
2783
+ ]
2784
+ })
2785
+ ]
2786
+ });
2787
+ };
2788
+ window.appendDom = function(root, props) {
2789
+ render(/*#__PURE__*/ _jsx(Provider.Component, {
2790
+ children: /*#__PURE__*/ _jsx(CustomerService, _object_spread({}, props))
2791
+ }), root);
2792
+ };
2793
+ export default CustomerService;