bhd-components 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{0650d749.esm.es5.development.js → 40717e9e.esm.es5.development.js} +9435 -1276
- package/dist/6b2db3d5.esm.es5.production.js +485 -0
- package/dist/index.esm.es5.development.css +11898 -896
- package/dist/index.esm.es5.development.js +1832 -651
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.esm.es5.development.css +2 -1
- package/dist/vendor.esm.es5.production.esm.es5.production.css +1 -1
- package/es2017/customerService/contactsList.js +2 -2
- package/es2017/customerService/function.d.ts +6 -1
- package/es2017/customerService/function.js +64 -15
- package/es2017/customerService/index.d.ts +3 -0
- package/es2017/customerService/index.js +589 -252
- package/es2017/customerService/index.module.less +596 -109
- package/es2017/customerService/index2.module.less +586 -109
- package/es2017/customerService/screenshotTool.d.ts +9 -0
- package/es2017/customerService/screenshotTool.js +127 -0
- package/es2017/icons/components/custom-knowledge_content.d.ts +4 -0
- package/es2017/icons/components/custom-knowledge_content.js +24 -0
- package/es2017/icons/components/custom-screenshot.d.ts +4 -0
- package/es2017/icons/components/custom-screenshot.js +25 -0
- package/es2017/icons/components/custom-video-abstraction.d.ts +4 -0
- package/es2017/icons/components/custom-video-abstraction.js +22 -0
- package/es2017/icons/components/custom-wenhao_round.d.ts +4 -0
- package/es2017/icons/components/custom-wenhao_round.js +22 -0
- package/es2017/icons/components/index.d.ts +4 -0
- package/es2017/icons/components/index.js +4 -0
- package/esm/customerService/contactsList.js +6 -2
- package/esm/customerService/function.d.ts +6 -1
- package/esm/customerService/function.js +65 -15
- package/esm/customerService/index.d.ts +3 -0
- package/esm/customerService/index.js +594 -283
- package/esm/customerService/index.module.less +596 -109
- package/esm/customerService/index2.module.less +586 -109
- package/esm/customerService/screenshotTool.d.ts +9 -0
- package/esm/customerService/screenshotTool.js +128 -0
- package/esm/icons/components/custom-knowledge_content.d.ts +4 -0
- package/esm/icons/components/custom-knowledge_content.js +26 -0
- package/esm/icons/components/custom-screenshot.d.ts +4 -0
- package/esm/icons/components/custom-screenshot.js +27 -0
- package/esm/icons/components/custom-video-abstraction.d.ts +4 -0
- package/esm/icons/components/custom-video-abstraction.js +24 -0
- package/esm/icons/components/custom-wenhao_round.d.ts +4 -0
- package/esm/icons/components/custom-wenhao_round.js +24 -0
- package/esm/icons/components/index.d.ts +4 -0
- package/esm/icons/components/index.js +4 -0
- package/package.json +3 -1
- package/dist/24d37cb8.esm.es5.production.js +0 -468
|
@@ -3,16 +3,19 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import React, { useEffect, useState, useRef } from "react";
|
|
5
5
|
import { Modal, Drawer, Input, Tooltip } from "antd";
|
|
6
|
+
import { ViewImage } from "bhd-components";
|
|
7
|
+
import html2canvas from "html2canvas";
|
|
6
8
|
import cssStyle from "./index.module.less";
|
|
7
9
|
import cssStyleOnline from "./index2.module.less";
|
|
8
10
|
let styles = cssStyle;
|
|
9
11
|
if (false) {
|
|
10
12
|
styles = cssStyleOnline;
|
|
11
13
|
}
|
|
12
|
-
import { CustomAiIcon, CustomRecord, CustomFullScreen, CustomExitFullScreen, CustomReloading, CustomCopy, CustomLike, CustomDislike, CustomQuote, CustomSending, CustomContacts, CustomDuihao,
|
|
13
|
-
import { CloseOutlined, RightOutlined } from "@ant-design/icons";
|
|
14
|
+
import { CustomAiIcon, CustomRecord, CustomFullScreen, CustomExitFullScreen, CustomReloading, CustomCopy, CustomLike, CustomDislike, CustomQuote, CustomSending, CustomContacts, CustomDuihao, CustomRoundClose, CustomScreenshot, CustomKnowledgeContent, CustomWenhaoRound } from "../icons/index";
|
|
15
|
+
import { CloseOutlined, RightOutlined, ZoomInOutlined } from "@ant-design/icons";
|
|
14
16
|
import HistoryFun from "./historyFun";
|
|
15
17
|
import ContactsList from "./contactsList";
|
|
18
|
+
import ScreenshotTool from "./screenshotTool";
|
|
16
19
|
import { parseDate } from "../utils/Date";
|
|
17
20
|
import { Remarkable } from "remarkable";
|
|
18
21
|
import hljs from "highlight.js";
|
|
@@ -21,12 +24,12 @@ import { render } from "react-dom";
|
|
|
21
24
|
import Provider from "../provider";
|
|
22
25
|
const { TextArea } = Input;
|
|
23
26
|
import knowledge_icon from "./images/knowledge_icon.png";
|
|
24
|
-
import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
25
|
-
import { readMessage, getByteLen, serverUrl, copyText, getDataTime } from "./function"; //一些方法
|
|
27
|
+
// import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
28
|
+
import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
|
|
26
29
|
const CustomerService = (props)=>{
|
|
27
|
-
let { userData , http , urllocation , onCancel , serverName , fetchEventSource , initShowType , onEvent , stepIds , stepId } = props;
|
|
28
|
-
const { bese64String
|
|
29
|
-
const [voiceRecordingStatus, setVoiceRecordingStatus] = useState(3); //语音录制状态 3,语音识别完成 2,录制中, 1,录制结束
|
|
30
|
+
let { userData , http , urllocation , onCancel , serverName , fetchEventSource , initShowType , onEvent , stepIds , stepId , config } = props;
|
|
31
|
+
// const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
|
|
32
|
+
// const [voiceRecordingStatus, setVoiceRecordingStatus] = useState(3); //语音录制状态 3,语音识别完成 2,录制中, 1,录制结束
|
|
30
33
|
const [copyTextOBJ, setCopyTextObj] = useState([]); //复制的消息id
|
|
31
34
|
const [citationContent, setCitationContent] = useState({}); //引用内容
|
|
32
35
|
const [roomId, setRoomId] = useState(""); //聊天室id
|
|
@@ -54,9 +57,14 @@ const CustomerService = (props)=>{
|
|
|
54
57
|
const [contactsList, setContactsList] = useState([]); //老师列表
|
|
55
58
|
const [chatObj, setChatObj] = useState([]); //聊天记录id保存,用来在实验报告中记录
|
|
56
59
|
const [keyWordProblem, setKeyWordProblem] = useState(""); //历史记录搜索的内容
|
|
60
|
+
const [imgBese64, setImgBese64] = useState(""); //屏幕截图
|
|
61
|
+
const [screenshotBese64, setScreenshotBese64] = useState(""); //bese64图片
|
|
62
|
+
const [viewBase64, setViewBase64] = useState(""); //图片预览
|
|
63
|
+
const [visible, setVisible] = useState(false); //是否显示图片预览
|
|
64
|
+
const [bottomRecommendationQuestions, setBottomRecommendationQuestions] = useState([]); //底部推荐问题
|
|
57
65
|
const timer = useRef(null); //文本框输入时
|
|
58
66
|
let receiveMessageTimer = useRef(null); //接收ai发回的消息
|
|
59
|
-
let voiceCountdownTimer = useRef(null); //语音录制倒计时
|
|
67
|
+
// let voiceCountdownTimer = useRef(null); //语音录制倒计时
|
|
60
68
|
let listTimer = useRef(null); // 请求列表倒计时
|
|
61
69
|
let roomMessage = useRef(null); //循环当前页面的新消息
|
|
62
70
|
let chatRoomList = useRef(null); //获取聊天室列表
|
|
@@ -64,6 +72,7 @@ const CustomerService = (props)=>{
|
|
|
64
72
|
let childRef = useRef(null); //获取子组件方法
|
|
65
73
|
let scrollTopHei = useRef(0);
|
|
66
74
|
let isPosition = useRef(true);
|
|
75
|
+
let recommendeQuestionID = useRef([]); //推荐问题id
|
|
67
76
|
const mid = props.userData.mid;
|
|
68
77
|
const remarkable = new Remarkable({
|
|
69
78
|
highlight: function(str, lang) {
|
|
@@ -79,21 +88,27 @@ const CustomerService = (props)=>{
|
|
|
79
88
|
}
|
|
80
89
|
});
|
|
81
90
|
useEffect(()=>{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
console.log(showType, 'showTypeshowTypeshowType');
|
|
92
|
+
if (showType == 5) {
|
|
93
|
+
//document.querySelector("#__docusaurus")
|
|
94
|
+
setTimeout(()=>{
|
|
95
|
+
html2canvas(document.getElementsByTagName('body')[0], {
|
|
96
|
+
allowTaint: true,
|
|
97
|
+
useCORS: true,
|
|
98
|
+
scale: 1 // 图片比例
|
|
99
|
+
}).then(function(canvas) {
|
|
100
|
+
document.body.appendChild(canvas);
|
|
101
|
+
var base64URL = canvas.toDataURL('image/jpeg');
|
|
102
|
+
var image = new Image();
|
|
103
|
+
image.src = base64URL; // 将'your_image_url'替换为你自己的图片URL
|
|
104
|
+
console.log(base64URL);
|
|
105
|
+
setImgBese64(base64URL);
|
|
106
|
+
});
|
|
107
|
+
}, 1000);
|
|
108
|
+
}
|
|
92
109
|
if (showType != 1 && !firstLoad && pageCount > 0) {
|
|
93
110
|
setFirstLoad(true);
|
|
94
|
-
|
|
95
|
-
scrollToBottom();
|
|
96
|
-
}, 100);
|
|
111
|
+
scrollToBottom();
|
|
97
112
|
}
|
|
98
113
|
function handleScroll() {
|
|
99
114
|
const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
@@ -158,6 +173,7 @@ const CustomerService = (props)=>{
|
|
|
158
173
|
]);
|
|
159
174
|
useEffect(()=>{
|
|
160
175
|
resettingBottomHei();
|
|
176
|
+
scrollToBottom();
|
|
161
177
|
let dom = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
162
178
|
if (dom) {
|
|
163
179
|
if (showType == 1) {
|
|
@@ -174,9 +190,11 @@ const CustomerService = (props)=>{
|
|
|
174
190
|
]);
|
|
175
191
|
useEffect(()=>{
|
|
176
192
|
// console.log(props,'lsdkcmsdlcksd')
|
|
177
|
-
getQuestiionsList("", 1);
|
|
178
|
-
scrollToBottom();
|
|
193
|
+
// getQuestiionsList("", 1);
|
|
179
194
|
setShowType(initShowType);
|
|
195
|
+
//获取视频页面推荐问题
|
|
196
|
+
videoPageQuestiionsList();
|
|
197
|
+
scrollToBottom();
|
|
180
198
|
}, [
|
|
181
199
|
initShowType
|
|
182
200
|
]);
|
|
@@ -189,6 +207,14 @@ const CustomerService = (props)=>{
|
|
|
189
207
|
getHistoryMessage(pageNum, 1);
|
|
190
208
|
}
|
|
191
209
|
}
|
|
210
|
+
//复制代码功能
|
|
211
|
+
let chat_content = document.getElementById('chat_content');
|
|
212
|
+
if (chat_content) {
|
|
213
|
+
chat_content = document.getElementById('chat_content');
|
|
214
|
+
delegate(chat_content, 'click', `.${styles.copyCode}`, (event, target)=>{
|
|
215
|
+
findCopyContent(event);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
192
218
|
}, [
|
|
193
219
|
roomId
|
|
194
220
|
]);
|
|
@@ -199,6 +225,11 @@ const CustomerService = (props)=>{
|
|
|
199
225
|
});
|
|
200
226
|
roomsListTimer();
|
|
201
227
|
return ()=>{
|
|
228
|
+
clearTimeout(receiveMessageTimer.current);
|
|
229
|
+
// clearTimeout(voiceCountdownTimer.current);
|
|
230
|
+
clearTimeout(listTimer.current);
|
|
231
|
+
clearTimeout(timer.current);
|
|
232
|
+
clearTimeout(roomMessage.current);
|
|
202
233
|
clearTimeout(chatRoomList.current);
|
|
203
234
|
};
|
|
204
235
|
}, []);
|
|
@@ -214,63 +245,77 @@ const CustomerService = (props)=>{
|
|
|
214
245
|
if (count > 0) {
|
|
215
246
|
setShowContacts(true);
|
|
216
247
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} else {
|
|
222
|
-
try {
|
|
223
|
-
if (historyMessageList[historyMessageList.length - 1].extraInfo == null) {
|
|
224
|
-
sendGreetingMessage(1);
|
|
225
|
-
} 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")) {
|
|
226
|
-
// console.log(
|
|
227
|
-
// JSON.parse(
|
|
228
|
-
// historyMessageList[historyMessageList.length - 1].extraInfo,
|
|
229
|
-
// "sdklsdksd"
|
|
230
|
-
// )
|
|
231
|
-
// );
|
|
232
|
-
sendGreetingMessage(1);
|
|
233
|
-
}
|
|
234
|
-
} catch (error) {}
|
|
235
|
-
}
|
|
248
|
+
//发送打招呼信息
|
|
249
|
+
if (!(roomList.length > 0 && roomList[0].roomId != roomId && greetingMessage)) {
|
|
250
|
+
sendGreetingMessage(1);
|
|
251
|
+
scrollToBottom();
|
|
236
252
|
}
|
|
237
|
-
scrollToBottom();
|
|
238
253
|
}, [
|
|
239
254
|
greetingMessage,
|
|
240
255
|
hotQuestionsList
|
|
241
256
|
]);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
257
|
+
//查找需要复制的代码
|
|
258
|
+
const findCopyContent = (e)=>{
|
|
259
|
+
let source = findParent(e.target, styles.copyCode);
|
|
260
|
+
if (!source) return;
|
|
261
|
+
let id = source.getAttribute('data-id');
|
|
262
|
+
let position = source.getAttribute('data-position');
|
|
263
|
+
if (!id && !position) return;
|
|
264
|
+
let message = '';
|
|
265
|
+
setHistoryMessageList((list)=>{
|
|
266
|
+
var _list_filter_;
|
|
267
|
+
message = (_list_filter_ = list.filter((e)=>e.id == id)[0]) === null || _list_filter_ === void 0 ? void 0 : _list_filter_.message;
|
|
268
|
+
return list;
|
|
269
|
+
});
|
|
270
|
+
if (!message) return;
|
|
271
|
+
let codeConment = '';
|
|
272
|
+
let i = 0;
|
|
273
|
+
message.replaceAll(new RegExp(/```(?:.|\n)*?```/, "ig"), (con)=>{
|
|
274
|
+
i++;
|
|
275
|
+
if (i == position) {
|
|
276
|
+
codeConment = con;
|
|
277
|
+
return con;
|
|
278
|
+
} else {
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
resetStyles();
|
|
283
|
+
source.classList.add('copy_success');
|
|
284
|
+
source.children[2].innerText = '复制成功';
|
|
285
|
+
copyText(codeConment);
|
|
286
|
+
setTimeout(()=>{
|
|
287
|
+
try {
|
|
288
|
+
resetStyles();
|
|
289
|
+
} catch (error) {}
|
|
290
|
+
}, 3000);
|
|
291
|
+
};
|
|
251
292
|
//AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
|
|
252
293
|
const sendGreetingMessage = (type)=>{
|
|
253
294
|
let questionsList = [];
|
|
254
295
|
let obj = {};
|
|
255
296
|
if (type == 1) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
297
|
+
let questionsId = [];
|
|
298
|
+
questionsList = hotQuestionsList.map((item, index)=>{
|
|
299
|
+
if (index < 3) {
|
|
300
|
+
questionsId.push(item.id);
|
|
301
|
+
return {
|
|
302
|
+
key: "messageSource",
|
|
303
|
+
value: item.id,
|
|
304
|
+
question: item.question,
|
|
305
|
+
answer: item.answer
|
|
306
|
+
};
|
|
307
|
+
} else {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
recommendeQuestionID.current = questionsId; //保存推荐问题id
|
|
312
|
+
questionsList = questionsList.filter((i)=>i != null);
|
|
269
313
|
obj = {
|
|
270
314
|
roomId: roomId,
|
|
271
315
|
sender: "AI",
|
|
272
316
|
recevier: mid,
|
|
273
|
-
message: `Hi
|
|
317
|
+
message: `Hi,我是智能学习助手,你遇到了什么问题?`,
|
|
318
|
+
extraInfos: questionsList
|
|
274
319
|
};
|
|
275
320
|
if (pageNumHistory <= 1) {
|
|
276
321
|
setHistoryMessageList((historyMessageList)=>{
|
|
@@ -280,19 +325,11 @@ const CustomerService = (props)=>{
|
|
|
280
325
|
downvoted: false,
|
|
281
326
|
quotedMessage: "",
|
|
282
327
|
createdAt: getDataTime(-1),
|
|
283
|
-
|
|
284
|
-
extraInfo: JSON.stringify([
|
|
285
|
-
{
|
|
286
|
-
key: "messageSource",
|
|
287
|
-
value: "knowledgebase"
|
|
288
|
-
}
|
|
289
|
-
])
|
|
328
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
290
329
|
}));
|
|
291
330
|
return newHistoryMessageList;
|
|
292
331
|
});
|
|
293
|
-
|
|
294
|
-
scrollToBottom();
|
|
295
|
-
}, 100);
|
|
332
|
+
scrollToBottom();
|
|
296
333
|
}
|
|
297
334
|
return;
|
|
298
335
|
} else if (type == 2) {
|
|
@@ -381,9 +418,7 @@ const CustomerService = (props)=>{
|
|
|
381
418
|
}));
|
|
382
419
|
return newHistoryMessageList;
|
|
383
420
|
});
|
|
384
|
-
|
|
385
|
-
scrollToBottom();
|
|
386
|
-
}, 100);
|
|
421
|
+
scrollToBottom();
|
|
387
422
|
}
|
|
388
423
|
return;
|
|
389
424
|
}
|
|
@@ -454,12 +489,7 @@ const CustomerService = (props)=>{
|
|
|
454
489
|
return newHistoryMessageList;
|
|
455
490
|
});
|
|
456
491
|
// console.log(lastId,'消息发送给老师111');
|
|
457
|
-
|
|
458
|
-
setTimeout(()=>{
|
|
459
|
-
console.log('滚动到底部');
|
|
460
|
-
scrollToBottom();
|
|
461
|
-
}, 100);
|
|
462
|
-
// }
|
|
492
|
+
scrollToBottom();
|
|
463
493
|
}
|
|
464
494
|
//判断当前窗口是否是
|
|
465
495
|
if (type == 1) {
|
|
@@ -479,8 +509,9 @@ const CustomerService = (props)=>{
|
|
|
479
509
|
console.log(err);
|
|
480
510
|
});
|
|
481
511
|
};
|
|
482
|
-
//发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2
|
|
512
|
+
//发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2 是普通消息,flag == 3 是针对视频页面点击底部推荐问题
|
|
483
513
|
const sendMessage = (item, flag)=>{
|
|
514
|
+
console.log(item, flag, 888888888);
|
|
484
515
|
let questions = [];
|
|
485
516
|
if (item && flag) {
|
|
486
517
|
questions = [
|
|
@@ -513,6 +544,27 @@ const CustomerService = (props)=>{
|
|
|
513
544
|
setQuestionsList([]);
|
|
514
545
|
setCitationContent({});
|
|
515
546
|
} else if (userData.modules.some((item)=>item.short == "AIservice")) {
|
|
547
|
+
let sendData = {
|
|
548
|
+
//相关数据
|
|
549
|
+
roomId: roomId,
|
|
550
|
+
message: keyWord,
|
|
551
|
+
quotedMessage: citationContent.content || "",
|
|
552
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
553
|
+
generateUpvoteOrDownvoteMessage: false
|
|
554
|
+
};
|
|
555
|
+
let imageUrl = '';
|
|
556
|
+
// if(citationContent.imageUrl){
|
|
557
|
+
// sendData.image = citationContent.imageUrl;
|
|
558
|
+
// imageUrl = citationContent.imageUrl;
|
|
559
|
+
// getBase64Image(citationContent.imageUrl).then((res)=>{
|
|
560
|
+
// console.log(res,33333);
|
|
561
|
+
// });
|
|
562
|
+
// console.log(imageUrl,'转换的bese64');
|
|
563
|
+
// }
|
|
564
|
+
if (screenshotBese64) {
|
|
565
|
+
sendData.image = screenshotBese64;
|
|
566
|
+
imageUrl = screenshotBese64;
|
|
567
|
+
}
|
|
516
568
|
if (pageNumHistory <= 1) {
|
|
517
569
|
setHistoryMessageList((historyMessageList)=>{
|
|
518
570
|
let newHistoryMessageList = historyMessageList.concat({
|
|
@@ -525,20 +577,19 @@ const CustomerService = (props)=>{
|
|
|
525
577
|
upvoted: false,
|
|
526
578
|
downvoted: false,
|
|
527
579
|
createdAt: getDataTime(-1),
|
|
528
|
-
extraInfo: JSON.stringify([
|
|
580
|
+
extraInfo: imageUrl ? JSON.stringify([
|
|
581
|
+
{
|
|
582
|
+
key: "imageUrl",
|
|
583
|
+
value: imageUrl
|
|
584
|
+
}
|
|
585
|
+
]) : JSON.stringify([])
|
|
529
586
|
});
|
|
530
587
|
return newHistoryMessageList;
|
|
531
588
|
});
|
|
532
589
|
}
|
|
533
590
|
setFinished(false);
|
|
534
|
-
aiSendQuestions(3,
|
|
535
|
-
|
|
536
|
-
roomId: roomId,
|
|
537
|
-
message: keyWord,
|
|
538
|
-
quotedMessage: citationContent.content || "",
|
|
539
|
-
regenerate: citationContent.content != "" ? false : true,
|
|
540
|
-
generateUpvoteOrDownvoteMessage: false
|
|
541
|
-
}, 1);
|
|
591
|
+
aiSendQuestions(3, sendData, 1);
|
|
592
|
+
setScreenshotBese64('');
|
|
542
593
|
//存在AI客服
|
|
543
594
|
} else {
|
|
544
595
|
//不存在AI客服
|
|
@@ -560,6 +611,11 @@ const CustomerService = (props)=>{
|
|
|
560
611
|
});
|
|
561
612
|
scrollToBottom();
|
|
562
613
|
}
|
|
614
|
+
console.log(type, '接受答案77777');
|
|
615
|
+
//获取下面的推荐问题
|
|
616
|
+
if (type == 2) {
|
|
617
|
+
videoPageQuestiionsList(2);
|
|
618
|
+
}
|
|
563
619
|
http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj).then((res)=>{
|
|
564
620
|
if (res.data.id) {
|
|
565
621
|
if (pageNumHistory <= 1) {
|
|
@@ -622,18 +678,6 @@ const CustomerService = (props)=>{
|
|
|
622
678
|
});
|
|
623
679
|
}, 60 * 1000);
|
|
624
680
|
let data = JSON.stringify(obj);
|
|
625
|
-
// if (type == 1 || type == 2) {
|
|
626
|
-
// data = JSON.stringify(obj);
|
|
627
|
-
// } else if(type == 3){
|
|
628
|
-
// data = JSON.stringify({
|
|
629
|
-
// //相关数据
|
|
630
|
-
// roomId: roomId,
|
|
631
|
-
// message: keyWord,
|
|
632
|
-
// quotedMessage: citationContent.content || "",
|
|
633
|
-
// regenerate: citationContent.content != "" ? false : true,
|
|
634
|
-
// generateUpvoteOrDownvoteMessage: false,
|
|
635
|
-
// });
|
|
636
|
-
// }
|
|
637
681
|
setKeyWord("");
|
|
638
682
|
setQuestionsList([]);
|
|
639
683
|
setTimeout(()=>{
|
|
@@ -671,9 +715,7 @@ const CustomerService = (props)=>{
|
|
|
671
715
|
});
|
|
672
716
|
}
|
|
673
717
|
});
|
|
674
|
-
|
|
675
|
-
scrollToBottom();
|
|
676
|
-
}, 10);
|
|
718
|
+
scrollToBottom();
|
|
677
719
|
}
|
|
678
720
|
//使用fetchEventSource接收数据
|
|
679
721
|
const eventSource = fetchEventSource(`${urllocation}/chat-service/public/v1.0/chat-with-ai/messages`, {
|
|
@@ -681,7 +723,8 @@ const CustomerService = (props)=>{
|
|
|
681
723
|
headers: {
|
|
682
724
|
"Content-Type": "application/json",
|
|
683
725
|
Accept: "text/event-stream,application/json",
|
|
684
|
-
"X-Auth-Jwt": window.localStorage.getItem("usertoken") || "",
|
|
726
|
+
// "X-Auth-Jwt": window.localStorage.getItem("usertoken") || "",
|
|
727
|
+
"X-Auth-Jwt": sessionStorage.getItem('jwt') || "",
|
|
685
728
|
"Auth-Token": userData.token,
|
|
686
729
|
"X-Module-Id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id
|
|
687
730
|
},
|
|
@@ -849,11 +892,9 @@ const CustomerService = (props)=>{
|
|
|
849
892
|
return newHistoryMessageList2;
|
|
850
893
|
}
|
|
851
894
|
});
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
}
|
|
856
|
-
}, 10);
|
|
895
|
+
if (isPosition.current) {
|
|
896
|
+
scrollToBottom();
|
|
897
|
+
}
|
|
857
898
|
};
|
|
858
899
|
//问题记录到实验报告中
|
|
859
900
|
const testLabQuestion = (title, content, teachId)=>{
|
|
@@ -874,21 +915,6 @@ const CustomerService = (props)=>{
|
|
|
874
915
|
});
|
|
875
916
|
}
|
|
876
917
|
};
|
|
877
|
-
//语音转文字
|
|
878
|
-
const speechToText = ()=>{
|
|
879
|
-
http.post(`${urllocation}/chat-service/public/v1.0/speech:recognize`, {
|
|
880
|
-
audio: bese64String
|
|
881
|
-
}).then((res)=>{
|
|
882
|
-
setVoiceRecordingStatus(3);
|
|
883
|
-
if (res.data) {
|
|
884
|
-
setKeyWord(res.data.text);
|
|
885
|
-
resettingBottomHei();
|
|
886
|
-
}
|
|
887
|
-
}).catch((err)=>{
|
|
888
|
-
setKeyWord("");
|
|
889
|
-
setVoiceRecordingStatus(3);
|
|
890
|
-
});
|
|
891
|
-
};
|
|
892
918
|
//创建聊天室
|
|
893
919
|
const createRooms = (uid)=>{
|
|
894
920
|
return http.post(`${urllocation}/chat-service/public/v1.0/rooms`, {
|
|
@@ -976,6 +1002,9 @@ const CustomerService = (props)=>{
|
|
|
976
1002
|
if (flag != 4) {
|
|
977
1003
|
if (pageNum == 1 && (flag == 2 || flag == 3)) {
|
|
978
1004
|
scrollToBottom();
|
|
1005
|
+
setTimeout(()=>{
|
|
1006
|
+
scrollToBottom();
|
|
1007
|
+
}, 1000);
|
|
979
1008
|
} else {
|
|
980
1009
|
scrollTo("li_flag");
|
|
981
1010
|
}
|
|
@@ -1047,10 +1076,8 @@ const CustomerService = (props)=>{
|
|
|
1047
1076
|
});
|
|
1048
1077
|
// console.log(dataList.length , originList,lastId,'dfkvdnfkvdfj44444');
|
|
1049
1078
|
if (!lastId && originList != newList) {
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
readMessage(roomId, urllocation, userData, http);
|
|
1053
|
-
}, 100);
|
|
1079
|
+
scrollToBottom();
|
|
1080
|
+
readMessage(roomId, urllocation, userData, http);
|
|
1054
1081
|
}
|
|
1055
1082
|
}
|
|
1056
1083
|
try {
|
|
@@ -1161,7 +1188,7 @@ const CustomerService = (props)=>{
|
|
|
1161
1188
|
});
|
|
1162
1189
|
});
|
|
1163
1190
|
};
|
|
1164
|
-
//获取问题列表flag ==1 是问候消息 2,搜索列表 展示相关问题
|
|
1191
|
+
//获取问题列表flag ==1 是问候消息 2,搜索列表 展示相关问题 ,3.视频页面,4.视频联想问题不够时,增加知识库联想问题
|
|
1165
1192
|
const getQuestiionsList = (value, flag)=>{
|
|
1166
1193
|
let data = {};
|
|
1167
1194
|
if (flag == 1) {
|
|
@@ -1169,6 +1196,19 @@ const CustomerService = (props)=>{
|
|
|
1169
1196
|
page: 1,
|
|
1170
1197
|
maxPageSize: 5
|
|
1171
1198
|
};
|
|
1199
|
+
} else if (flag == 3) {
|
|
1200
|
+
data = {
|
|
1201
|
+
page: 1,
|
|
1202
|
+
maxPageSize: 4,
|
|
1203
|
+
question: value,
|
|
1204
|
+
sectionId: getQuery('s_id') || 325569
|
|
1205
|
+
};
|
|
1206
|
+
} else if (flag == 4) {
|
|
1207
|
+
data = {
|
|
1208
|
+
page: 1,
|
|
1209
|
+
maxPageSize: 4,
|
|
1210
|
+
question: value
|
|
1211
|
+
};
|
|
1172
1212
|
} else {
|
|
1173
1213
|
data = {
|
|
1174
1214
|
page: 1,
|
|
@@ -1180,14 +1220,71 @@ const CustomerService = (props)=>{
|
|
|
1180
1220
|
params: data
|
|
1181
1221
|
}).then((res)=>{
|
|
1182
1222
|
if (res.data.questions) {
|
|
1223
|
+
let questionList = res.data.questions;
|
|
1183
1224
|
if (flag == 1) {
|
|
1184
|
-
setHotQuestionsList(
|
|
1225
|
+
setHotQuestionsList(questionList);
|
|
1226
|
+
} else if (flag == 4) {
|
|
1227
|
+
setQuestionsList((questionList)=>{
|
|
1228
|
+
return [
|
|
1229
|
+
...questionList,
|
|
1230
|
+
...res.data.questions
|
|
1231
|
+
];
|
|
1232
|
+
});
|
|
1185
1233
|
} else {
|
|
1186
|
-
setQuestionsList(
|
|
1234
|
+
setQuestionsList(questionList);
|
|
1235
|
+
}
|
|
1236
|
+
if (questionList.length < 4 && flag == 3) {
|
|
1237
|
+
console.log('视频页面,联想问题小于4个');
|
|
1238
|
+
//视频页面,联想问题小于4个
|
|
1239
|
+
getQuestiionsList(value, 4);
|
|
1187
1240
|
}
|
|
1188
1241
|
}
|
|
1189
1242
|
});
|
|
1190
1243
|
};
|
|
1244
|
+
//获取视频页面热门问题 flag == 1,默认推荐问题 == 2,已经推荐过问题
|
|
1245
|
+
const videoPageQuestiionsList = (flag = 1)=>{
|
|
1246
|
+
console.log(props, 3333333);
|
|
1247
|
+
let config = props.config;
|
|
1248
|
+
if (config && config.type == 'video' && config.params) {
|
|
1249
|
+
console.log('请求接口2222', config);
|
|
1250
|
+
let params = config.params;
|
|
1251
|
+
let videoId = params.videoPageData.videoId;
|
|
1252
|
+
let watchTime = params.videoPageData.videoProgress;
|
|
1253
|
+
let courseId = getQuery('yc_id') || 10;
|
|
1254
|
+
let sectionId = getQuery('s_id') || 20;
|
|
1255
|
+
if (videoId && watchTime && courseId && sectionId) {
|
|
1256
|
+
console.log('请求接口2222');
|
|
1257
|
+
http.post(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions:recommend`, {
|
|
1258
|
+
"recommendedQuestions": flag == 2 ? recommendeQuestionID.current : [
|
|
1259
|
+
''
|
|
1260
|
+
],
|
|
1261
|
+
"contexts": [
|
|
1262
|
+
{
|
|
1263
|
+
"type": "VIDEO",
|
|
1264
|
+
"courseId": courseId,
|
|
1265
|
+
"sectionId": sectionId,
|
|
1266
|
+
"videoId": videoId,
|
|
1267
|
+
"watchTime": watchTime
|
|
1268
|
+
}
|
|
1269
|
+
],
|
|
1270
|
+
"maximum": 5
|
|
1271
|
+
}).then((res)=>{
|
|
1272
|
+
console.log(res, 333333);
|
|
1273
|
+
if (res.data.total > 0) {
|
|
1274
|
+
let data = res.data.questions;
|
|
1275
|
+
if (flag == 2) {
|
|
1276
|
+
setBottomRecommendationQuestions(data);
|
|
1277
|
+
} else {
|
|
1278
|
+
setHotQuestionsList(data);
|
|
1279
|
+
}
|
|
1280
|
+
resettingBottomHei();
|
|
1281
|
+
scrollToBottom();
|
|
1282
|
+
console.log(data, 99999);
|
|
1283
|
+
}
|
|
1284
|
+
}).catch(()=>{});
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1191
1288
|
//获取老师列表
|
|
1192
1289
|
const getTeacherList = (keyWord)=>{
|
|
1193
1290
|
http.get(`${urllocation}/chat-service/public/v1.0/teachers`, {
|
|
@@ -1279,11 +1376,14 @@ const CustomerService = (props)=>{
|
|
|
1279
1376
|
};
|
|
1280
1377
|
//设置滚动条滚动到底部
|
|
1281
1378
|
const scrollToBottom = ()=>{
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
container
|
|
1285
|
-
|
|
1379
|
+
setTimeout(()=>{
|
|
1380
|
+
const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1381
|
+
if (container) {
|
|
1382
|
+
container.scrollTop = container.scrollHeight;
|
|
1383
|
+
}
|
|
1384
|
+
}, 100);
|
|
1286
1385
|
};
|
|
1386
|
+
//滚动到指定位置
|
|
1287
1387
|
const scrollTo = (id)=>{
|
|
1288
1388
|
const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1289
1389
|
const container2 = document.getElementById(id);
|
|
@@ -1292,12 +1392,6 @@ const CustomerService = (props)=>{
|
|
|
1292
1392
|
try {
|
|
1293
1393
|
setTimeout(()=>{
|
|
1294
1394
|
let top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
|
|
1295
|
-
// let top =
|
|
1296
|
-
// showType == 1 || showType == 3
|
|
1297
|
-
// ? $("#li_flag").offset().top
|
|
1298
|
-
// : $("#chat_content_modal #li_flag").offset().top -
|
|
1299
|
-
// $("#chat_content_modal").offset().top;
|
|
1300
|
-
// console.log(top2,top,444444444444)
|
|
1301
1395
|
$(`#${showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal"}`).animate({
|
|
1302
1396
|
scrollTop: top
|
|
1303
1397
|
}, 0);
|
|
@@ -1306,6 +1400,22 @@ const CustomerService = (props)=>{
|
|
|
1306
1400
|
setLoading(false);
|
|
1307
1401
|
}
|
|
1308
1402
|
};
|
|
1403
|
+
//重置底部输入框高度
|
|
1404
|
+
const resettingBottomHei = ()=>{
|
|
1405
|
+
setTimeout(()=>{
|
|
1406
|
+
if (showType == 1 || showType == 3) {
|
|
1407
|
+
if (document.getElementById("Drawer_buttom")) {
|
|
1408
|
+
let hei = document.getElementById("Drawer_buttom").offsetHeight + document.getElementById("BottomAssociationProblem").offsetHeight;
|
|
1409
|
+
setButtomHei(hei);
|
|
1410
|
+
}
|
|
1411
|
+
} else {
|
|
1412
|
+
if (document.getElementById("Drawer_buttom_modal")) {
|
|
1413
|
+
let hei = document.getElementById("Drawer_buttom_modal").offsetHeight + document.getElementById("BottomAssociationProblem").offsetHeight;
|
|
1414
|
+
setButtomHei(hei);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}, 50);
|
|
1418
|
+
};
|
|
1309
1419
|
// 获取新的JWT
|
|
1310
1420
|
const verifyJWT = (url)=>{
|
|
1311
1421
|
return new Promise((resolve)=>{
|
|
@@ -1339,6 +1449,7 @@ const CustomerService = (props)=>{
|
|
|
1339
1449
|
//显示聊天室名字
|
|
1340
1450
|
const showChatRoomName = ()=>{
|
|
1341
1451
|
let title = "AI助手";
|
|
1452
|
+
title = userData.modules.some((ele)=>ele.short == "AIservice") ? "AI助手" : "智能问答";
|
|
1342
1453
|
let list = contactsList.filter((e)=>e.roomId == roomId);
|
|
1343
1454
|
if (list.length > 0 && list[0].name) {
|
|
1344
1455
|
title = list[0].name;
|
|
@@ -1415,13 +1526,19 @@ const CustomerService = (props)=>{
|
|
|
1415
1526
|
/*#__PURE__*/ _jsxs("div", {
|
|
1416
1527
|
className: styles.operate,
|
|
1417
1528
|
children: [
|
|
1418
|
-
/*#__PURE__*/
|
|
1419
|
-
className:
|
|
1529
|
+
/*#__PURE__*/ _jsxs("i", {
|
|
1530
|
+
className: styles.popover_main,
|
|
1420
1531
|
onClick: ()=>{
|
|
1421
1532
|
setShowHistory(true);
|
|
1422
1533
|
onEvent(serverName + serverUrl(), "click_智能问答_历史记录", "提交");
|
|
1423
1534
|
},
|
|
1424
|
-
children:
|
|
1535
|
+
children: [
|
|
1536
|
+
/*#__PURE__*/ _jsx(CustomRecord, {}),
|
|
1537
|
+
/*#__PURE__*/ _jsx("span", {
|
|
1538
|
+
className: styles.popover,
|
|
1539
|
+
children: "历史记录"
|
|
1540
|
+
})
|
|
1541
|
+
]
|
|
1425
1542
|
}),
|
|
1426
1543
|
/*#__PURE__*/ _jsx("span", {
|
|
1427
1544
|
className: styles.line
|
|
@@ -1449,7 +1566,9 @@ const CustomerService = (props)=>{
|
|
|
1449
1566
|
children: /*#__PURE__*/ _jsx(CustomExitFullScreen, {})
|
|
1450
1567
|
}),
|
|
1451
1568
|
/*#__PURE__*/ _jsx("i", {
|
|
1452
|
-
onClick:
|
|
1569
|
+
onClick: ()=>{
|
|
1570
|
+
onCancel();
|
|
1571
|
+
},
|
|
1453
1572
|
children: /*#__PURE__*/ _jsx(CloseOutlined, {})
|
|
1454
1573
|
})
|
|
1455
1574
|
]
|
|
@@ -1458,22 +1577,6 @@ const CustomerService = (props)=>{
|
|
|
1458
1577
|
});
|
|
1459
1578
|
}
|
|
1460
1579
|
};
|
|
1461
|
-
//重置底部输入框高度
|
|
1462
|
-
const resettingBottomHei = ()=>{
|
|
1463
|
-
setTimeout(()=>{
|
|
1464
|
-
if (showType == 1 || showType == 3) {
|
|
1465
|
-
if (document.getElementById("Drawer_buttom")) {
|
|
1466
|
-
let hei = document.getElementById("Drawer_buttom").offsetHeight;
|
|
1467
|
-
setButtomHei(hei);
|
|
1468
|
-
}
|
|
1469
|
-
} else {
|
|
1470
|
-
if (document.getElementById("Drawer_buttom_modal")) {
|
|
1471
|
-
let hei = document.getElementById("Drawer_buttom_modal").offsetHeight;
|
|
1472
|
-
setButtomHei(hei);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
}, 50);
|
|
1476
|
-
};
|
|
1477
1580
|
//切换聊天室 type == renew ,存在新消息
|
|
1478
1581
|
const switchChatRoom = (id, type)=>{
|
|
1479
1582
|
if (type != "1") {
|
|
@@ -1510,19 +1613,12 @@ const CustomerService = (props)=>{
|
|
|
1510
1613
|
// setRoomId(id);
|
|
1511
1614
|
// }
|
|
1512
1615
|
};
|
|
1513
|
-
// const saveContactsList = (list: any)=>{
|
|
1514
|
-
// console.log(list,44444444)
|
|
1515
|
-
// // if(list != undefined){
|
|
1516
|
-
// // setRoomList(list);
|
|
1517
|
-
// // }
|
|
1518
|
-
// }
|
|
1519
1616
|
//渲染问答
|
|
1520
1617
|
const renderQuestion = ()=>{
|
|
1521
1618
|
// if (historyMessageList.length > 0) {
|
|
1522
1619
|
return /*#__PURE__*/ _jsx("ul", {
|
|
1523
1620
|
className: styles.message_con,
|
|
1524
1621
|
children: historyMessageList.map((item, i)=>{
|
|
1525
|
-
console.log(item, 444444888888);
|
|
1526
1622
|
let timeObj = parseDate(item.createdAt);
|
|
1527
1623
|
// console.log(item.message);
|
|
1528
1624
|
let message = item.message;
|
|
@@ -1552,6 +1648,9 @@ const CustomerService = (props)=>{
|
|
|
1552
1648
|
}
|
|
1553
1649
|
}
|
|
1554
1650
|
let dataTime = time;
|
|
1651
|
+
// let code = message.split("```");
|
|
1652
|
+
// code = code[1];
|
|
1653
|
+
// console.log(code,888888888);
|
|
1555
1654
|
if (lastId == item.id && keyWordProblem != '') {
|
|
1556
1655
|
message = remarkable.render(message);
|
|
1557
1656
|
message = message.replaceAll(keyWordProblem, (e)=>{
|
|
@@ -1560,6 +1659,47 @@ const CustomerService = (props)=>{
|
|
|
1560
1659
|
} else {
|
|
1561
1660
|
message = remarkable.render(message);
|
|
1562
1661
|
}
|
|
1662
|
+
let position = 0;
|
|
1663
|
+
message = message.replaceAll(new RegExp(`<pre`, 'ig'), (i, index)=>{
|
|
1664
|
+
//copyText(${item.message,2,position})
|
|
1665
|
+
position++;
|
|
1666
|
+
// console.log(i,index,onClick={copyText} ,'skdcnsdjk')
|
|
1667
|
+
let text = `<p class='${styles.copyCode} copyCodeFun' data-id=${item.id} data-position=${position}>
|
|
1668
|
+
<span class='${styles.icon} copy' >
|
|
1669
|
+
<svg
|
|
1670
|
+
width="1em"
|
|
1671
|
+
height="1em"
|
|
1672
|
+
viewBox="0 0 14 14"
|
|
1673
|
+
shape-rendering="geometricPrecision"
|
|
1674
|
+
fill="currentColor"
|
|
1675
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1676
|
+
>
|
|
1677
|
+
<g clip-path="url(#clip0_518_8403)">
|
|
1678
|
+
<path
|
|
1679
|
+
d="M6.16666 1.66666H13.1667C13.4761 1.66666 13.7728 1.78957 13.9916 2.00837C14.2104 2.22716 14.3333 2.5239 14.3333 2.83332V9.83332C14.3333 10.1427 14.2104 10.4395 13.9916 10.6583C13.7728 10.8771 13.4761 11 13.1667 11H6.16666C5.85724 11 5.5605 10.8771 5.34171 10.6583C5.12291 10.4395 5 10.1427 5 9.83332V2.83332C5 2.5239 5.12291 2.22716 5.34171 2.00837C5.5605 1.78957 5.85724 1.66666 6.16666 1.66666ZM6.16666 2.66666C6.12246 2.66666 6.08007 2.68422 6.04881 2.71547C6.01756 2.74673 6 2.78912 6 2.83332V9.83332C6 9.85521 6.00431 9.87688 6.01268 9.8971C6.02106 9.91732 6.03334 9.9357 6.04881 9.95117C6.06429 9.96665 6.08266 9.97893 6.10288 9.9873C6.1231 9.99568 6.14478 9.99999 6.16666 9.99999H13.1667C13.2109 9.99999 13.2533 9.98243 13.2845 9.95117C13.3158 9.91992 13.3333 9.87753 13.3333 9.83332V2.83332C13.3333 2.78912 13.3158 2.74673 13.2845 2.71547C13.2533 2.68422 13.2109 2.66666 13.1667 2.66666H6.16666ZM10 12C10 11.8674 10.0527 11.7402 10.1464 11.6464C10.2402 11.5527 10.3674 11.5 10.5 11.5C10.6326 11.5 10.7598 11.5527 10.8536 11.6464C10.9473 11.7402 11 11.8674 11 12V13.1667C11 13.4761 10.8771 13.7728 10.6583 13.9916C10.4395 14.2104 10.1427 14.3333 9.83333 14.3333H2.83333C2.52391 14.3333 2.22717 14.2104 2.00837 13.9916C1.78958 13.7728 1.66666 13.4761 1.66666 13.1667V6.16666C1.66666 5.85724 1.78958 5.56049 2.00837 5.3417C2.22717 5.12291 2.52391 4.99999 2.83333 4.99999H4C4.13261 4.99999 4.25978 5.05267 4.35355 5.14644C4.44732 5.2402 4.5 5.36738 4.5 5.49999C4.5 5.6326 4.44732 5.75978 4.35355 5.85354C4.25978 5.94731 4.13261 5.99999 4 5.99999H2.83333C2.78913 5.99999 2.74674 6.01755 2.71548 6.04881C2.68422 6.08006 2.66666 6.12245 2.66666 6.16666V13.1667C2.66666 13.2109 2.68422 13.2533 2.71548 13.2845C2.74674 13.3158 2.78913 13.3333 2.83333 13.3333H9.83333C9.87753 13.3333 9.91993 13.3158 9.95118 13.2845C9.98244 13.2533 10 13.2109 10 13.1667V12Z"
|
|
1680
|
+
/>
|
|
1681
|
+
</g>
|
|
1682
|
+
<defs>
|
|
1683
|
+
<clipPath id="clip0_518_8403">
|
|
1684
|
+
<rect width="16" height="16" />
|
|
1685
|
+
</clipPath>
|
|
1686
|
+
</defs>
|
|
1687
|
+
</svg>
|
|
1688
|
+
</span>
|
|
1689
|
+
<span class='${styles.icon} copy_success_flag'>
|
|
1690
|
+
<svg
|
|
1691
|
+
width="1em"
|
|
1692
|
+
height="1em"
|
|
1693
|
+
shape-rendering="geometricPrecision"
|
|
1694
|
+
fill="currentColor"
|
|
1695
|
+
viewBox="0 0 12 7"
|
|
1696
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1697
|
+
>
|
|
1698
|
+
<path d="M11.2242 0.375687C11.4586 0.610002 11.4586 0.989901 11.2242 1.22422L4.82424 7.62422C4.58992 7.85853 4.21003 7.85853 3.97571 7.62422L0.775712 4.42422C0.541397 4.1899 0.541397 3.81 0.775712 3.57569C1.01003 3.34137 1.38993 3.34137 1.62424 3.57569L4.39998 6.35142L10.3757 0.375687C10.61 0.141373 10.9899 0.141373 11.2242 0.375687Z" />
|
|
1699
|
+
</svg>
|
|
1700
|
+
</span><span class="copyCode">复制代码</span></p><pre`;
|
|
1701
|
+
return text;
|
|
1702
|
+
});
|
|
1563
1703
|
if (item.sender == mid) {
|
|
1564
1704
|
//只有引用和复制功能
|
|
1565
1705
|
li = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
@@ -1590,7 +1730,8 @@ const CustomerService = (props)=>{
|
|
|
1590
1730
|
onClick: ()=>{
|
|
1591
1731
|
setCitationContent({
|
|
1592
1732
|
content: item.message,
|
|
1593
|
-
id: item.id
|
|
1733
|
+
id: item.id,
|
|
1734
|
+
imageUrl: item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" ? JSON.parse(item.extraInfo)[0].value : ''
|
|
1594
1735
|
});
|
|
1595
1736
|
resettingBottomHei();
|
|
1596
1737
|
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
@@ -1622,14 +1763,33 @@ const CustomerService = (props)=>{
|
|
|
1622
1763
|
]
|
|
1623
1764
|
})
|
|
1624
1765
|
}),
|
|
1625
|
-
/*#__PURE__*/
|
|
1766
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
1626
1767
|
className: styles.content,
|
|
1627
|
-
children:
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1768
|
+
children: [
|
|
1769
|
+
/*#__PURE__*/ _jsx("p", {
|
|
1770
|
+
dangerouslySetInnerHTML: {
|
|
1771
|
+
__html: message
|
|
1772
|
+
},
|
|
1773
|
+
className: styles.content_child
|
|
1774
|
+
}),
|
|
1775
|
+
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
1776
|
+
className: styles.img_con,
|
|
1777
|
+
children: [
|
|
1778
|
+
/*#__PURE__*/ _jsx("img", {
|
|
1779
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
1780
|
+
}),
|
|
1781
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1782
|
+
className: styles.mask_zoom,
|
|
1783
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
1784
|
+
onClick: ()=>{
|
|
1785
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
1786
|
+
setVisible(true);
|
|
1787
|
+
}
|
|
1788
|
+
})
|
|
1789
|
+
})
|
|
1790
|
+
]
|
|
1791
|
+
})
|
|
1792
|
+
]
|
|
1633
1793
|
})
|
|
1634
1794
|
]
|
|
1635
1795
|
}),
|
|
@@ -1727,6 +1887,23 @@ const CustomerService = (props)=>{
|
|
|
1727
1887
|
},
|
|
1728
1888
|
className: styles.content_child
|
|
1729
1889
|
}),
|
|
1890
|
+
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
1891
|
+
className: styles.img_con,
|
|
1892
|
+
children: [
|
|
1893
|
+
/*#__PURE__*/ _jsx("img", {
|
|
1894
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
1895
|
+
}),
|
|
1896
|
+
/*#__PURE__*/ _jsx("div", {
|
|
1897
|
+
className: styles.mask_zoom,
|
|
1898
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
1899
|
+
onClick: ()=>{
|
|
1900
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
1901
|
+
setVisible(true);
|
|
1902
|
+
}
|
|
1903
|
+
})
|
|
1904
|
+
})
|
|
1905
|
+
]
|
|
1906
|
+
}),
|
|
1730
1907
|
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", {
|
|
1731
1908
|
className: styles.association_problem,
|
|
1732
1909
|
children: JSON.parse(item.extraInfo).map((list, index)=>{
|
|
@@ -1741,6 +1918,25 @@ const CustomerService = (props)=>{
|
|
|
1741
1918
|
]
|
|
1742
1919
|
}, i + "_" + index + "_" + list.value);
|
|
1743
1920
|
})
|
|
1921
|
+
}),
|
|
1922
|
+
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1923
|
+
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1924
|
+
//召唤老师回答按钮
|
|
1925
|
+
isAiChatWindow && item.findTeacher && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("div", {
|
|
1926
|
+
className: `${styles.operate_modal_bottom} `,
|
|
1927
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
1928
|
+
className: styles.stop_findTeacher,
|
|
1929
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
1930
|
+
onClick: ()=>{
|
|
1931
|
+
setAnswerMode(-1);
|
|
1932
|
+
setTeacherList([]);
|
|
1933
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
1934
|
+
return historyMessageList.filter((item)=>item.id != "-1");
|
|
1935
|
+
});
|
|
1936
|
+
},
|
|
1937
|
+
children: "停止召唤老师"
|
|
1938
|
+
})
|
|
1939
|
+
})
|
|
1744
1940
|
})
|
|
1745
1941
|
]
|
|
1746
1942
|
})
|
|
@@ -1763,26 +1959,7 @@ const CustomerService = (props)=>{
|
|
|
1763
1959
|
}) : /*#__PURE__*/ _jsx("p", {
|
|
1764
1960
|
children: item.quotedMessage
|
|
1765
1961
|
})
|
|
1766
|
-
})
|
|
1767
|
-
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1768
|
-
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1769
|
-
//召唤老师回答按钮
|
|
1770
|
-
isAiChatWindow && item.findTeacher && userData.modules.some((item)=>item.short == "TeacherAnswer") ? /*#__PURE__*/ _jsx("div", {
|
|
1771
|
-
className: `${styles.operate_modal_bottom} `,
|
|
1772
|
-
children: /*#__PURE__*/ _jsx("p", {
|
|
1773
|
-
className: styles.stop_findTeacher,
|
|
1774
|
-
children: /*#__PURE__*/ _jsx("span", {
|
|
1775
|
-
onClick: ()=>{
|
|
1776
|
-
setAnswerMode(-1);
|
|
1777
|
-
setTeacherList([]);
|
|
1778
|
-
setHistoryMessageList((historyMessageList)=>{
|
|
1779
|
-
return historyMessageList.filter((item)=>item.id != "-1");
|
|
1780
|
-
});
|
|
1781
|
-
},
|
|
1782
|
-
children: "停止召唤老师"
|
|
1783
|
-
})
|
|
1784
|
-
})
|
|
1785
|
-
}) : ""
|
|
1962
|
+
})
|
|
1786
1963
|
]
|
|
1787
1964
|
})
|
|
1788
1965
|
})
|
|
@@ -1803,14 +1980,15 @@ const CustomerService = (props)=>{
|
|
|
1803
1980
|
//问候语及点赞下面不需要展示相关按钮
|
|
1804
1981
|
let extraInfo = item.extraInfo;
|
|
1805
1982
|
//JSON.parse(extraInfo)[0].key == 'questionId' 是联想问题
|
|
1806
|
-
if (extraInfo
|
|
1983
|
+
if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
|
|
1807
1984
|
return "";
|
|
1808
1985
|
}
|
|
1986
|
+
// console.log(historyMessageList,i,'sdcsd;sldcscsdsd')
|
|
1809
1987
|
return /*#__PURE__*/ _jsxs("p", {
|
|
1810
1988
|
className: styles.operate,
|
|
1811
1989
|
children: [
|
|
1812
1990
|
// 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
|
|
1813
|
-
isAiChatWindow && answerMode != 1 && userData.modules.some((item)=>item.short == "TeacherAnswer") && /*#__PURE__*/ _jsx("span", {
|
|
1991
|
+
isAiChatWindow && answerMode != 1 && userData.modules.some((item)=>item.short == "TeacherAnswer") && historyMessageList[i - 1].extraInfo && JSON.parse(historyMessageList[i - 1].extraInfo).length > 0 && JSON.parse(historyMessageList[i - 1].extraInfo)[0].key != "imageUrl" && /*#__PURE__*/ _jsx("span", {
|
|
1814
1992
|
className: styles.ask_question,
|
|
1815
1993
|
onClick: ()=>{
|
|
1816
1994
|
setAnswerMode(1);
|
|
@@ -1953,7 +2131,7 @@ const CustomerService = (props)=>{
|
|
|
1953
2131
|
}
|
|
1954
2132
|
//3、是否显示召唤老师回答按钮
|
|
1955
2133
|
let findTeacherBtn = false;
|
|
1956
|
-
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
|
|
2134
|
+
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null) && historyMessageList[i - 1].extraInfo && JSON.parse(historyMessageList[i - 1].extraInfo).length > 0 && JSON.parse(historyMessageList[i - 1].extraInfo)[0].key != "imageUrl") {
|
|
1957
2135
|
findTeacherBtn = true;
|
|
1958
2136
|
}
|
|
1959
2137
|
return /*#__PURE__*/ _jsxs("div", {
|
|
@@ -2147,16 +2325,46 @@ const CustomerService = (props)=>{
|
|
|
2147
2325
|
]
|
|
2148
2326
|
});
|
|
2149
2327
|
};
|
|
2328
|
+
//保存粘贴的图片
|
|
2329
|
+
const handleFilePaste = (e)=>{
|
|
2330
|
+
e.preventDefault();
|
|
2331
|
+
const items = e.clipboardData.items;
|
|
2332
|
+
// console.log(e,items,3333333)
|
|
2333
|
+
for(let i = 0; i < items.length; i++){
|
|
2334
|
+
const item = items[i];
|
|
2335
|
+
if (item.kind === 'file') {
|
|
2336
|
+
const file = item.getAsFile();
|
|
2337
|
+
if (file && file.type.startsWith('image/')) {
|
|
2338
|
+
// 处理粘贴的图片文件
|
|
2339
|
+
// 创建FileReader对象
|
|
2340
|
+
const reader = new FileReader();
|
|
2341
|
+
// 文件读取成功后执行的回调函数
|
|
2342
|
+
reader.onload = function(event) {
|
|
2343
|
+
// 获取Base64编码的字符串
|
|
2344
|
+
let base64String = event.target.result;
|
|
2345
|
+
setScreenshotBese64(base64String);
|
|
2346
|
+
};
|
|
2347
|
+
// 以Base64格式读取文件
|
|
2348
|
+
reader.readAsDataURL(file);
|
|
2349
|
+
}
|
|
2350
|
+
} else {
|
|
2351
|
+
const clipboardData = e.clipboardData || window.clipboardData;
|
|
2352
|
+
const pastedText = clipboardData.getData('text');
|
|
2353
|
+
let con = keyWord + pastedText;
|
|
2354
|
+
setKeyWord(con);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2150
2358
|
//渲染底部按钮
|
|
2151
2359
|
const renderBottomAnt = ()=>{
|
|
2152
2360
|
let placeholder = "";
|
|
2153
2361
|
let disabled = false;
|
|
2154
|
-
if (
|
|
2155
|
-
placeholder = "正在录制语音,再次点击麦克风结束录制。";
|
|
2156
|
-
} else if (voiceRecordingStatus == 1) {
|
|
2157
|
-
placeholder = "正在语音识别文字,请稍后...";
|
|
2158
|
-
} else if (!finished) {
|
|
2362
|
+
if (!finished) {
|
|
2159
2363
|
placeholder = "答案生成中,请稍后再发送...";
|
|
2364
|
+
}
|
|
2365
|
+
if (screenshotBese64) {
|
|
2366
|
+
placeholder = '在发送之前,请输入需要对这个图片做的操作...';
|
|
2367
|
+
disabled = true;
|
|
2160
2368
|
} else {
|
|
2161
2369
|
placeholder = "请输入问题,按Enter发送,Shift+Enter换行";
|
|
2162
2370
|
disabled = true;
|
|
@@ -2171,7 +2379,114 @@ const CustomerService = (props)=>{
|
|
|
2171
2379
|
children: [
|
|
2172
2380
|
/*#__PURE__*/ _jsxs("div", {
|
|
2173
2381
|
className: `${styles.input} ${userData.modules.some((item)=>item.short == "AIservice") ? "" : styles.no_AI}`,
|
|
2382
|
+
onPaste: handleFilePaste,
|
|
2174
2383
|
children: [
|
|
2384
|
+
screenshotBese64 && /*#__PURE__*/ _jsxs("div", {
|
|
2385
|
+
className: styles.picture_layout,
|
|
2386
|
+
children: [
|
|
2387
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
2388
|
+
className: styles.left,
|
|
2389
|
+
children: [
|
|
2390
|
+
/*#__PURE__*/ _jsx("img", {
|
|
2391
|
+
src: screenshotBese64
|
|
2392
|
+
}),
|
|
2393
|
+
/*#__PURE__*/ _jsx("span", {
|
|
2394
|
+
className: styles.icon_close,
|
|
2395
|
+
onClick: ()=>{
|
|
2396
|
+
setScreenshotBese64('');
|
|
2397
|
+
},
|
|
2398
|
+
children: /*#__PURE__*/ _jsx(CustomRoundClose, {})
|
|
2399
|
+
}),
|
|
2400
|
+
/*#__PURE__*/ _jsx("div", {
|
|
2401
|
+
className: styles.icon_zoom,
|
|
2402
|
+
onClick: ()=>{
|
|
2403
|
+
setViewBase64(screenshotBese64), setVisible(true);
|
|
2404
|
+
},
|
|
2405
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {})
|
|
2406
|
+
})
|
|
2407
|
+
]
|
|
2408
|
+
}),
|
|
2409
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
2410
|
+
className: styles.right,
|
|
2411
|
+
children: [
|
|
2412
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
2413
|
+
onClick: ()=>{
|
|
2414
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
2415
|
+
let newHistoryMessageList = historyMessageList.concat({
|
|
2416
|
+
id: -1,
|
|
2417
|
+
roomId: roomId,
|
|
2418
|
+
sender: mid,
|
|
2419
|
+
recevier: 'AI',
|
|
2420
|
+
message: "讲解这张图片涉及到的知识内容",
|
|
2421
|
+
createdAt: getDataTime(-1),
|
|
2422
|
+
extraInfo: JSON.stringify([
|
|
2423
|
+
{
|
|
2424
|
+
key: "imageUrl",
|
|
2425
|
+
value: screenshotBese64
|
|
2426
|
+
}
|
|
2427
|
+
])
|
|
2428
|
+
});
|
|
2429
|
+
return newHistoryMessageList;
|
|
2430
|
+
});
|
|
2431
|
+
scrollToBottom();
|
|
2432
|
+
aiSendQuestions(3, {
|
|
2433
|
+
//相关数据
|
|
2434
|
+
roomId: roomId,
|
|
2435
|
+
message: '讲解这张图片涉及到的知识内容',
|
|
2436
|
+
image: screenshotBese64,
|
|
2437
|
+
quotedMessage: citationContent.content || "",
|
|
2438
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
2439
|
+
generateUpvoteOrDownvoteMessage: false
|
|
2440
|
+
}, 1);
|
|
2441
|
+
setScreenshotBese64('');
|
|
2442
|
+
resettingBottomHei();
|
|
2443
|
+
},
|
|
2444
|
+
children: [
|
|
2445
|
+
/*#__PURE__*/ _jsx(CustomKnowledgeContent, {}),
|
|
2446
|
+
"讲解这张图片涉及到的知识内容"
|
|
2447
|
+
]
|
|
2448
|
+
}),
|
|
2449
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
2450
|
+
onClick: ()=>{
|
|
2451
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
2452
|
+
let newHistoryMessageList = historyMessageList.concat({
|
|
2453
|
+
id: -1,
|
|
2454
|
+
roomId: roomId,
|
|
2455
|
+
sender: mid,
|
|
2456
|
+
recevier: 'AI',
|
|
2457
|
+
message: "帮助我更深入地理解图片中的概念",
|
|
2458
|
+
createdAt: getDataTime(-1),
|
|
2459
|
+
extraInfo: JSON.stringify([
|
|
2460
|
+
{
|
|
2461
|
+
key: "imageUrl",
|
|
2462
|
+
value: screenshotBese64
|
|
2463
|
+
}
|
|
2464
|
+
])
|
|
2465
|
+
});
|
|
2466
|
+
return newHistoryMessageList;
|
|
2467
|
+
});
|
|
2468
|
+
scrollToBottom();
|
|
2469
|
+
aiSendQuestions(3, {
|
|
2470
|
+
//相关数据
|
|
2471
|
+
roomId: roomId,
|
|
2472
|
+
message: '帮助我更深入地理解图片中的概念',
|
|
2473
|
+
image: screenshotBese64,
|
|
2474
|
+
quotedMessage: citationContent.content || "",
|
|
2475
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
2476
|
+
generateUpvoteOrDownvoteMessage: false
|
|
2477
|
+
}, 1);
|
|
2478
|
+
setScreenshotBese64('');
|
|
2479
|
+
resettingBottomHei();
|
|
2480
|
+
},
|
|
2481
|
+
children: [
|
|
2482
|
+
/*#__PURE__*/ _jsx(CustomWenhaoRound, {}),
|
|
2483
|
+
"帮助我更深入地理解图片中的概念"
|
|
2484
|
+
]
|
|
2485
|
+
})
|
|
2486
|
+
]
|
|
2487
|
+
})
|
|
2488
|
+
]
|
|
2489
|
+
}),
|
|
2175
2490
|
/*#__PURE__*/ _jsx(TextArea, {
|
|
2176
2491
|
placeholder: placeholder,
|
|
2177
2492
|
autoSize: {
|
|
@@ -2193,7 +2508,12 @@ const CustomerService = (props)=>{
|
|
|
2193
2508
|
} else {
|
|
2194
2509
|
let roomList = contactsList;
|
|
2195
2510
|
if (roomList.length > 0 && roomList[0].roomId != roomId) return;
|
|
2196
|
-
|
|
2511
|
+
console.log(props, 333333);
|
|
2512
|
+
if (props.config && props.config.type == 'video') {
|
|
2513
|
+
getQuestiionsList(String(e.target.value), 3);
|
|
2514
|
+
} else {
|
|
2515
|
+
getQuestiionsList(String(e.target.value), 2);
|
|
2516
|
+
}
|
|
2197
2517
|
}
|
|
2198
2518
|
}, 1000);
|
|
2199
2519
|
}
|
|
@@ -2246,15 +2566,18 @@ const CustomerService = (props)=>{
|
|
|
2246
2566
|
onEvent(serverName + serverUrl(), "click_智能问答_输入框", "提交");
|
|
2247
2567
|
},
|
|
2248
2568
|
disabled: !disabled,
|
|
2249
|
-
maxLength: 1000
|
|
2569
|
+
maxLength: 1000,
|
|
2570
|
+
id: "con_textarea"
|
|
2250
2571
|
}),
|
|
2251
|
-
citationContent.content
|
|
2572
|
+
citationContent.content && /*#__PURE__*/ _jsxs("div", {
|
|
2252
2573
|
className: styles.content_main,
|
|
2253
2574
|
children: [
|
|
2254
2575
|
/*#__PURE__*/ _jsx("div", {
|
|
2255
2576
|
className: styles.content_con,
|
|
2256
2577
|
children: /*#__PURE__*/ _jsx("p", {
|
|
2257
|
-
children:
|
|
2578
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
2579
|
+
children: citationContent.content
|
|
2580
|
+
})
|
|
2258
2581
|
})
|
|
2259
2582
|
}),
|
|
2260
2583
|
/*#__PURE__*/ _jsx("i", {
|
|
@@ -2266,43 +2589,19 @@ const CustomerService = (props)=>{
|
|
|
2266
2589
|
children: /*#__PURE__*/ _jsx(CustomRoundClose, {})
|
|
2267
2590
|
})
|
|
2268
2591
|
]
|
|
2269
|
-
})
|
|
2592
|
+
})
|
|
2270
2593
|
]
|
|
2271
2594
|
}),
|
|
2272
|
-
userData.modules.some((item)=>item.short == "AIservice")
|
|
2273
|
-
className: styles.
|
|
2274
|
-
children:
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
setKeyWord("");
|
|
2283
|
-
voiceCountdownTimer.current = setTimeout(()=>{
|
|
2284
|
-
stopRecord();
|
|
2285
|
-
setVoiceRecordingStatus(1);
|
|
2286
|
-
}, 120000);
|
|
2287
|
-
onEvent(serverName + serverUrl(), "click_智能问答_ 麦克风", "提交");
|
|
2288
|
-
},
|
|
2289
|
-
children: /*#__PURE__*/ _jsx(CustomSoundRecording, {})
|
|
2290
|
-
}) : "",
|
|
2291
|
-
voiceRecordingStatus == 2 ? /*#__PURE__*/ _jsx("img", {
|
|
2292
|
-
// src={Voice_btn}
|
|
2293
|
-
src: "/new_yun/images/aiService/voice_btn.gif",
|
|
2294
|
-
className: styles.voice_btn,
|
|
2295
|
-
onClick: ()=>{
|
|
2296
|
-
//结束录音
|
|
2297
|
-
// console.log(mediaRecorder,'3333333');
|
|
2298
|
-
// mediaRecorder.stop();
|
|
2299
|
-
stopRecord();
|
|
2300
|
-
setVoiceRecordingStatus(1);
|
|
2301
|
-
clearTimeout(voiceCountdownTimer.current);
|
|
2302
|
-
}
|
|
2303
|
-
}) : ""
|
|
2304
|
-
]
|
|
2305
|
-
}) : ""
|
|
2595
|
+
userData.modules.some((item)=>item.short == "AIservice") && contactsList.length > 0 && contactsList[0].roomId == roomId && /*#__PURE__*/ _jsx("p", {
|
|
2596
|
+
className: styles.screenshot,
|
|
2597
|
+
children: /*#__PURE__*/ _jsx("i", {
|
|
2598
|
+
className: `${!disabled ? styles.disabled : ""}`,
|
|
2599
|
+
onClick: ()=>{
|
|
2600
|
+
setShowType(5);
|
|
2601
|
+
},
|
|
2602
|
+
children: /*#__PURE__*/ _jsx(CustomScreenshot, {})
|
|
2603
|
+
})
|
|
2604
|
+
})
|
|
2306
2605
|
]
|
|
2307
2606
|
}),
|
|
2308
2607
|
/*#__PURE__*/ _jsx("p", {
|
|
@@ -2420,7 +2719,8 @@ const CustomerService = (props)=>{
|
|
|
2420
2719
|
style: {
|
|
2421
2720
|
bottom: `${buttomHei + 6}px`
|
|
2422
2721
|
},
|
|
2423
|
-
children: questionsList.map((item)=>{
|
|
2722
|
+
children: questionsList.map((item, i)=>{
|
|
2723
|
+
if (i > 4) return '';
|
|
2424
2724
|
let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2425
2725
|
let span = '';
|
|
2426
2726
|
//搜索内容是否有特殊字符
|
|
@@ -2451,6 +2751,23 @@ const CustomerService = (props)=>{
|
|
|
2451
2751
|
});
|
|
2452
2752
|
}
|
|
2453
2753
|
};
|
|
2754
|
+
const renderBottomAssociationProblem = ()=>{
|
|
2755
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
2756
|
+
className: styles.issues_list_flag,
|
|
2757
|
+
style: {
|
|
2758
|
+
bottom: `${buttomHei}px`
|
|
2759
|
+
},
|
|
2760
|
+
id: "BottomAssociationProblem",
|
|
2761
|
+
children: bottomRecommendationQuestions.map((item)=>{
|
|
2762
|
+
return /*#__PURE__*/ _jsx("p", {
|
|
2763
|
+
onClick: ()=>{
|
|
2764
|
+
sendMessage(item, 1);
|
|
2765
|
+
},
|
|
2766
|
+
children: item.question
|
|
2767
|
+
}, item.id);
|
|
2768
|
+
})
|
|
2769
|
+
});
|
|
2770
|
+
};
|
|
2454
2771
|
//加载指定数据,点击历史记录
|
|
2455
2772
|
const loadSpecifiedData = (renewRoomId, page, id, receiver, keyWordProblem)=>{
|
|
2456
2773
|
// let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
|
|
@@ -2491,7 +2808,6 @@ const CustomerService = (props)=>{
|
|
|
2491
2808
|
open: showType == 1 ? true : false,
|
|
2492
2809
|
className: styles.ChatWindow_Drawer,
|
|
2493
2810
|
mask: false,
|
|
2494
|
-
// maskClosable={false}
|
|
2495
2811
|
rootClassName: styles.service_ChatWindow_Drawer,
|
|
2496
2812
|
children: [
|
|
2497
2813
|
showType == 1 && /*#__PURE__*/ _jsx("div", {
|
|
@@ -2548,6 +2864,7 @@ const CustomerService = (props)=>{
|
|
|
2548
2864
|
className: styles.Drawer_buttom_Issues_List,
|
|
2549
2865
|
children: [
|
|
2550
2866
|
renderAssociationProblem(),
|
|
2867
|
+
renderBottomAssociationProblem(),
|
|
2551
2868
|
/*#__PURE__*/ _jsx("div", {
|
|
2552
2869
|
className: styles.Drawer_buttom,
|
|
2553
2870
|
id: "Drawer_buttom",
|
|
@@ -2955,6 +3272,26 @@ const CustomerService = (props)=>{
|
|
|
2955
3272
|
]
|
|
2956
3273
|
})
|
|
2957
3274
|
]
|
|
3275
|
+
}),
|
|
3276
|
+
showType == 5 && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
|
|
3277
|
+
imgBese64: imgBese64,
|
|
3278
|
+
saveScreenshotBese64: (base64)=>{
|
|
3279
|
+
setScreenshotBese64(base64);
|
|
3280
|
+
setShowType(1);
|
|
3281
|
+
},
|
|
3282
|
+
cancelScreenshot: ()=>{
|
|
3283
|
+
setShowType(1);
|
|
3284
|
+
}
|
|
3285
|
+
}),
|
|
3286
|
+
viewBase64 && visible && /*#__PURE__*/ _jsx(ViewImage, {
|
|
3287
|
+
visible: visible,
|
|
3288
|
+
onCancel: ()=>setVisible(false),
|
|
3289
|
+
className: "",
|
|
3290
|
+
getSrc: ()=>{
|
|
3291
|
+
return new Promise((resolve)=>{
|
|
3292
|
+
resolve(viewBase64);
|
|
3293
|
+
});
|
|
3294
|
+
}
|
|
2958
3295
|
})
|
|
2959
3296
|
]
|
|
2960
3297
|
});
|