bhd-components 0.7.16 → 0.7.17

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.
@@ -94,10 +94,10 @@ const CustomerService = (props)=>{
94
94
  }
95
95
  });
96
96
  useEffect(()=>{
97
- if (config && config.type == 'video') {
98
- //获取热门推荐
99
- videoPageQuestiionsList(1);
100
- }
97
+ // if(config && config.type == 'video'){
98
+ // //获取热门推荐
99
+ // videoPageQuestiionsList(1);
100
+ // }
101
101
  setShowType(initShowType);
102
102
  }, [
103
103
  initShowType
@@ -366,14 +366,13 @@ const CustomerService = (props)=>{
366
366
  createdAt: getDataTime(-1),
367
367
  extraInfo: obj.extraInfos != null ? JSON.stringify(obj.extraInfos) : null
368
368
  }));
369
- console.log(newHistoryMessageList, 3333333333339999);
370
369
  return newHistoryMessageList;
371
370
  });
372
371
  scrollToBottom();
373
372
  }
374
373
  return;
375
374
  } catch (error) {}
376
- }).catch(()=>{});
375
+ });
377
376
  }
378
377
  } else {
379
378
  let obj = {
@@ -405,71 +404,54 @@ const CustomerService = (props)=>{
405
404
  }
406
405
  }
407
406
  };
408
- //AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
407
+ //无ai权限时,发送热门问题
408
+ const getAssociativeProblem = ()=>{
409
+ http.get(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions`, {
410
+ params: {
411
+ page: 1,
412
+ maxPageSize: 5
413
+ }
414
+ }).then((res)=>{
415
+ setFinished(true);
416
+ if (res.data.total > 0) {
417
+ let questionsList = res.data.questions.map((item)=>{
418
+ return {
419
+ key: "messageSource",
420
+ value: item.id,
421
+ question: item.question,
422
+ answer: item.answer
423
+ };
424
+ });
425
+ let obj = {
426
+ roomId: roomId,
427
+ sender: "AI",
428
+ recevier: mid,
429
+ message: `猜你想问:`,
430
+ extraInfos: questionsList
431
+ };
432
+ if (pageNumHistory <= 1) {
433
+ setHistoryMessageList((historyMessageList)=>{
434
+ let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
435
+ id: 'p' + new Date().getTime(),
436
+ upvoted: false,
437
+ downvoted: false,
438
+ quotedMessage: "",
439
+ createdAt: getDataTime(-1),
440
+ extraInfo: JSON.stringify(obj.extraInfos)
441
+ }));
442
+ return newHistoryMessageList;
443
+ });
444
+ scrollToBottom();
445
+ }
446
+ return;
447
+ }
448
+ });
449
+ };
450
+ //AI窗口,type:1发送打招呼信息欢迎语 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
409
451
  const sendGreetingMessage = (type)=>{
410
- let questionsList = [];
411
452
  let obj = {};
412
453
  if (type == 1) {
413
- console.log('dflkvmdfklvdf欢迎语');
414
454
  sendWelcomMessage();
415
- // console.log(hotQuestionsList,newHotQuestionsList.current,'33322221111');
416
- // if(newHotQuestionsList.current.length > 0){
417
- // questionsList = newHotQuestionsList.current.map((item, index) => {
418
- // if (index < 3) {
419
- // return {
420
- // key: "messageSource",
421
- // value: item.id,
422
- // question: item.question,
423
- // answer: item.answer,
424
- // };
425
- // } else {
426
- // return null;
427
- // }
428
- // });
429
- // }else{
430
- // questionsList = hotQuestionsList.map((item, index) => {
431
- // if (index < 3) {
432
- // return {
433
- // key: "messageSource",
434
- // value: item.id,
435
- // question: item.question,
436
- // answer: item.answer,
437
- // };
438
- // } else {
439
- // return null;
440
- // }
441
- // });
442
- // }
443
- // questionsList = questionsList.filter((i) => i != null);
444
- // obj = {
445
- // roomId: roomId,
446
- // sender: "AI",
447
- // recevier: mid,
448
- // message: `Hi,我是智能学习助手,你遇到了什么问题?`,
449
- // extraInfos: questionsList,
450
- // };
451
- // if(pageNumHistory <= 1){
452
- // setHistoryMessageList((historyMessageList) => {
453
- // let newHistoryMessageList = historyMessageList.filter(e=>e.id!='123456_date');
454
- // newHistoryMessageList.push({
455
- // ...obj,
456
- // id: '123456_date',
457
- // upvoted: false,
458
- // downvoted: false,
459
- // quotedMessage: "",
460
- // createdAt: getDataTime(-1),
461
- // extraInfo: JSON.stringify(obj.extraInfos),
462
- // // extraInfo: JSON.stringify([
463
- // // {
464
- // // key: "messageSource",
465
- // // value: "knowledgebase",
466
- // // },
467
- // // ]),
468
- // });
469
- // return newHistoryMessageList;
470
- // });
471
- // scrollToBottom();
472
- // }
473
455
  return;
474
456
  } else if (type == 2) {
475
457
  obj = {
@@ -530,35 +512,7 @@ const CustomerService = (props)=>{
530
512
  ]
531
513
  };
532
514
  } else if (type == 6) {
533
- questionsList = hotQuestionsList.map((item)=>{
534
- return {
535
- key: "messageSource",
536
- value: item.id,
537
- question: item.question,
538
- answer: item.answer
539
- };
540
- });
541
- obj = {
542
- roomId: roomId,
543
- sender: "AI",
544
- recevier: mid,
545
- message: `猜你想问:`,
546
- extraInfos: questionsList
547
- };
548
- if (pageNumHistory <= 1) {
549
- setHistoryMessageList((historyMessageList)=>{
550
- let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
551
- id: 'p' + new Date().getTime(),
552
- upvoted: false,
553
- downvoted: false,
554
- quotedMessage: "",
555
- createdAt: getDataTime(-1),
556
- extraInfo: JSON.stringify(obj.extraInfos)
557
- }));
558
- return newHistoryMessageList;
559
- });
560
- scrollToBottom();
561
- }
515
+ getAssociativeProblem();
562
516
  return;
563
517
  }
564
518
  setKeyWord("");
@@ -775,10 +729,6 @@ const CustomerService = (props)=>{
775
729
  scrollToBottom();
776
730
  }
777
731
  console.log(type, '接受答案77777');
778
- //获取下面的推荐问题
779
- // if(type == 2){
780
- // videoPageQuestiionsList(2);
781
- // }
782
732
  http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj).then((res)=>{
783
733
  if (res.data.id) {
784
734
  if (pageNumHistory <= 1) {
@@ -96,10 +96,10 @@ var CustomerService = function(props) {
96
96
  }
97
97
  });
98
98
  useEffect(function() {
99
- if (config && config.type == "video") {
100
- //获取热门推荐
101
- videoPageQuestiionsList(1);
102
- }
99
+ // if(config && config.type == 'video'){
100
+ // //获取热门推荐
101
+ // videoPageQuestiionsList(1);
102
+ // }
103
103
  setShowType(initShowType);
104
104
  }, [
105
105
  initShowType
@@ -372,14 +372,13 @@ var CustomerService = function(props) {
372
372
  createdAt: getDataTime(-1),
373
373
  extraInfo: obj.extraInfos != null ? JSON.stringify(obj.extraInfos) : null
374
374
  }));
375
- console.log(newHistoryMessageList, 3333333333339999);
376
375
  return newHistoryMessageList;
377
376
  });
378
377
  scrollToBottom();
379
378
  }
380
379
  return;
381
380
  } catch (error) {}
382
- }).catch(function() {});
381
+ });
383
382
  }
384
383
  } else {
385
384
  var obj = {
@@ -413,71 +412,54 @@ var CustomerService = function(props) {
413
412
  }
414
413
  }
415
414
  };
416
- //AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
415
+ //无ai权限时,发送热门问题
416
+ var getAssociativeProblem = function() {
417
+ http.get("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions"), {
418
+ params: {
419
+ page: 1,
420
+ maxPageSize: 5
421
+ }
422
+ }).then(function(res) {
423
+ setFinished(true);
424
+ if (res.data.total > 0) {
425
+ var questionsList = res.data.questions.map(function(item) {
426
+ return {
427
+ key: "messageSource",
428
+ value: item.id,
429
+ question: item.question,
430
+ answer: item.answer
431
+ };
432
+ });
433
+ var obj = {
434
+ roomId: roomId,
435
+ sender: "AI",
436
+ recevier: mid,
437
+ message: "猜你想问:",
438
+ extraInfos: questionsList
439
+ };
440
+ if (pageNumHistory <= 1) {
441
+ setHistoryMessageList(function(historyMessageList) {
442
+ var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
443
+ id: "p" + new Date().getTime(),
444
+ upvoted: false,
445
+ downvoted: false,
446
+ quotedMessage: "",
447
+ createdAt: getDataTime(-1),
448
+ extraInfo: JSON.stringify(obj.extraInfos)
449
+ }));
450
+ return newHistoryMessageList;
451
+ });
452
+ scrollToBottom();
453
+ }
454
+ return;
455
+ }
456
+ });
457
+ };
458
+ //AI窗口,type:1发送打招呼信息欢迎语 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
417
459
  var sendGreetingMessage = function(type) {
418
- var questionsList = [];
419
460
  var obj = {};
420
461
  if (type == 1) {
421
- console.log("dflkvmdfklvdf欢迎语");
422
462
  sendWelcomMessage();
423
- // console.log(hotQuestionsList,newHotQuestionsList.current,'33322221111');
424
- // if(newHotQuestionsList.current.length > 0){
425
- // questionsList = newHotQuestionsList.current.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
- // }else{
438
- // questionsList = hotQuestionsList.map((item, index) => {
439
- // if (index < 3) {
440
- // return {
441
- // key: "messageSource",
442
- // value: item.id,
443
- // question: item.question,
444
- // answer: item.answer,
445
- // };
446
- // } else {
447
- // return null;
448
- // }
449
- // });
450
- // }
451
- // questionsList = questionsList.filter((i) => i != null);
452
- // obj = {
453
- // roomId: roomId,
454
- // sender: "AI",
455
- // recevier: mid,
456
- // message: `Hi,我是智能学习助手,你遇到了什么问题?`,
457
- // extraInfos: questionsList,
458
- // };
459
- // if(pageNumHistory <= 1){
460
- // setHistoryMessageList((historyMessageList) => {
461
- // let newHistoryMessageList = historyMessageList.filter(e=>e.id!='123456_date');
462
- // newHistoryMessageList.push({
463
- // ...obj,
464
- // id: '123456_date',
465
- // upvoted: false,
466
- // downvoted: false,
467
- // quotedMessage: "",
468
- // createdAt: getDataTime(-1),
469
- // extraInfo: JSON.stringify(obj.extraInfos),
470
- // // extraInfo: JSON.stringify([
471
- // // {
472
- // // key: "messageSource",
473
- // // value: "knowledgebase",
474
- // // },
475
- // // ]),
476
- // });
477
- // return newHistoryMessageList;
478
- // });
479
- // scrollToBottom();
480
- // }
481
463
  return;
482
464
  } else if (type == 2) {
483
465
  obj = {
@@ -538,35 +520,7 @@ var CustomerService = function(props) {
538
520
  ]
539
521
  };
540
522
  } else if (type == 6) {
541
- questionsList = hotQuestionsList.map(function(item) {
542
- return {
543
- key: "messageSource",
544
- value: item.id,
545
- question: item.question,
546
- answer: item.answer
547
- };
548
- });
549
- obj = {
550
- roomId: roomId,
551
- sender: "AI",
552
- recevier: mid,
553
- message: "猜你想问:",
554
- extraInfos: questionsList
555
- };
556
- if (pageNumHistory <= 1) {
557
- setHistoryMessageList(function(historyMessageList) {
558
- var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
559
- id: "p" + new Date().getTime(),
560
- upvoted: false,
561
- downvoted: false,
562
- quotedMessage: "",
563
- createdAt: getDataTime(-1),
564
- extraInfo: JSON.stringify(obj.extraInfos)
565
- }));
566
- return newHistoryMessageList;
567
- });
568
- scrollToBottom();
569
- }
523
+ getAssociativeProblem();
570
524
  return;
571
525
  }
572
526
  setKeyWord("");
@@ -792,10 +746,6 @@ var CustomerService = function(props) {
792
746
  scrollToBottom();
793
747
  }
794
748
  console.log(type, "接受答案77777");
795
- //获取下面的推荐问题
796
- // if(type == 2){
797
- // videoPageQuestiionsList(2);
798
- // }
799
749
  http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
800
750
  if (res.data.id) {
801
751
  if (pageNumHistory <= 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.7.16",
3
+ "version": "0.7.17",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",