bhd-components 0.7.13 → 0.7.14
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/{1c455680.esm.es5.production.js → 1c8e7e4e.esm.es5.production.js} +1 -1
- package/dist/{75d9e8b4.esm.es5.development.js → 2a1e1288.esm.es5.development.js} +1 -1
- package/dist/index.esm.es5.development.js +152 -47
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/index.js +148 -43
- package/esm/customerService/index.js +150 -45
- package/package.json +1 -1
|
@@ -307,46 +307,76 @@ const CustomerService = (props)=>{
|
|
|
307
307
|
} catch (error) {}
|
|
308
308
|
}, 3000);
|
|
309
309
|
};
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
310
|
+
//发送欢迎语,视频页面
|
|
311
|
+
const sendWelcomMessage = ()=>{
|
|
312
|
+
if (config.type == 'video') {
|
|
313
|
+
let params = config.params;
|
|
314
|
+
let videoId = params.videoId;
|
|
315
|
+
let watchTime = params.videoProgress;
|
|
316
|
+
let courseId = getQuery('yc_id');
|
|
317
|
+
let sectionId = params.VideoBriefSummaryId;
|
|
318
|
+
// let courseId="20899",
|
|
319
|
+
// sectionId= "462347",
|
|
320
|
+
// videoId= "29715",
|
|
321
|
+
// watchTime= 677
|
|
322
|
+
if (videoId && courseId && sectionId) {
|
|
323
|
+
http.post(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions:recommend`, {
|
|
324
|
+
"recommendedQuestions": [],
|
|
325
|
+
"contexts": [
|
|
326
|
+
{
|
|
327
|
+
"type": "VIDEO",
|
|
328
|
+
"courseId": courseId,
|
|
329
|
+
"sectionId": sectionId,
|
|
330
|
+
"videoId": videoId,
|
|
331
|
+
"watchTime": watchTime
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"maximum": 3
|
|
335
|
+
}).then((res)=>{
|
|
336
|
+
let data = res.data.questions;
|
|
337
|
+
let questionsList = data.map((item, index)=>{
|
|
338
|
+
if (index < 3) {
|
|
339
|
+
return {
|
|
340
|
+
key: "messageSource",
|
|
341
|
+
value: item.id,
|
|
342
|
+
question: item.question,
|
|
343
|
+
answer: item.answer
|
|
344
|
+
};
|
|
345
|
+
} else {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
let obj = {
|
|
350
|
+
roomId: roomId,
|
|
351
|
+
sender: "AI",
|
|
352
|
+
recevier: mid,
|
|
353
|
+
message: `Hi,我是智能学习助手,你遇到了什么问题?`,
|
|
354
|
+
extraInfos: questionsList.length > 0 ? questionsList : null
|
|
355
|
+
};
|
|
356
|
+
if (pageNumHistory <= 1) {
|
|
357
|
+
setHistoryMessageList((historyMessageList)=>{
|
|
358
|
+
let newHistoryMessageList = historyMessageList.filter((e)=>e.id != '123456_date');
|
|
359
|
+
newHistoryMessageList.push(_object_spread_props(_object_spread({}, obj), {
|
|
360
|
+
id: '123456_date',
|
|
361
|
+
upvoted: false,
|
|
362
|
+
downvoted: false,
|
|
363
|
+
quotedMessage: "",
|
|
364
|
+
createdAt: getDataTime(-1),
|
|
365
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
366
|
+
}));
|
|
367
|
+
return newHistoryMessageList;
|
|
368
|
+
});
|
|
369
|
+
scrollToBottom();
|
|
340
370
|
}
|
|
341
|
-
|
|
371
|
+
return;
|
|
372
|
+
}).catch(()=>{});
|
|
342
373
|
}
|
|
343
|
-
|
|
344
|
-
obj = {
|
|
374
|
+
} else {
|
|
375
|
+
let obj = {
|
|
345
376
|
roomId: roomId,
|
|
346
377
|
sender: "AI",
|
|
347
378
|
recevier: mid,
|
|
348
|
-
message: `Hi
|
|
349
|
-
extraInfos: questionsList
|
|
379
|
+
message: `Hi,我是智能学习助手,你遇到了什么问题?`
|
|
350
380
|
};
|
|
351
381
|
if (pageNumHistory <= 1) {
|
|
352
382
|
setHistoryMessageList((historyMessageList)=>{
|
|
@@ -357,12 +387,84 @@ const CustomerService = (props)=>{
|
|
|
357
387
|
downvoted: false,
|
|
358
388
|
quotedMessage: "",
|
|
359
389
|
createdAt: getDataTime(-1),
|
|
360
|
-
extraInfo: JSON.stringify(obj.extraInfos)
|
|
390
|
+
// extraInfo: JSON.stringify(obj.extraInfos),
|
|
391
|
+
extraInfo: JSON.stringify([
|
|
392
|
+
{
|
|
393
|
+
key: "messageSource",
|
|
394
|
+
value: "knowledgebase"
|
|
395
|
+
}
|
|
396
|
+
])
|
|
361
397
|
}));
|
|
362
398
|
return newHistoryMessageList;
|
|
363
399
|
});
|
|
364
400
|
scrollToBottom();
|
|
365
401
|
}
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
//AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
|
|
405
|
+
const sendGreetingMessage = (type)=>{
|
|
406
|
+
let questionsList = [];
|
|
407
|
+
let obj = {};
|
|
408
|
+
if (type == 1) {
|
|
409
|
+
sendWelcomMessage();
|
|
410
|
+
// console.log(hotQuestionsList,newHotQuestionsList.current,'33322221111');
|
|
411
|
+
// if(newHotQuestionsList.current.length > 0){
|
|
412
|
+
// questionsList = newHotQuestionsList.current.map((item, index) => {
|
|
413
|
+
// if (index < 3) {
|
|
414
|
+
// return {
|
|
415
|
+
// key: "messageSource",
|
|
416
|
+
// value: item.id,
|
|
417
|
+
// question: item.question,
|
|
418
|
+
// answer: item.answer,
|
|
419
|
+
// };
|
|
420
|
+
// } else {
|
|
421
|
+
// return null;
|
|
422
|
+
// }
|
|
423
|
+
// });
|
|
424
|
+
// }else{
|
|
425
|
+
// questionsList = hotQuestionsList.map((item, index) => {
|
|
426
|
+
// if (index < 3) {
|
|
427
|
+
// return {
|
|
428
|
+
// key: "messageSource",
|
|
429
|
+
// value: item.id,
|
|
430
|
+
// question: item.question,
|
|
431
|
+
// answer: item.answer,
|
|
432
|
+
// };
|
|
433
|
+
// } else {
|
|
434
|
+
// return null;
|
|
435
|
+
// }
|
|
436
|
+
// });
|
|
437
|
+
// }
|
|
438
|
+
// questionsList = questionsList.filter((i) => i != null);
|
|
439
|
+
// obj = {
|
|
440
|
+
// roomId: roomId,
|
|
441
|
+
// sender: "AI",
|
|
442
|
+
// recevier: mid,
|
|
443
|
+
// message: `Hi,我是智能学习助手,你遇到了什么问题?`,
|
|
444
|
+
// extraInfos: questionsList,
|
|
445
|
+
// };
|
|
446
|
+
// if(pageNumHistory <= 1){
|
|
447
|
+
// setHistoryMessageList((historyMessageList) => {
|
|
448
|
+
// let newHistoryMessageList = historyMessageList.filter(e=>e.id!='123456_date');
|
|
449
|
+
// newHistoryMessageList.push({
|
|
450
|
+
// ...obj,
|
|
451
|
+
// id: '123456_date',
|
|
452
|
+
// upvoted: false,
|
|
453
|
+
// downvoted: false,
|
|
454
|
+
// quotedMessage: "",
|
|
455
|
+
// createdAt: getDataTime(-1),
|
|
456
|
+
// extraInfo: JSON.stringify(obj.extraInfos),
|
|
457
|
+
// // extraInfo: JSON.stringify([
|
|
458
|
+
// // {
|
|
459
|
+
// // key: "messageSource",
|
|
460
|
+
// // value: "knowledgebase",
|
|
461
|
+
// // },
|
|
462
|
+
// // ]),
|
|
463
|
+
// });
|
|
464
|
+
// return newHistoryMessageList;
|
|
465
|
+
// });
|
|
466
|
+
// scrollToBottom();
|
|
467
|
+
// }
|
|
366
468
|
return;
|
|
367
469
|
} else if (type == 2) {
|
|
368
470
|
obj = {
|
|
@@ -965,7 +1067,7 @@ const CustomerService = (props)=>{
|
|
|
965
1067
|
} else {
|
|
966
1068
|
let newHistoryMessageList2 = list1.map((item)=>{
|
|
967
1069
|
message = item.message + obj.message;
|
|
968
|
-
let extraInfo =
|
|
1070
|
+
let extraInfo = null;
|
|
969
1071
|
// message = '抱歉,我暂时无法回答这样的问题。'
|
|
970
1072
|
if (message == '抱歉,我暂时无法回答这样的问题。') {
|
|
971
1073
|
extraInfo = videoHotQuestionsList.current.map((str, index)=>{
|
|
@@ -1357,12 +1459,15 @@ const CustomerService = (props)=>{
|
|
|
1357
1459
|
const videoPageQuestiionsList = (flag = 1)=>{
|
|
1358
1460
|
console.log(flag, props, 3333333);
|
|
1359
1461
|
if (config && config.type == 'video' && config.params) {
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
let courseId
|
|
1462
|
+
let params = config.params;
|
|
1463
|
+
let videoId = params.videoId;
|
|
1464
|
+
let watchTime = params.videoProgress;
|
|
1465
|
+
let courseId = getQuery('yc_id');
|
|
1466
|
+
let sectionId = params.VideoBriefSummaryId;
|
|
1467
|
+
// let courseId="20899",
|
|
1468
|
+
// sectionId= "462347",
|
|
1469
|
+
// videoId= "29715",
|
|
1470
|
+
// watchTime= 677
|
|
1366
1471
|
if (videoId && courseId && sectionId) {
|
|
1367
1472
|
console.log(recommendeQuestionID.current, 'recommendeQuestionID.current');
|
|
1368
1473
|
http.post(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions:recommend`, {
|
|
@@ -311,48 +311,78 @@ var CustomerService = function(props) {
|
|
|
311
311
|
} catch (error) {}
|
|
312
312
|
}, 3000);
|
|
313
313
|
};
|
|
314
|
-
|
|
315
|
-
var
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
314
|
+
//发送欢迎语,视频页面
|
|
315
|
+
var sendWelcomMessage = function() {
|
|
316
|
+
if (config.type == "video") {
|
|
317
|
+
var params = config.params;
|
|
318
|
+
var videoId = params.videoId;
|
|
319
|
+
var watchTime = params.videoProgress;
|
|
320
|
+
var courseId = getQuery("yc_id");
|
|
321
|
+
var sectionId = params.VideoBriefSummaryId;
|
|
322
|
+
// let courseId="20899",
|
|
323
|
+
// sectionId= "462347",
|
|
324
|
+
// videoId= "29715",
|
|
325
|
+
// watchTime= 677
|
|
326
|
+
if (videoId && courseId && sectionId) {
|
|
327
|
+
http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
|
|
328
|
+
"recommendedQuestions": [],
|
|
329
|
+
"contexts": [
|
|
330
|
+
{
|
|
331
|
+
"type": "VIDEO",
|
|
332
|
+
"courseId": courseId,
|
|
333
|
+
"sectionId": sectionId,
|
|
334
|
+
"videoId": videoId,
|
|
335
|
+
"watchTime": watchTime
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
"maximum": 3
|
|
339
|
+
}).then(function(res) {
|
|
340
|
+
var data = res.data.questions;
|
|
341
|
+
var questionsList = data.map(function(item, index) {
|
|
342
|
+
if (index < 3) {
|
|
343
|
+
return {
|
|
344
|
+
key: "messageSource",
|
|
345
|
+
value: item.id,
|
|
346
|
+
question: item.question,
|
|
347
|
+
answer: item.answer
|
|
348
|
+
};
|
|
349
|
+
} else {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
var obj = {
|
|
354
|
+
roomId: roomId,
|
|
355
|
+
sender: "AI",
|
|
356
|
+
recevier: mid,
|
|
357
|
+
message: "Hi,我是智能学习助手,你遇到了什么问题?",
|
|
358
|
+
extraInfos: questionsList.length > 0 ? questionsList : null
|
|
359
|
+
};
|
|
360
|
+
if (pageNumHistory <= 1) {
|
|
361
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
362
|
+
var newHistoryMessageList = historyMessageList.filter(function(e) {
|
|
363
|
+
return e.id != "123456_date";
|
|
364
|
+
});
|
|
365
|
+
newHistoryMessageList.push(_object_spread_props(_object_spread({}, obj), {
|
|
366
|
+
id: "123456_date",
|
|
367
|
+
upvoted: false,
|
|
368
|
+
downvoted: false,
|
|
369
|
+
quotedMessage: "",
|
|
370
|
+
createdAt: getDataTime(-1),
|
|
371
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
372
|
+
}));
|
|
373
|
+
return newHistoryMessageList;
|
|
374
|
+
});
|
|
375
|
+
scrollToBottom();
|
|
344
376
|
}
|
|
345
|
-
|
|
377
|
+
return;
|
|
378
|
+
}).catch(function() {});
|
|
346
379
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
});
|
|
350
|
-
obj = {
|
|
380
|
+
} else {
|
|
381
|
+
var obj = {
|
|
351
382
|
roomId: roomId,
|
|
352
383
|
sender: "AI",
|
|
353
384
|
recevier: mid,
|
|
354
|
-
message: "Hi,我是智能学习助手,你遇到了什么问题?"
|
|
355
|
-
extraInfos: questionsList
|
|
385
|
+
message: "Hi,我是智能学习助手,你遇到了什么问题?"
|
|
356
386
|
};
|
|
357
387
|
if (pageNumHistory <= 1) {
|
|
358
388
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -365,12 +395,84 @@ var CustomerService = function(props) {
|
|
|
365
395
|
downvoted: false,
|
|
366
396
|
quotedMessage: "",
|
|
367
397
|
createdAt: getDataTime(-1),
|
|
368
|
-
extraInfo: JSON.stringify(obj.extraInfos)
|
|
398
|
+
// extraInfo: JSON.stringify(obj.extraInfos),
|
|
399
|
+
extraInfo: JSON.stringify([
|
|
400
|
+
{
|
|
401
|
+
key: "messageSource",
|
|
402
|
+
value: "knowledgebase"
|
|
403
|
+
}
|
|
404
|
+
])
|
|
369
405
|
}));
|
|
370
406
|
return newHistoryMessageList;
|
|
371
407
|
});
|
|
372
408
|
scrollToBottom();
|
|
373
409
|
}
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
//AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
|
|
413
|
+
var sendGreetingMessage = function(type) {
|
|
414
|
+
var questionsList = [];
|
|
415
|
+
var obj = {};
|
|
416
|
+
if (type == 1) {
|
|
417
|
+
sendWelcomMessage();
|
|
418
|
+
// console.log(hotQuestionsList,newHotQuestionsList.current,'33322221111');
|
|
419
|
+
// if(newHotQuestionsList.current.length > 0){
|
|
420
|
+
// questionsList = newHotQuestionsList.current.map((item, index) => {
|
|
421
|
+
// if (index < 3) {
|
|
422
|
+
// return {
|
|
423
|
+
// key: "messageSource",
|
|
424
|
+
// value: item.id,
|
|
425
|
+
// question: item.question,
|
|
426
|
+
// answer: item.answer,
|
|
427
|
+
// };
|
|
428
|
+
// } else {
|
|
429
|
+
// return null;
|
|
430
|
+
// }
|
|
431
|
+
// });
|
|
432
|
+
// }else{
|
|
433
|
+
// questionsList = hotQuestionsList.map((item, index) => {
|
|
434
|
+
// if (index < 3) {
|
|
435
|
+
// return {
|
|
436
|
+
// key: "messageSource",
|
|
437
|
+
// value: item.id,
|
|
438
|
+
// question: item.question,
|
|
439
|
+
// answer: item.answer,
|
|
440
|
+
// };
|
|
441
|
+
// } else {
|
|
442
|
+
// return null;
|
|
443
|
+
// }
|
|
444
|
+
// });
|
|
445
|
+
// }
|
|
446
|
+
// questionsList = questionsList.filter((i) => i != null);
|
|
447
|
+
// obj = {
|
|
448
|
+
// roomId: roomId,
|
|
449
|
+
// sender: "AI",
|
|
450
|
+
// recevier: mid,
|
|
451
|
+
// message: `Hi,我是智能学习助手,你遇到了什么问题?`,
|
|
452
|
+
// extraInfos: questionsList,
|
|
453
|
+
// };
|
|
454
|
+
// if(pageNumHistory <= 1){
|
|
455
|
+
// setHistoryMessageList((historyMessageList) => {
|
|
456
|
+
// let newHistoryMessageList = historyMessageList.filter(e=>e.id!='123456_date');
|
|
457
|
+
// newHistoryMessageList.push({
|
|
458
|
+
// ...obj,
|
|
459
|
+
// id: '123456_date',
|
|
460
|
+
// upvoted: false,
|
|
461
|
+
// downvoted: false,
|
|
462
|
+
// quotedMessage: "",
|
|
463
|
+
// createdAt: getDataTime(-1),
|
|
464
|
+
// extraInfo: JSON.stringify(obj.extraInfos),
|
|
465
|
+
// // extraInfo: JSON.stringify([
|
|
466
|
+
// // {
|
|
467
|
+
// // key: "messageSource",
|
|
468
|
+
// // value: "knowledgebase",
|
|
469
|
+
// // },
|
|
470
|
+
// // ]),
|
|
471
|
+
// });
|
|
472
|
+
// return newHistoryMessageList;
|
|
473
|
+
// });
|
|
474
|
+
// scrollToBottom();
|
|
475
|
+
// }
|
|
374
476
|
return;
|
|
375
477
|
} else if (type == 2) {
|
|
376
478
|
obj = {
|
|
@@ -992,7 +1094,7 @@ var CustomerService = function(props) {
|
|
|
992
1094
|
} else {
|
|
993
1095
|
var newHistoryMessageList2 = list1.map(function(item) {
|
|
994
1096
|
message = item.message + obj.message;
|
|
995
|
-
var extraInfo =
|
|
1097
|
+
var extraInfo = null;
|
|
996
1098
|
// message = '抱歉,我暂时无法回答这样的问题。'
|
|
997
1099
|
if (message == "抱歉,我暂时无法回答这样的问题。") {
|
|
998
1100
|
extraInfo = videoHotQuestionsList.current.map(function(str, index) {
|
|
@@ -1390,12 +1492,15 @@ var CustomerService = function(props) {
|
|
|
1390
1492
|
var flag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
1391
1493
|
console.log(flag, props, 3333333);
|
|
1392
1494
|
if (config && config.type == "video" && config.params) {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1495
|
+
var params = config.params;
|
|
1496
|
+
var videoId = params.videoId;
|
|
1497
|
+
var watchTime = params.videoProgress;
|
|
1498
|
+
var courseId = getQuery("yc_id");
|
|
1499
|
+
var sectionId = params.VideoBriefSummaryId;
|
|
1500
|
+
// let courseId="20899",
|
|
1501
|
+
// sectionId= "462347",
|
|
1502
|
+
// videoId= "29715",
|
|
1503
|
+
// watchTime= 677
|
|
1399
1504
|
if (videoId && courseId && sectionId) {
|
|
1400
1505
|
console.log(recommendeQuestionID.current, "recommendeQuestionID.current");
|
|
1401
1506
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
|