bhd-components 0.7.8 → 0.7.10
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/a23d0ed7.esm.es5.production.js +468 -0
- package/dist/{bd8fe330.esm.es5.development.js → e7af2e4a.esm.es5.development.js} +177 -7973
- package/dist/index.esm.es5.development.css +2050 -1914
- package/dist/index.esm.es5.development.js +216 -109
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/html2canvas.test.js +8580 -0
- package/es2017/customerService/index.d.ts +2 -0
- package/es2017/customerService/index.js +211 -104
- package/es2017/customerService/index.module.less +32 -1
- package/es2017/customerService/index2.module.less +48 -4
- package/esm/customerService/html2canvas.test.js +8581 -0
- package/esm/customerService/index.d.ts +2 -0
- package/esm/customerService/index.js +215 -107
- package/esm/customerService/index.module.less +32 -1
- package/esm/customerService/index2.module.less +48 -4
- package/package.json +1 -1
- package/dist/989240e2.esm.es5.production.js +0 -485
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "highlight.js/styles/default.css";
|
|
3
|
+
import './html2canvas.test.js';
|
|
3
4
|
interface Service {
|
|
4
5
|
type: string;
|
|
5
6
|
params: any;
|
|
@@ -14,6 +15,7 @@ interface Service {
|
|
|
14
15
|
stepId?: string | number;
|
|
15
16
|
onEvent: (a: string, b: string, c: string) => {};
|
|
16
17
|
config: any;
|
|
18
|
+
screenshotAreaId: string;
|
|
17
19
|
}
|
|
18
20
|
declare const CustomerService: (props: Service) => JSX.Element;
|
|
19
21
|
export default CustomerService;
|
|
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runt
|
|
|
6
6
|
import React, { useEffect, useState, useRef } from "react";
|
|
7
7
|
import { Modal, Drawer, Input, Tooltip } from "antd";
|
|
8
8
|
import { ViewImage } from "bhd-components";
|
|
9
|
-
import html2canvas from "html2canvas";
|
|
9
|
+
// import html2canvas from "html2canvas";
|
|
10
10
|
import cssStyle from "./index.module.less";
|
|
11
11
|
import cssStyleOnline from "./index2.module.less";
|
|
12
12
|
var styles = cssStyle;
|
|
@@ -25,11 +25,12 @@ import "highlight.js/styles/default.css";
|
|
|
25
25
|
import { render } from "react-dom";
|
|
26
26
|
import Provider from "../provider";
|
|
27
27
|
var TextArea = Input.TextArea;
|
|
28
|
+
import "./html2canvas.test.js";
|
|
28
29
|
import knowledge_icon from "./images/knowledge_icon.png";
|
|
29
30
|
// import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
30
31
|
import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
|
|
31
32
|
var CustomerService = function(props) {
|
|
32
|
-
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, config = props.config;
|
|
33
|
+
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, screenshotAreaId = props.screenshotAreaId, config = props.config;
|
|
33
34
|
// const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
|
|
34
35
|
// const [voiceRecordingStatus, setVoiceRecordingStatus] = useState(3); //语音录制状态 3,语音识别完成 2,录制中, 1,录制结束
|
|
35
36
|
var _useState = _sliced_to_array(useState([]), 2), copyTextOBJ = _useState[0], setCopyTextObj = _useState[1]; //复制的消息id
|
|
@@ -39,6 +40,7 @@ var CustomerService = function(props) {
|
|
|
39
40
|
var _useState4 = _sliced_to_array(useState(""), 2), keyWord = _useState4[0], setKeyWord = _useState4[1]; //搜索内容
|
|
40
41
|
var _useState5 = _sliced_to_array(useState([]), 2), questionsList = _useState5[0], setQuestionsList = _useState5[1]; //问题列表
|
|
41
42
|
var _useState6 = _sliced_to_array(useState([]), 2), hotQuestionsList = _useState6[0], setHotQuestionsList = _useState6[1]; //热门问题
|
|
43
|
+
// const [videoHotQuestionsList, setVideoHotQuestionsList] = useState([]); //热门问题
|
|
42
44
|
var _useState7 = _sliced_to_array(useState(false), 2), greetingMessage = _useState7[0], setGreetingMessage = _useState7[1]; //聊天记录列表是否请求完成
|
|
43
45
|
var _useState8 = _sliced_to_array(useState(1), 2), pageNum = _useState8[0], setPageNum = _useState8[1]; //页码
|
|
44
46
|
var _useState9 = _sliced_to_array(useState(0), 2), pageNumHistory = _useState9[0], setPageNumHistory = _useState9[1]; //用于搜索历史记录后的页码
|
|
@@ -76,6 +78,7 @@ var CustomerService = function(props) {
|
|
|
76
78
|
var scrollTopHei = useRef(0);
|
|
77
79
|
var isPosition = useRef(true);
|
|
78
80
|
var recommendeQuestionID = useRef([]); //推荐问题id
|
|
81
|
+
var videoHotQuestionsList = useRef([]); //视频热门问题
|
|
79
82
|
var mid = props.userData.mid;
|
|
80
83
|
var remarkable = new Remarkable({
|
|
81
84
|
highlight: function highlight(str, lang) {
|
|
@@ -90,6 +93,21 @@ var CustomerService = function(props) {
|
|
|
90
93
|
return ""; // use external default escaping
|
|
91
94
|
}
|
|
92
95
|
});
|
|
96
|
+
useEffect(function() {
|
|
97
|
+
// console.log(props,'lsdkcmsdlcksd')
|
|
98
|
+
// getQuestiionsList("", 1);
|
|
99
|
+
if (props.config && props.config.type == "video") {
|
|
100
|
+
//获取热门推荐
|
|
101
|
+
videoPageQuestiionsList(1);
|
|
102
|
+
// getQuestiionsList("", 3)
|
|
103
|
+
}
|
|
104
|
+
setShowType(initShowType);
|
|
105
|
+
//获取视频页面推荐问题
|
|
106
|
+
// videoPageQuestiionsList();
|
|
107
|
+
// scrollToBottom();
|
|
108
|
+
}, [
|
|
109
|
+
initShowType
|
|
110
|
+
]);
|
|
93
111
|
useEffect(function() {
|
|
94
112
|
var handleScroll = function handleScroll() {
|
|
95
113
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
@@ -138,28 +156,34 @@ var CustomerService = function(props) {
|
|
|
138
156
|
scrollTopHei.current = scrollTop;
|
|
139
157
|
};
|
|
140
158
|
if (showType == 5) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
try {
|
|
160
|
+
setImgBese64("");
|
|
161
|
+
// html2canvas(document.getElementsByTagName('html')[0],{
|
|
162
|
+
// // ignoreElements:(element)=>{
|
|
163
|
+
// // if(element.compareDocumentPosition(dom)===2)return true
|
|
164
|
+
// // return false
|
|
165
|
+
// // }
|
|
166
|
+
// }).then((canvas)=>{
|
|
167
|
+
// console.log(canvas,22222);
|
|
168
|
+
// setTimeout(()=>{
|
|
169
|
+
var dom = document.getElementById(screenshotAreaId);
|
|
170
|
+
html2canvas(dom, {
|
|
171
|
+
useCORS: true,
|
|
172
|
+
// allowTaint: true, // 污染处理
|
|
173
|
+
scale: 1
|
|
174
|
+
}).then(function(canvas) {
|
|
175
|
+
// document.body.appendChild(canvas);
|
|
176
|
+
// document.body.appendChild(canvas);
|
|
177
|
+
console.log(canvas, 99999);
|
|
178
|
+
// var base64URL = canvas.toDataURL('image/jpeg')
|
|
179
|
+
var base64URL = canvas.toDataURL("image/jpg", 1.0);
|
|
180
|
+
setImgBese64(base64URL);
|
|
181
|
+
});
|
|
182
|
+
// },100)
|
|
183
|
+
// })
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.log(error);
|
|
186
|
+
}
|
|
163
187
|
}
|
|
164
188
|
if (showType != 1 && !firstLoad && pageCount > 0) {
|
|
165
189
|
setFirstLoad(true);
|
|
@@ -197,16 +221,21 @@ var CustomerService = function(props) {
|
|
|
197
221
|
buttomHei,
|
|
198
222
|
showType
|
|
199
223
|
]);
|
|
224
|
+
//创建聊天室并获取聊天室列表
|
|
200
225
|
useEffect(function() {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
226
|
+
createRooms("AI").then(function(res) {
|
|
227
|
+
setRoomId(res.data.id);
|
|
228
|
+
});
|
|
229
|
+
roomsListTimer();
|
|
230
|
+
return function() {
|
|
231
|
+
clearTimeout(receiveMessageTimer.current);
|
|
232
|
+
// clearTimeout(voiceCountdownTimer.current);
|
|
233
|
+
clearTimeout(listTimer.current);
|
|
234
|
+
clearTimeout(timer.current);
|
|
235
|
+
clearTimeout(roomMessage.current);
|
|
236
|
+
clearTimeout(chatRoomList.current);
|
|
237
|
+
};
|
|
238
|
+
}, []);
|
|
210
239
|
useEffect(function() {
|
|
211
240
|
if (roomId != "") {
|
|
212
241
|
if (lastId == "") {
|
|
@@ -227,21 +256,6 @@ var CustomerService = function(props) {
|
|
|
227
256
|
}, [
|
|
228
257
|
roomId
|
|
229
258
|
]);
|
|
230
|
-
//创建聊天室并获取聊天室列表
|
|
231
|
-
useEffect(function() {
|
|
232
|
-
createRooms("AI").then(function(res) {
|
|
233
|
-
setRoomId(res.data.id);
|
|
234
|
-
});
|
|
235
|
-
roomsListTimer();
|
|
236
|
-
return function() {
|
|
237
|
-
clearTimeout(receiveMessageTimer.current);
|
|
238
|
-
// clearTimeout(voiceCountdownTimer.current);
|
|
239
|
-
clearTimeout(listTimer.current);
|
|
240
|
-
clearTimeout(timer.current);
|
|
241
|
-
clearTimeout(roomMessage.current);
|
|
242
|
-
clearTimeout(chatRoomList.current);
|
|
243
|
-
};
|
|
244
|
-
}, []);
|
|
245
259
|
//进入页面,发送打招呼信息
|
|
246
260
|
useEffect(function() {
|
|
247
261
|
//老师的聊天窗口不发送打招呼信息
|
|
@@ -260,9 +274,8 @@ var CustomerService = function(props) {
|
|
|
260
274
|
scrollToBottom();
|
|
261
275
|
}
|
|
262
276
|
}, [
|
|
263
|
-
greetingMessage
|
|
264
|
-
|
|
265
|
-
]);
|
|
277
|
+
greetingMessage
|
|
278
|
+
]); //hotQuestionsList
|
|
266
279
|
//查找需要复制的代码
|
|
267
280
|
var findCopyContent = function(e) {
|
|
268
281
|
var source = findParent(e.target, styles.copyCode);
|
|
@@ -305,10 +318,9 @@ var CustomerService = function(props) {
|
|
|
305
318
|
var questionsList = [];
|
|
306
319
|
var obj = {};
|
|
307
320
|
if (type == 1) {
|
|
308
|
-
|
|
321
|
+
console.log(hotQuestionsList, "33322221111");
|
|
309
322
|
questionsList = hotQuestionsList.map(function(item, index) {
|
|
310
323
|
if (index < 3) {
|
|
311
|
-
questionsId.push(item.id);
|
|
312
324
|
return {
|
|
313
325
|
key: "messageSource",
|
|
314
326
|
value: item.id,
|
|
@@ -319,7 +331,6 @@ var CustomerService = function(props) {
|
|
|
319
331
|
return null;
|
|
320
332
|
}
|
|
321
333
|
});
|
|
322
|
-
recommendeQuestionID.current = questionsId; //保存推荐问题id
|
|
323
334
|
questionsList = questionsList.filter(function(i) {
|
|
324
335
|
return i != null;
|
|
325
336
|
});
|
|
@@ -332,8 +343,11 @@ var CustomerService = function(props) {
|
|
|
332
343
|
};
|
|
333
344
|
if (pageNumHistory <= 1) {
|
|
334
345
|
setHistoryMessageList(function(historyMessageList) {
|
|
335
|
-
var newHistoryMessageList = historyMessageList.
|
|
336
|
-
|
|
346
|
+
var newHistoryMessageList = historyMessageList.filter(function(e) {
|
|
347
|
+
return e.id != "123456_date";
|
|
348
|
+
});
|
|
349
|
+
newHistoryMessageList.push(_object_spread_props(_object_spread({}, obj), {
|
|
350
|
+
id: "123456_date",
|
|
337
351
|
upvoted: false,
|
|
338
352
|
downvoted: false,
|
|
339
353
|
quotedMessage: "",
|
|
@@ -538,6 +552,40 @@ var CustomerService = function(props) {
|
|
|
538
552
|
//点击知识库的问题,或者是点击问候消息
|
|
539
553
|
if (questions.length > 0) {
|
|
540
554
|
questions = questions[0];
|
|
555
|
+
//知识库联想的问题没有答案
|
|
556
|
+
if (!questions.answer && userData.modules.some(function(item) {
|
|
557
|
+
return item.short == "AIservice";
|
|
558
|
+
})) {
|
|
559
|
+
var sendData = {
|
|
560
|
+
//相关数据
|
|
561
|
+
roomId: roomId,
|
|
562
|
+
message: questions.question,
|
|
563
|
+
quotedMessage: "",
|
|
564
|
+
regenerate: true,
|
|
565
|
+
generateUpvoteOrDownvoteMessage: false
|
|
566
|
+
};
|
|
567
|
+
if (pageNumHistory <= 1) {
|
|
568
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
569
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
570
|
+
roomId: roomId,
|
|
571
|
+
sender: mid,
|
|
572
|
+
recevier: "AI",
|
|
573
|
+
message: questions.question,
|
|
574
|
+
quotedMessage: "",
|
|
575
|
+
id: "654321",
|
|
576
|
+
upvoted: false,
|
|
577
|
+
downvoted: false,
|
|
578
|
+
createdAt: getDataTime(-1),
|
|
579
|
+
extraInfo: JSON.stringify([])
|
|
580
|
+
});
|
|
581
|
+
return newHistoryMessageList;
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
setFinished(false);
|
|
585
|
+
aiSendQuestions(3, sendData, 1);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
console.log(questions, "知识库内容11111");
|
|
541
589
|
//向知识库发送问题 type 1,发送问题 2 发送答案 obj 需要的参数
|
|
542
590
|
var obj = {
|
|
543
591
|
roomId: roomId,
|
|
@@ -563,7 +611,7 @@ var CustomerService = function(props) {
|
|
|
563
611
|
} else if (userData.modules.some(function(item) {
|
|
564
612
|
return item.short == "AIservice";
|
|
565
613
|
})) {
|
|
566
|
-
var
|
|
614
|
+
var sendData1 = {
|
|
567
615
|
//相关数据
|
|
568
616
|
roomId: roomId,
|
|
569
617
|
message: keyWord,
|
|
@@ -572,16 +620,8 @@ var CustomerService = function(props) {
|
|
|
572
620
|
generateUpvoteOrDownvoteMessage: false
|
|
573
621
|
};
|
|
574
622
|
var imageUrl = "";
|
|
575
|
-
// if(citationContent.imageUrl){
|
|
576
|
-
// sendData.image = citationContent.imageUrl;
|
|
577
|
-
// imageUrl = citationContent.imageUrl;
|
|
578
|
-
// getBase64Image(citationContent.imageUrl).then((res)=>{
|
|
579
|
-
// console.log(res,33333);
|
|
580
|
-
// });
|
|
581
|
-
// console.log(imageUrl,'转换的bese64');
|
|
582
|
-
// }
|
|
583
623
|
if (screenshotBese64) {
|
|
584
|
-
|
|
624
|
+
sendData1.image = screenshotBese64;
|
|
585
625
|
imageUrl = screenshotBese64;
|
|
586
626
|
}
|
|
587
627
|
if (pageNumHistory <= 1) {
|
|
@@ -607,7 +647,7 @@ var CustomerService = function(props) {
|
|
|
607
647
|
});
|
|
608
648
|
}
|
|
609
649
|
setFinished(false);
|
|
610
|
-
aiSendQuestions(3,
|
|
650
|
+
aiSendQuestions(3, sendData1, 1);
|
|
611
651
|
setScreenshotBese64("");
|
|
612
652
|
//存在AI客服
|
|
613
653
|
} else {
|
|
@@ -632,9 +672,9 @@ var CustomerService = function(props) {
|
|
|
632
672
|
}
|
|
633
673
|
console.log(type, "接受答案77777");
|
|
634
674
|
//获取下面的推荐问题
|
|
635
|
-
if
|
|
636
|
-
|
|
637
|
-
}
|
|
675
|
+
// if(type == 2){
|
|
676
|
+
// videoPageQuestiionsList(2);
|
|
677
|
+
// }
|
|
638
678
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
639
679
|
if (res.data.id) {
|
|
640
680
|
if (pageNumHistory <= 1) {
|
|
@@ -698,6 +738,23 @@ var CustomerService = function(props) {
|
|
|
698
738
|
});
|
|
699
739
|
});
|
|
700
740
|
}, 60 * 1000);
|
|
741
|
+
if (props.config && props.config.type == "video" && props.config.params) {
|
|
742
|
+
var params = props.config.params;
|
|
743
|
+
var videoId = params.videoId;
|
|
744
|
+
var watchTime = params.videoProgress;
|
|
745
|
+
var courseId = getQuery("yc_id");
|
|
746
|
+
var sectionId = params.VideoBriefSummaryId;
|
|
747
|
+
obj.contexts = [
|
|
748
|
+
{
|
|
749
|
+
"type": "VIDEO",
|
|
750
|
+
"courseId": courseId,
|
|
751
|
+
"sectionId": sectionId,
|
|
752
|
+
"videoId": videoId,
|
|
753
|
+
"watchTime": watchTime
|
|
754
|
+
}
|
|
755
|
+
];
|
|
756
|
+
obj.regenerate = false;
|
|
757
|
+
}
|
|
701
758
|
var data = JSON.stringify(obj);
|
|
702
759
|
setKeyWord("");
|
|
703
760
|
setQuestionsList([]);
|
|
@@ -737,6 +794,10 @@ var CustomerService = function(props) {
|
|
|
737
794
|
});
|
|
738
795
|
scrollToBottom();
|
|
739
796
|
}
|
|
797
|
+
if (props.config && props.config.type == "video") {
|
|
798
|
+
//先请求问题列表
|
|
799
|
+
videoPageQuestiionsList(3);
|
|
800
|
+
}
|
|
740
801
|
//使用fetchEventSource接收数据
|
|
741
802
|
var eventSource = fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
742
803
|
method: "POST",
|
|
@@ -909,9 +970,23 @@ var CustomerService = function(props) {
|
|
|
909
970
|
} else {
|
|
910
971
|
var newHistoryMessageList2 = list1.map(function(item) {
|
|
911
972
|
message = item.message + obj.message;
|
|
973
|
+
var extraInfo = [];
|
|
974
|
+
// message = '抱歉,我暂时无法回答这样的问题。'
|
|
975
|
+
if (message == "抱歉,我暂时无法回答这样的问题。") {
|
|
976
|
+
extraInfo = videoHotQuestionsList.current.map(function(str, index) {
|
|
977
|
+
return {
|
|
978
|
+
key: "messageSource",
|
|
979
|
+
value: str.id,
|
|
980
|
+
question: str.question,
|
|
981
|
+
answer: str.answer,
|
|
982
|
+
welcomeMessage: true
|
|
983
|
+
};
|
|
984
|
+
});
|
|
985
|
+
}
|
|
912
986
|
if (item.id == id) {
|
|
913
987
|
return _object_spread_props(_object_spread({}, item), {
|
|
914
|
-
message: message
|
|
988
|
+
message: message,
|
|
989
|
+
extraInfo: extraInfo == null ? item.extraInfo : JSON.stringify(extraInfo)
|
|
915
990
|
});
|
|
916
991
|
} else {
|
|
917
992
|
return item;
|
|
@@ -1238,15 +1313,14 @@ var CustomerService = function(props) {
|
|
|
1238
1313
|
} else if (flag == 3) {
|
|
1239
1314
|
data = {
|
|
1240
1315
|
page: 1,
|
|
1241
|
-
maxPageSize:
|
|
1316
|
+
maxPageSize: 5,
|
|
1242
1317
|
question: value,
|
|
1243
1318
|
sectionId: getQuery("s_id")
|
|
1244
1319
|
};
|
|
1245
1320
|
} else if (flag == 4) {
|
|
1246
1321
|
data = {
|
|
1247
1322
|
page: 1,
|
|
1248
|
-
maxPageSize: 4
|
|
1249
|
-
question: value
|
|
1323
|
+
maxPageSize: 4
|
|
1250
1324
|
};
|
|
1251
1325
|
} else {
|
|
1252
1326
|
data = {
|
|
@@ -1263,37 +1337,45 @@ var CustomerService = function(props) {
|
|
|
1263
1337
|
if (flag == 1) {
|
|
1264
1338
|
setHotQuestionsList(questionList);
|
|
1265
1339
|
} else if (flag == 4) {
|
|
1266
|
-
|
|
1340
|
+
setHotQuestionsList(function(questionList) {
|
|
1267
1341
|
return _to_consumable_array(questionList).concat(_to_consumable_array(res.data.questions));
|
|
1268
1342
|
});
|
|
1269
1343
|
} else {
|
|
1270
1344
|
setQuestionsList(questionList);
|
|
1271
1345
|
}
|
|
1272
|
-
if (questionList.length <
|
|
1346
|
+
if (questionList.length < 5 && flag == 3) {
|
|
1273
1347
|
console.log("视频页面,联想问题小于4个");
|
|
1274
1348
|
//视频页面,联想问题小于4个
|
|
1275
|
-
|
|
1349
|
+
http.get("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions"), {
|
|
1350
|
+
params: {
|
|
1351
|
+
page: 1,
|
|
1352
|
+
maxPageSize: 5 - questionList.length
|
|
1353
|
+
}
|
|
1354
|
+
}).then(function(res) {
|
|
1355
|
+
if (res.data.questions) {
|
|
1356
|
+
setHotQuestionsList(function(questionList) {
|
|
1357
|
+
return _to_consumable_array(questionList).concat(_to_consumable_array(res.data.questions));
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1276
1361
|
}
|
|
1277
1362
|
}
|
|
1278
1363
|
});
|
|
1279
1364
|
};
|
|
1280
|
-
//获取视频页面热门问题 flag == 1,默认推荐问题 == 2
|
|
1365
|
+
//获取视频页面热门问题 flag == 1,默认推荐问题 == 2,底部渲染问题,flag == 3,ai回答后请求相关问题
|
|
1281
1366
|
var videoPageQuestiionsList = function() {
|
|
1282
1367
|
var flag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
1283
|
-
console.log(props, 3333333);
|
|
1368
|
+
console.log(flag, props, 3333333);
|
|
1284
1369
|
var config = props.config;
|
|
1285
1370
|
if (config && config.type == "video" && config.params) {
|
|
1286
1371
|
var params = config.params;
|
|
1287
1372
|
var videoId = params.videoId;
|
|
1288
1373
|
var watchTime = params.videoProgress;
|
|
1289
1374
|
var courseId = getQuery("yc_id");
|
|
1290
|
-
var sectionId =
|
|
1291
|
-
if (videoId &&
|
|
1292
|
-
console.log("请求接口2222", config);
|
|
1375
|
+
var sectionId = params.VideoBriefSummaryId;
|
|
1376
|
+
if (videoId && courseId && sectionId) {
|
|
1293
1377
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
|
|
1294
|
-
"recommendedQuestions":
|
|
1295
|
-
""
|
|
1296
|
-
],
|
|
1378
|
+
"recommendedQuestions": [],
|
|
1297
1379
|
"contexts": [
|
|
1298
1380
|
{
|
|
1299
1381
|
"type": "VIDEO",
|
|
@@ -1303,19 +1385,32 @@ var CustomerService = function(props) {
|
|
|
1303
1385
|
"watchTime": watchTime
|
|
1304
1386
|
}
|
|
1305
1387
|
],
|
|
1306
|
-
"maximum": 5
|
|
1388
|
+
"maximum": flag == 1 || flag == 2 ? 3 : 5
|
|
1307
1389
|
}).then(function(res) {
|
|
1308
|
-
console.log(res, 333333);
|
|
1309
1390
|
if (res.data.total > 0) {
|
|
1310
1391
|
var data = res.data.questions;
|
|
1392
|
+
if (flag == 3) {
|
|
1393
|
+
// setQuestionsList(data);
|
|
1394
|
+
// setVideoHotQuestionsList(data);
|
|
1395
|
+
videoHotQuestionsList.current = data;
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1311
1398
|
if (flag == 2) {
|
|
1312
1399
|
setBottomRecommendationQuestions(data);
|
|
1313
1400
|
} else {
|
|
1314
1401
|
setHotQuestionsList(data);
|
|
1315
1402
|
}
|
|
1403
|
+
var ids = [];
|
|
1404
|
+
data.map(function(str) {
|
|
1405
|
+
ids.push(str.id);
|
|
1406
|
+
});
|
|
1407
|
+
recommendeQuestionID.current = Array.from(new Set(recommendeQuestionID.current.concat(ids)));
|
|
1316
1408
|
resettingBottomHei();
|
|
1317
1409
|
scrollToBottom();
|
|
1318
|
-
|
|
1410
|
+
// console.log(data,99999);
|
|
1411
|
+
// if(data.length < 4){
|
|
1412
|
+
// getQuestiionsList('',4)
|
|
1413
|
+
// }
|
|
1319
1414
|
}
|
|
1320
1415
|
}).catch(function() {});
|
|
1321
1416
|
}
|
|
@@ -1959,23 +2054,37 @@ var CustomerService = function(props) {
|
|
|
1959
2054
|
})
|
|
1960
2055
|
]
|
|
1961
2056
|
}),
|
|
1962
|
-
item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/
|
|
1963
|
-
className: styles.association_problem,
|
|
1964
|
-
children:
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2057
|
+
item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ _jsxs("ul", {
|
|
2058
|
+
className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ? "association_problem_flag" : ""),
|
|
2059
|
+
children: [
|
|
2060
|
+
item.message == "抱歉,我暂时无法回答这样的问题。" && /*#__PURE__*/ _jsx("li", {
|
|
2061
|
+
className: styles.related_issues_flag,
|
|
2062
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
2063
|
+
children: "相关问题"
|
|
2064
|
+
})
|
|
2065
|
+
}),
|
|
2066
|
+
JSON.parse(item.extraInfo).map(function(list, index) {
|
|
2067
|
+
return /*#__PURE__*/ _jsx("li", {
|
|
2068
|
+
onClick: function() {
|
|
2069
|
+
sendMessage(list, 1);
|
|
2070
|
+
if (props.config && props.config.type == "video") {
|
|
2071
|
+
//先请求问题列表
|
|
2072
|
+
videoPageQuestiionsList(2);
|
|
2073
|
+
}
|
|
2074
|
+
},
|
|
2075
|
+
children: item.message == "抱歉,我暂时无法回答这样的问题。" ? list.question : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
2076
|
+
children: [
|
|
2077
|
+
index + 1,
|
|
2078
|
+
".",
|
|
2079
|
+
list.question
|
|
2080
|
+
]
|
|
2081
|
+
})
|
|
2082
|
+
}, i + "_" + index + "_" + list.value);
|
|
2083
|
+
})
|
|
2084
|
+
]
|
|
1976
2085
|
}),
|
|
1977
2086
|
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
1978
|
-
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
2087
|
+
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != "123456_date" && renderLastOperateBtn(item, isAiChatWindow, i),
|
|
1979
2088
|
//召唤老师回答按钮
|
|
1980
2089
|
isAiChatWindow && item.findTeacher && userData.modules.some(function(item) {
|
|
1981
2090
|
return item.short == "TeacherAnswer";
|
|
@@ -2201,11 +2310,9 @@ var CustomerService = function(props) {
|
|
|
2201
2310
|
if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null) && historyMessageList[i - 1] && historyMessageList[i - 1].extraInfo && JSON.parse(historyMessageList[i - 1].extraInfo).length > 0 && JSON.parse(historyMessageList[i - 1].extraInfo)[0].key != "imageUrl") {
|
|
2202
2311
|
findTeacherBtn = true;
|
|
2203
2312
|
}
|
|
2313
|
+
/// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
|
|
2204
2314
|
return /*#__PURE__*/ _jsxs("div", {
|
|
2205
2315
|
className: "".concat(styles.operate_modal_bottom),
|
|
2206
|
-
style: {
|
|
2207
|
-
position: showStopBtn && isPosition.current ? "sticky" : "relative"
|
|
2208
|
-
},
|
|
2209
2316
|
children: [
|
|
2210
2317
|
/*#__PURE__*/ _jsxs("p", {
|
|
2211
2318
|
className: styles.stop_generate,
|
|
@@ -2475,6 +2582,7 @@ var CustomerService = function(props) {
|
|
|
2475
2582
|
className: styles.icon_close,
|
|
2476
2583
|
onClick: function() {
|
|
2477
2584
|
setScreenshotBese64("");
|
|
2585
|
+
resettingBottomHei();
|
|
2478
2586
|
},
|
|
2479
2587
|
children: /*#__PURE__*/ _jsx(CustomRoundClose, {})
|
|
2480
2588
|
}),
|
|
@@ -2851,7 +2959,7 @@ var CustomerService = function(props) {
|
|
|
2851
2959
|
return /*#__PURE__*/ _jsx("div", {
|
|
2852
2960
|
className: styles.issues_list_flag,
|
|
2853
2961
|
style: {
|
|
2854
|
-
bottom: "".concat(buttomHei, "px")
|
|
2962
|
+
bottom: "".concat(buttomHei - 60, "px")
|
|
2855
2963
|
},
|
|
2856
2964
|
id: "BottomAssociationProblem",
|
|
2857
2965
|
children: bottomRecommendationQuestions.map(function(item) {
|
|
@@ -626,7 +626,9 @@
|
|
|
626
626
|
cursor: pointer;
|
|
627
627
|
list-style-type: none;
|
|
628
628
|
}
|
|
629
|
+
|
|
629
630
|
}
|
|
631
|
+
|
|
630
632
|
|
|
631
633
|
.img_con{
|
|
632
634
|
width: 100%;
|
|
@@ -743,6 +745,34 @@
|
|
|
743
745
|
|
|
744
746
|
}
|
|
745
747
|
}
|
|
748
|
+
|
|
749
|
+
.association_problem_flag{
|
|
750
|
+
padding-left: 30px;
|
|
751
|
+
|
|
752
|
+
li{
|
|
753
|
+
position: relative;
|
|
754
|
+
&::after{
|
|
755
|
+
content: '';
|
|
756
|
+
width: 6px;
|
|
757
|
+
height: 6px;
|
|
758
|
+
border-radius: 50%;
|
|
759
|
+
background-color: rgba(217, 217, 217, 1);
|
|
760
|
+
display: block;
|
|
761
|
+
position: absolute;
|
|
762
|
+
top: 12px;
|
|
763
|
+
left: 12px;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
.related_issues_flag{
|
|
767
|
+
span{
|
|
768
|
+
color: #000;
|
|
769
|
+
font-weight: 600;
|
|
770
|
+
border-bottom: 4px solid @color-background-primary-weak-hover;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
746
776
|
.time {
|
|
747
777
|
display: block;
|
|
748
778
|
margin: 40px 0;
|
|
@@ -910,11 +940,12 @@
|
|
|
910
940
|
margin: 0 16px;
|
|
911
941
|
// padding-bottom: 4px;
|
|
912
942
|
line-height: 1;
|
|
913
|
-
|
|
943
|
+
padding-top: 24px;
|
|
914
944
|
p{
|
|
915
945
|
padding: 8px 16px;
|
|
916
946
|
background-color: #fff;
|
|
917
947
|
border-radius: 38px;
|
|
948
|
+
margin-bottom: 16px;
|
|
918
949
|
cursor: pointer;
|
|
919
950
|
&:hover{
|
|
920
951
|
background-color: @color-background-primary-weak;
|