bhd-components 0.6.5 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{8bda9e2e.esm.es5.production.js → 0acf50ef.esm.es5.production.js} +1 -1
  2. package/dist/{d4259367.esm.es5.development.js → 4fa3313f.esm.es5.development.js} +1402 -1140
  3. package/dist/index.esm.es5.development.css +864 -732
  4. package/dist/index.esm.es5.development.js +945 -780
  5. package/dist/index.esm.es5.production.css +1 -1
  6. package/dist/index.esm.es5.production.js +1 -1
  7. package/es2017/customerService/contactsList.d.ts +1 -1
  8. package/es2017/customerService/contactsList.js +11 -145
  9. package/es2017/customerService/function.js +20 -13
  10. package/es2017/customerService/historyFun.js +334 -154
  11. package/es2017/customerService/index.js +567 -437
  12. package/es2017/customerService/index.module.less +169 -65
  13. package/es2017/customerService/index2.module.less +170 -65
  14. package/es2017/icons/components/custom-expand.d.ts +4 -0
  15. package/es2017/icons/components/custom-expand.js +22 -0
  16. package/es2017/icons/components/index.d.ts +1 -0
  17. package/es2017/icons/components/index.js +1 -0
  18. package/esm/customerService/contactsList.d.ts +1 -1
  19. package/esm/customerService/contactsList.js +11 -158
  20. package/esm/customerService/function.js +20 -13
  21. package/esm/customerService/historyFun.js +338 -167
  22. package/esm/customerService/index.js +557 -445
  23. package/esm/customerService/index.module.less +169 -65
  24. package/esm/customerService/index2.module.less +170 -65
  25. package/esm/icons/components/custom-expand.d.ts +4 -0
  26. package/esm/icons/components/custom-expand.js +24 -0
  27. package/esm/icons/components/index.d.ts +1 -0
  28. package/esm/icons/components/index.js +1 -0
  29. package/package.json +1 -1
@@ -46,21 +46,22 @@ const CustomerService = (props)=>{
46
46
  const [firstLoad, setFirstLoad] = useState(false); //第一次切换全屏时滚动到页面底部
47
47
  const [buttomHei, setButtomHei] = useState(45); //底部输入框的高度
48
48
  const [showHistory, setShowHistory] = useState(false); //是否显示历史记录
49
- const [showContacts, setShowContacts] = useState(false); //是否显示关联老师
49
+ const [showContacts, setShowContacts] = useState(false); //是否显示老师列表
50
50
  const [showType, setShowType] = useState(-1); //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
51
51
  const [answerMode, setAnswerMode] = useState(-1); //设置回答模式。1,召唤老师回答
52
52
  const [teacherList, setTeacherList] = useState([]); //老师列表
53
53
  const [problem, setProblem] = useState({}); //召唤老师回答的问题
54
- const [roomList, setRoomList] = useState([]); //聊天列表
54
+ // const [roomList,setRoomList] = useState([]);//聊天列表
55
+ const [contactsList, setContactsList] = useState([]); //老师列表
55
56
  const [chatObj, setChatObj] = useState([]); //聊天记录id保存,用来在实验报告中记录
56
57
  const timer = useRef(null); //文本框输入时
57
58
  let receiveMessageTimer = useRef(null); //接收ai发回的消息
58
59
  let voiceCountdownTimer = useRef(null); //语音录制倒计时
59
60
  let listTimer = useRef(null); // 请求列表倒计时
60
61
  let roomMessage = useRef(null); //循环当前页面的新消息
62
+ let chatRoomList = useRef(null); //获取聊天室列表
61
63
  const ctrl = useRef(); //停止生成ai回答时使用
62
64
  let childRef = useRef(null); //获取子组件方法
63
- // const [mid, setmid] = useState(props.userData.mid); //当前用户id
64
65
  const mid = props.userData.mid;
65
66
  const remarkable = new Remarkable({
66
67
  highlight: function(str, lang) {
@@ -82,6 +83,7 @@ const CustomerService = (props)=>{
82
83
  clearTimeout(listTimer.current);
83
84
  clearTimeout(timer.current);
84
85
  clearTimeout(roomMessage.current);
86
+ clearTimeout(chatRoomList.current);
85
87
  };
86
88
  }, []);
87
89
  useEffect(()=>{
@@ -94,29 +96,30 @@ const CustomerService = (props)=>{
94
96
  function handleScroll() {
95
97
  const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
96
98
  const scrollTop = container.scrollTop;
97
- // const scrollBottom = container.scroll;
98
99
  const clientHeight = container.clientHeight;
99
100
  const scrollHeight = container.scrollHeight;
100
101
  // console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
101
- if (clientHeight + scrollTop + 0.5 >= scrollHeight) {
102
- console.log('到底部了22222');
103
- // console.log(11111111,pageNumHistory)
104
- if (pageNumHistory > 1) {
105
- // console.log(pageNumHistory,'pageNumpageNumpageNum')
106
- let number = pageNumHistory - 1;
107
- setPageNumHistory(number);
108
- clearTimeout(listTimer.current);
109
- setBottomLoading(true);
110
- listTimer.current = setTimeout(()=>{
111
- // console.log("加载下一页", number);
102
+ if (clientHeight + scrollTop + 0.5 >= scrollHeight && pageNumHistory > 1) {
103
+ console.log("到底部了22222");
104
+ // if (pageNumHistory > 1) {
105
+ // console.log(pageNumHistory,'pageNumpageNumpageNum')
106
+ let number = pageNumHistory - 1;
107
+ setPageNumHistory(number);
108
+ clearTimeout(listTimer.current);
109
+ listTimer.current = setTimeout(()=>{
110
+ if (number > 0) {
111
+ setBottomLoading(true);
112
112
  getHistoryMessage(number, 4);
113
- }, 1000);
114
- } else {
115
- setLastId('');
116
- }
113
+ } else {
114
+ setPageNumHistory(0);
115
+ }
116
+ }, 100);
117
+ // } else {
118
+ // setLastId("");
119
+ // }
117
120
  }
118
121
  if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
119
- console.log('到顶了', pageNum);
122
+ console.log("到顶了", pageNum);
120
123
  // if(pageNum == 1){
121
124
  // setFirstpage(true);//代表是否存在第一页
122
125
  // }
@@ -166,15 +169,13 @@ const CustomerService = (props)=>{
166
169
  // console.log(props,'lsdkcmsdlcksd')
167
170
  getQuestiionsList("", 1);
168
171
  scrollToBottom();
169
- // less.modifyVars({ "@color-border-Tr": "#f4523b" });
170
172
  setShowType(initShowType);
171
173
  }, [
172
174
  initShowType
173
175
  ]);
174
176
  useEffect(()=>{
175
- // console.log(roomId,1111111)
176
- if (roomId != '') {
177
- if (lastId == '') {
177
+ if (roomId != "") {
178
+ if (lastId == "") {
178
179
  getHistoryMessage(pageNum, 2);
179
180
  } else {
180
181
  //查看历史记录,需要定位到当前记录
@@ -184,30 +185,28 @@ const CustomerService = (props)=>{
184
185
  }, [
185
186
  roomId
186
187
  ]);
188
+ //创建聊天室并获取聊天室列表
187
189
  useEffect(()=>{
188
- if (roomList.length == 0) {
189
- createRooms("AI").then((res)=>{
190
- setRoomId(res.data.id);
191
- setRoomList([
192
- {
193
- roomId: res.data.id,
194
- unreadCount: 0,
195
- uid: mid,
196
- sender: 'AI'
197
- }
198
- ]);
199
- });
200
- } else {
201
- setRoomList(roomList);
202
- }
203
- // recordRef.current.roomList=JSON.parse(JSON.stringify(roomList))
204
- }, [
205
- roomList
206
- ]);
190
+ createRooms("AI").then((res)=>{
191
+ setRoomId(res.data.id);
192
+ });
193
+ roomsListTimer();
194
+ return ()=>{
195
+ clearTimeout(chatRoomList.current);
196
+ };
197
+ }, []);
207
198
  //进入页面,发送打招呼信息
208
199
  useEffect(()=>{
209
- // console.log(historyMessageList, "dkjvndfkjvd33333f");
210
200
  //老师的聊天窗口不发送打招呼信息
201
+ let roomList = contactsList;
202
+ // console.log(roomList,'dkfvdfkjvndfkjvdfv')
203
+ let count = 0;
204
+ roomList.map((item)=>{
205
+ count += item.unreadCount;
206
+ });
207
+ if (count > 0) {
208
+ setShowContacts(true);
209
+ }
211
210
  if (!(roomList.length > 0 && roomList[0].roomId != roomId)) {
212
211
  //是否发送打招呼信息
213
212
  if (greetingMessage && historyMessageList.length == 0) {
@@ -242,7 +241,7 @@ const CustomerService = (props)=>{
242
241
  }, [
243
242
  bese64String
244
243
  ]);
245
- //AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
244
+ //AI窗口,type:1发送打招呼信息 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
246
245
  const sendGreetingMessage = (type)=>{
247
246
  let questionsList = [];
248
247
  let obj = {};
@@ -345,24 +344,21 @@ const CustomerService = (props)=>{
345
344
  setKeyWord("");
346
345
  setQuestionsList([]);
347
346
  setCitationContent({});
348
- http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj, {
349
- headers: {
350
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
351
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
352
- }
353
- }).then((res)=>{
347
+ http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj).then((res)=>{
354
348
  if (res.data.id) {
355
- setHistoryMessageList((historyMessageList)=>{
356
- let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
357
- id: res.data.id,
358
- upvoted: false,
359
- downvoted: false,
360
- quotedMessage: "",
361
- createdAt: getDataTime(-1),
362
- extraInfo: JSON.stringify(obj.extraInfos)
363
- }));
364
- return newHistoryMessageList;
365
- });
349
+ if (pageNumHistory <= 1) {
350
+ setHistoryMessageList((historyMessageList)=>{
351
+ let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
352
+ id: res.data.id,
353
+ upvoted: false,
354
+ downvoted: false,
355
+ quotedMessage: "",
356
+ createdAt: getDataTime(-1),
357
+ extraInfo: JSON.stringify(obj.extraInfos)
358
+ }));
359
+ return newHistoryMessageList;
360
+ });
361
+ }
366
362
  scrollToBottom();
367
363
  if (type == 4) {
368
364
  sendGreetingMessage(6);
@@ -385,8 +381,8 @@ const CustomerService = (props)=>{
385
381
  };
386
382
  setProblem({});
387
383
  } else if (type == 2) {
388
- let list = roomList.filter((item)=>item.roomId == roomId);
389
- let recevier = '';
384
+ let list = contactsList.filter((item)=>item.roomId == roomId);
385
+ let recevier = "";
390
386
  if (list.length > 0) {
391
387
  recevier = list[0].sender;
392
388
  }
@@ -398,14 +394,9 @@ const CustomerService = (props)=>{
398
394
  quotedMessage: citationContent.content || ""
399
395
  };
400
396
  }
401
- http.post(`${urllocation}/chat-service/public/v1.0/chat-with-user/messages`, obj, {
402
- headers: {
403
- "x-module-id": userData.modules.find((ele)=>ele.short == "TeacherAnswer").id,
404
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
405
- }
406
- }).then((res)=>{
397
+ http.post(`${urllocation}/chat-service/public/v1.0/chat-with-user/messages`, obj).then((res)=>{
407
398
  if (res.data.id) {
408
- console.log(pageNum, pageNumHistory, lastId, 'dlskskdsd4444');
399
+ // console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
409
400
  if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
410
401
  setHistoryMessageList((historyMessageList)=>{
411
402
  let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
@@ -426,8 +417,8 @@ const CustomerService = (props)=>{
426
417
  if (type == 1) {
427
418
  let roomList = [
428
419
  {
429
- 'roomId': roomId,
430
- 'id': res.data.id
420
+ roomId: roomId,
421
+ id: res.data.id
431
422
  }
432
423
  ];
433
424
  setChatObj((list)=>{
@@ -474,21 +465,23 @@ const CustomerService = (props)=>{
474
465
  setQuestionsList([]);
475
466
  setCitationContent({});
476
467
  } else if (userData.modules.some((item)=>item.short == "AIservice")) {
477
- setHistoryMessageList((historyMessageList)=>{
478
- let newHistoryMessageList = historyMessageList.concat({
479
- roomId: roomId,
480
- sender: mid,
481
- recevier: "AI",
482
- message: keyWord,
483
- quotedMessage: citationContent.content,
484
- id: "654321",
485
- upvoted: false,
486
- downvoted: false,
487
- createdAt: getDataTime(-1),
488
- extraInfo: JSON.stringify([])
468
+ if (pageNumHistory <= 1) {
469
+ setHistoryMessageList((historyMessageList)=>{
470
+ let newHistoryMessageList = historyMessageList.concat({
471
+ roomId: roomId,
472
+ sender: mid,
473
+ recevier: "AI",
474
+ message: keyWord,
475
+ quotedMessage: citationContent.content,
476
+ id: "654321",
477
+ upvoted: false,
478
+ downvoted: false,
479
+ createdAt: getDataTime(-1),
480
+ extraInfo: JSON.stringify([])
481
+ });
482
+ return newHistoryMessageList;
489
483
  });
490
- return newHistoryMessageList;
491
- });
484
+ }
492
485
  setFinished(false);
493
486
  aiSendQuestions(3, {
494
487
  //相关数据
@@ -506,37 +499,36 @@ const CustomerService = (props)=>{
506
499
  };
507
500
  //向知识库发送问题 或答案 type:1 发送问题 2 接受答案
508
501
  const sendingExistingIssues = (type, obj, questions)=>{
509
- setHistoryMessageList((historyMessageList)=>{
510
- let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
511
- id: null,
512
- upvoted: false,
513
- downvoted: false,
514
- createdAt: getDataTime(-1),
515
- extraInfo: JSON.stringify(obj.extraInfos)
516
- }));
517
- return newHistoryMessageList;
518
- });
519
- scrollToBottom();
520
- http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj, {
521
- headers: {
522
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
523
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
524
- }
525
- }).then((res)=>{
502
+ if (pageNumHistory <= 1) {
503
+ setHistoryMessageList((historyMessageList)=>{
504
+ let newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
505
+ id: null,
506
+ upvoted: false,
507
+ downvoted: false,
508
+ createdAt: getDataTime(-1),
509
+ extraInfo: JSON.stringify(obj.extraInfos)
510
+ }));
511
+ return newHistoryMessageList;
512
+ });
513
+ scrollToBottom();
514
+ }
515
+ http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj).then((res)=>{
526
516
  if (res.data.id) {
527
- //更新聊天记录id
528
- setHistoryMessageList((historyMessageList)=>{
529
- let newHistoryMessageList = historyMessageList.map((item)=>{
530
- if (item.id == null) {
531
- return _object_spread_props(_object_spread({}, item), {
532
- id: res.data.id
533
- });
534
- } else {
535
- return item;
536
- }
517
+ if (pageNumHistory <= 1) {
518
+ //更新聊天记录id
519
+ setHistoryMessageList((historyMessageList)=>{
520
+ let newHistoryMessageList = historyMessageList.map((item)=>{
521
+ if (item.id == null) {
522
+ return _object_spread_props(_object_spread({}, item), {
523
+ id: res.data.id
524
+ });
525
+ } else {
526
+ return item;
527
+ }
528
+ });
529
+ return newHistoryMessageList;
537
530
  });
538
- return newHistoryMessageList;
539
- });
531
+ }
540
532
  }
541
533
  if (type == 1) {
542
534
  //发送答案,调用自动回答
@@ -552,34 +544,18 @@ const CustomerService = (props)=>{
552
544
  }
553
545
  ]
554
546
  };
555
- sendingExistingIssues(2, dataObj, '');
556
- testLabQuestion(obj.message, questions.answer, '');
547
+ sendingExistingIssues(2, dataObj, "");
548
+ testLabQuestion(obj.message, questions.answer, "");
557
549
  }
558
- }).then((res)=>{
559
- console.log(res);
560
550
  });
561
551
  };
562
552
  //向AI发送问题 type == 1 发送点赞或踩消息,type == 2 发送重新生成消息,type == 3 正常发送消息
563
- let content = ''; //用于实验报告的问题记录
553
+ let content = ""; //用于实验报告的问题记录
564
554
  const aiSendQuestions = (type, obj, id)=>{
565
- content = '';
566
- // if (type == 3) {
567
- // try {
568
- // if (ctrl && ctrl.current) {
569
- // ctrl.current.abort();
570
- // }
571
- // } catch (error) {}
572
- // clearTimeout(receiveMessageTimer.current);
573
- // setHistoryMessageList((historyMessageList) => {
574
- // return historyMessageList.filter((item) => item.id != "123456");
575
- // });
576
- // setFinished(true);
577
- // return;
578
- // }
555
+ content = "";
579
556
  ctrl.current = new AbortController();
580
557
  clearTimeout(receiveMessageTimer.current);
581
558
  receiveMessageTimer.current = setTimeout(()=>{
582
- // console.log('超时终止1111')
583
559
  setHistoryMessageList((historyMessageList)=>{
584
560
  return historyMessageList.filter((item)=>item.id != "123456" && item.id != "654321");
585
561
  });
@@ -615,39 +591,42 @@ const CustomerService = (props)=>{
615
591
  setTimeout(()=>{
616
592
  setQuestionsList([]);
617
593
  }, 2000);
594
+ // console.log(pageNumHistory,44444444444444);
618
595
  //占位信息
619
- setHistoryMessageList((historyMessageList)=>{
620
- if (type == 2) {
621
- return historyMessageList.map((item)=>{
622
- if (item.id == id) {
623
- return {
624
- roomId: roomId,
625
- sender: "AI",
626
- recevier: mid,
627
- message: "正在输入...",
628
- id: "123456",
629
- createdAt: getDataTime(-1),
630
- extraInfo: null
631
- };
632
- } else {
633
- return item;
634
- }
635
- });
636
- } else {
637
- return historyMessageList.concat({
638
- roomId: roomId,
639
- sender: "AI",
640
- recevier: mid,
641
- message: "正在输入...",
642
- id: "123456",
643
- createdAt: getDataTime(-1),
644
- extraInfo: null
645
- });
646
- }
647
- });
648
- setTimeout(()=>{
649
- scrollToBottom();
650
- }, 10);
596
+ if (pageNumHistory <= 1) {
597
+ setHistoryMessageList((historyMessageList)=>{
598
+ if (type == 2) {
599
+ return historyMessageList.map((item)=>{
600
+ if (item.id == id) {
601
+ return {
602
+ roomId: roomId,
603
+ sender: "AI",
604
+ recevier: mid,
605
+ message: "正在输入...",
606
+ id: "123456",
607
+ createdAt: getDataTime(-1),
608
+ extraInfo: null
609
+ };
610
+ } else {
611
+ return item;
612
+ }
613
+ });
614
+ } else {
615
+ return historyMessageList.concat({
616
+ roomId: roomId,
617
+ sender: "AI",
618
+ recevier: mid,
619
+ message: "正在输入...",
620
+ id: "123456",
621
+ createdAt: getDataTime(-1),
622
+ extraInfo: null
623
+ });
624
+ }
625
+ });
626
+ setTimeout(()=>{
627
+ scrollToBottom();
628
+ }, 10);
629
+ }
651
630
  //使用fetchEventSource接收数据
652
631
  const eventSource = fetchEventSource(`${urllocation}/chat-service/public/v1.0/chat-with-ai/messages`, {
653
632
  method: "POST",
@@ -656,7 +635,7 @@ const CustomerService = (props)=>{
656
635
  Accept: "text/event-stream,application/json",
657
636
  "X-Auth-Jwt": window.localStorage.getItem("usertoken") || "",
658
637
  "Auth-Token": userData.token,
659
- "X-Module-Id": userData.modules.find((ele)=>ele.short == "AIservice").id
638
+ "X-Module-Id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id
660
639
  },
661
640
  body: data,
662
641
  signal: ctrl.current.signal,
@@ -747,7 +726,7 @@ const CustomerService = (props)=>{
747
726
  }
748
727
  if (msg.finished) {
749
728
  setFinished(true); //发送结束
750
- testLabQuestion(JSON.parse(data).message, content, '');
729
+ testLabQuestion(JSON.parse(data).message, content, "");
751
730
  }
752
731
  },
753
732
  onclose () {
@@ -760,7 +739,9 @@ const CustomerService = (props)=>{
760
739
  };
761
740
  //渲染AI回答
762
741
  const renderAiAnswer = (msg, message_id, type)=>{
742
+ // console.log(pageNumHistory,5555555);
763
743
  // console.log(aiSendQuestions().abort(),'slkdsdsdsd')
744
+ if (pageNumHistory > 1) return;
764
745
  let obj = msg;
765
746
  let id = msg.messageId;
766
747
  setHistoryMessageList((historyMessageList)=>{
@@ -812,27 +793,22 @@ const CustomerService = (props)=>{
812
793
  return newHistoryMessageList2;
813
794
  }
814
795
  });
815
- setTimeout(()=>{
816
- scrollToBottom();
817
- }, 10);
796
+ // setTimeout(() => {
797
+ scrollToBottom();
798
+ // }, 10);
818
799
  };
819
800
  //问题记录到实验报告中
820
801
  const testLabQuestion = (title, content, teachId)=>{
821
802
  // console.log(title,content,'记录到实验报告中')
822
- if (stepIds != undefined && stepIds != '' && (showType == 3 || showType == 4)) {
803
+ if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
823
804
  http.post(`${urllocation}/sandboxes/public/v1.0/labquestion`, {
824
805
  title: title,
825
806
  content: content,
826
807
  teachId: teachId != undefined ? teachId : chatWith.uid | mid,
827
808
  stepId: stepId,
828
809
  stepIds: stepIds
829
- }, {
830
- headers: {
831
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
832
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
833
- }
834
810
  }).then(()=>{
835
- console.log(roomId, chatObj, 'roomIdroomIdroomIdroomId');
811
+ console.log(roomId, chatObj, "roomIdroomIdroomIdroomId");
836
812
  setChatObj((list1)=>{
837
813
  let list = list1.filter((e)=>e.roomId != roomId);
838
814
  return list;
@@ -844,11 +820,6 @@ const CustomerService = (props)=>{
844
820
  const speechToText = ()=>{
845
821
  http.post(`${urllocation}/chat-service/public/v1.0/speech:recognize`, {
846
822
  audio: bese64String
847
- }, {
848
- headers: {
849
- "x-module-id": userData.modules.find((ele)=>ele.short == "AIservice").id,
850
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
851
- }
852
823
  }).then((res)=>{
853
824
  setVoiceRecordingStatus(3);
854
825
  if (res.data) {
@@ -864,17 +835,12 @@ const CustomerService = (props)=>{
864
835
  const createRooms = (uid)=>{
865
836
  return http.post(`${urllocation}/chat-service/public/v1.0/rooms`, {
866
837
  chatWith: uid
867
- }, {
868
- headers: {
869
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
870
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
871
- }
872
838
  });
873
839
  };
874
840
  //获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
875
- const getHistoryMessage = (pageNum, flag, id = "1")=>{
841
+ const getHistoryMessage = (pageNum, flag, id = "1", raw_data = [])=>{
876
842
  clearTimeout(roomMessage.current);
877
- console.log(pageNum, flag, 'dkfjvndfjvndfkvdf');
843
+ // console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
878
844
  // flag == 1 时已经设置好了位置标记
879
845
  let last_id = "";
880
846
  if (flag == 2 && historyMessageList.length > 0) {
@@ -889,29 +855,29 @@ const CustomerService = (props)=>{
889
855
  }
890
856
  let rid = flag == 3 ? id : roomId;
891
857
  if (rid == "") return;
858
+ let page = pageNum ? pageNum : 1;
892
859
  return http.get(`${urllocation}/chat-service/public/v1.0/history-messages`, {
893
860
  params: {
894
861
  roomId: rid,
895
- page: pageNum ? pageNum : 1,
862
+ page: page,
896
863
  maxPageSize: 30,
897
864
  direction: "desc"
898
- },
899
- headers: {
900
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
901
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
902
865
  }
903
866
  }).then((res)=>{
904
867
  let totalNumber = 0;
905
- let roomList = [];
906
- setRoomList((list)=>{
907
- roomList = list;
908
- return list;
909
- });
868
+ let roomList = contactsList;
910
869
  if (res.data.messages.length > 0) {
911
870
  clearTimeout(listTimer.current);
912
871
  let total = res.data.total;
913
872
  let maxPageSize = 30;
914
873
  let dataList = res.data.messages.reverse();
874
+ //历史记录点击进来的,多加载一页,防止定位不准
875
+ if (flag == 1 && page > 1) {
876
+ let markPage = page - 1;
877
+ setPageNumHistory(markPage);
878
+ getHistoryMessage(page - 1, 5, '1', dataList);
879
+ return;
880
+ }
915
881
  setPageCount(Math.ceil(total / maxPageSize));
916
882
  let newHistoryMessageList = [];
917
883
  setHistoryMessageList((historyMessageList)=>{
@@ -920,6 +886,9 @@ const CustomerService = (props)=>{
920
886
  if (flag == 1) {
921
887
  newHistoryMessageList = dataList;
922
888
  }
889
+ if (flag == 5) {
890
+ newHistoryMessageList = raw_data.concat(dataList);
891
+ }
923
892
  if (flag == 4) {
924
893
  newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
925
894
  }
@@ -939,9 +908,10 @@ const CustomerService = (props)=>{
939
908
  totalNumber = newHistoryMessageList.length;
940
909
  return newHistoryMessageList;
941
910
  });
911
+ // console.log(lastId,'lastIdlastId-------')
942
912
  //如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
943
913
  try {
944
- if (stepIds != undefined && stepIds != '' && (showType == 3 || showType == 4)) {
914
+ if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
945
915
  fildChatRecords(newHistoryMessageList);
946
916
  }
947
917
  } catch (error) {}
@@ -973,8 +943,9 @@ const CustomerService = (props)=>{
973
943
  // console.log(roomList,rid,roomId,555555);
974
944
  //不是ai窗口循环查询消息
975
945
  let chatWindow = roomList.filter((item)=>item.roomId == rid);
976
- let isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == 'AI' ? true : false;
946
+ let isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
977
947
  if (!isAiChatWindow && roomList.length > 0 && (pageNum == 1 || pageNumHistory == 0)) {
948
+ //&& pageNum == 1
978
949
  getRoomidHistoryMessage(totalNumber, rid);
979
950
  }
980
951
  }).catch((res)=>{
@@ -987,18 +958,14 @@ const CustomerService = (props)=>{
987
958
  roomMessage.current = setTimeout(()=>{
988
959
  getRoomidHistoryMessage(totalNumber, rid);
989
960
  }, 5000);
990
- if (rid == '') return;
961
+ if (rid == "") return;
991
962
  // console.log(roomList,2222222);
992
963
  return http.get(`${urllocation}/chat-service/public/v1.0/history-messages`, {
993
964
  params: {
994
965
  roomId: rid,
995
966
  page: 1,
996
- maxPageSize: totalNumber,
967
+ maxPageSize: totalNumber == 0 ? 30 : totalNumber,
997
968
  direction: "desc"
998
- },
999
- headers: {
1000
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
1001
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1002
969
  }
1003
970
  }).then((res)=>{
1004
971
  let newHistoryMessageList = [];
@@ -1015,7 +982,7 @@ const CustomerService = (props)=>{
1015
982
  newList = newHistoryMessageList.length;
1016
983
  return newHistoryMessageList;
1017
984
  });
1018
- console.log(dataList.length, originList, lastId, 'dfkvdnfkvdfj44444');
985
+ // console.log(dataList.length , originList,lastId,'dfkvdnfkvdfj44444');
1019
986
  if (!lastId && originList != newList) {
1020
987
  setTimeout(()=>{
1021
988
  scrollToBottom();
@@ -1023,7 +990,7 @@ const CustomerService = (props)=>{
1023
990
  }
1024
991
  }
1025
992
  try {
1026
- if (stepIds != undefined && stepIds != '' && (showType == 3 || showType == 4)) {
993
+ if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
1027
994
  fildChatRecords(newHistoryMessageList);
1028
995
  }
1029
996
  } catch (error) {}
@@ -1046,7 +1013,7 @@ const CustomerService = (props)=>{
1046
1013
  if (room.length > 0) {
1047
1014
  // console.log(room,'dfvdfvdfvdfv')
1048
1015
  let chatID = room[0].id;
1049
- console.log(chatID, 'chatIDchatIDchatID');
1016
+ console.log(chatID, "chatIDchatIDchatID");
1050
1017
  let index = -1;
1051
1018
  newHistoryMessageList.forEach((item, i)=>{
1052
1019
  // console.log(item,item.id,'lskdcmsldksdcsdc')
@@ -1058,11 +1025,10 @@ const CustomerService = (props)=>{
1058
1025
  //有新的消息
1059
1026
  if (index != -1) {
1060
1027
  let newMessage = newHistoryMessageList.slice(index);
1061
- console.log(newMessage, 'newMessagenewMessage');
1028
+ console.log(newMessage, "newMessagenewMessage");
1062
1029
  let result = [];
1063
1030
  newMessage.forEach((item, index)=>{
1064
- let isQuestion = item.receiver !== mid //是否为问题
1065
- ;
1031
+ let isQuestion = item.receiver !== mid; //是否为问题
1066
1032
  if (isQuestion) {
1067
1033
  //问题
1068
1034
  if (newMessage[index + 1] && newMessage[index + 1].receiver === mid) {
@@ -1075,7 +1041,7 @@ const CustomerService = (props)=>{
1075
1041
  }
1076
1042
  }
1077
1043
  });
1078
- console.log(result, '存储的消息');
1044
+ console.log(result, "存储的消息");
1079
1045
  result.map((item)=>{
1080
1046
  testLabQuestion(item.question, item.answer, String(item.id));
1081
1047
  });
@@ -1094,11 +1060,6 @@ const CustomerService = (props)=>{
1094
1060
  }
1095
1061
  http.post(url, {
1096
1062
  messageId: id
1097
- }, {
1098
- headers: {
1099
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
1100
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1101
- }
1102
1063
  }).then((res)=>{
1103
1064
  setHistoryMessageList((historyMessageList)=>{
1104
1065
  let list = historyMessageList;
@@ -1123,11 +1084,6 @@ const CustomerService = (props)=>{
1123
1084
  }
1124
1085
  http.post(url, {
1125
1086
  messageId: id
1126
- }, {
1127
- headers: {
1128
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
1129
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1130
- }
1131
1087
  }).then((res)=>{
1132
1088
  setHistoryMessageList((historyMessageList)=>{
1133
1089
  let list = historyMessageList;
@@ -1157,11 +1113,7 @@ const CustomerService = (props)=>{
1157
1113
  };
1158
1114
  }
1159
1115
  http.get(`${urllocation}/chat-service/public/v1.0/knowledge-base/questions`, {
1160
- params: data,
1161
- headers: {
1162
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
1163
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1164
- }
1116
+ params: data
1165
1117
  }).then((res)=>{
1166
1118
  if (res.data.questions) {
1167
1119
  if (flag == 1) {
@@ -1177,10 +1129,6 @@ const CustomerService = (props)=>{
1177
1129
  http.get(`${urllocation}/chat-service/public/v1.0/teachers`, {
1178
1130
  params: {
1179
1131
  name: keyWord
1180
- },
1181
- headers: {
1182
- "x-module-id": userData.modules.find((ele)=>ele.short == "TeacherAnswer").id,
1183
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
1184
1132
  }
1185
1133
  }).then((res)=>{
1186
1134
  console.log(res);
@@ -1189,6 +1137,82 @@ const CustomerService = (props)=>{
1189
1137
  }
1190
1138
  });
1191
1139
  };
1140
+ //获取聊天室列表
1141
+ const roomsListTimer = ()=>{
1142
+ if (chatRoomList != null) clearTimeout(chatRoomList.current);
1143
+ chatRoomList.current = setTimeout(()=>roomsListTimer(), 60000);
1144
+ http.get(`${urllocation}/chat-service/public/v1.0/rooms`, {
1145
+ params: {
1146
+ page: 1,
1147
+ maxPageSize: 100002
1148
+ }
1149
+ }).then((res)=>{
1150
+ if (res.data) {
1151
+ let list = res.data.contacts;
1152
+ setContactsList((list1)=>{
1153
+ list = list.map((item, index)=>{
1154
+ let c_list = list1.filter((e)=>e.sender == item.sender);
1155
+ let obj = {};
1156
+ if (c_list.length > 0) {
1157
+ obj = c_list[0];
1158
+ }
1159
+ return _object_spread({}, obj, item);
1160
+ });
1161
+ return list;
1162
+ });
1163
+ getUserInfo(list);
1164
+ }
1165
+ });
1166
+ };
1167
+ //获取老师的信息等
1168
+ const getUserInfo = (list)=>{
1169
+ let getUserid = [];
1170
+ //查找需要用户名和头像的
1171
+ list.map((item, i)=>{
1172
+ if (!item.name && !item.headImg && item.sender != "AI") {
1173
+ getUserid.push(item.sender);
1174
+ }
1175
+ });
1176
+ if (getUserid.length > 0) {
1177
+ getUserName(getUserid.join(",")).then((res)=>{
1178
+ if (res.data) {
1179
+ let nameList = res.data;
1180
+ // console.log(nameList,contactsList,'kdsjnvjdkvdfj')
1181
+ setContactsList((contactsList)=>{
1182
+ list = list.map((item, index)=>{
1183
+ let name = nameList.filter((v)=>v.uid == item.sender);
1184
+ if (name.length > 0) {
1185
+ return _object_spread({}, item, name[0]);
1186
+ } else {
1187
+ return item;
1188
+ }
1189
+ });
1190
+ return list;
1191
+ });
1192
+ }
1193
+ });
1194
+ } else {
1195
+ setContactsList((contactsList)=>{
1196
+ list = list.map((item, index)=>{
1197
+ let c_list = contactsList.filter((e)=>e.sender == item.sender);
1198
+ let obj = {};
1199
+ if (c_list.length > 0) {
1200
+ obj = c_list[0];
1201
+ }
1202
+ return _object_spread({}, obj, item);
1203
+ });
1204
+ return list;
1205
+ });
1206
+ }
1207
+ };
1208
+ //获取老师用户名
1209
+ const getUserName = (uid)=>{
1210
+ return http.get(`${urllocation}/chat-service/public/v1.0/userinfo`, {
1211
+ params: {
1212
+ uid: uid
1213
+ }
1214
+ });
1215
+ };
1192
1216
  //设置滚动条滚动到底部
1193
1217
  const scrollToBottom = ()=>{
1194
1218
  const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
@@ -1204,10 +1228,16 @@ const CustomerService = (props)=>{
1204
1228
  try {
1205
1229
  setTimeout(()=>{
1206
1230
  let top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
1231
+ // let top =
1232
+ // showType == 1 || showType == 3
1233
+ // ? $("#li_flag").offset().top
1234
+ // : $("#chat_content_modal #li_flag").offset().top -
1235
+ // $("#chat_content_modal").offset().top;
1236
+ // console.log(top2,top,444444444444)
1207
1237
  $(`#${showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal"}`).animate({
1208
1238
  scrollTop: top
1209
1239
  }, 0);
1210
- }, 10);
1240
+ }, 100);
1211
1241
  } catch (error) {}
1212
1242
  setLoading(false);
1213
1243
  }
@@ -1227,17 +1257,32 @@ const CustomerService = (props)=>{
1227
1257
  });
1228
1258
  });
1229
1259
  };
1230
- //渲染头部
1231
- const renderHeader = ()=>{
1232
- let list = roomList.filter((e)=>e.roomId == roomId);
1233
- let title = '智能问答';
1234
- if (list.length > 0 && list[0].name) {
1235
- title = list[0].name;
1236
- }
1260
+ //显示未读消息
1261
+ const showUnreadMessage = ()=>{
1237
1262
  let count = 0;
1238
- roomList.map((item)=>{
1263
+ contactsList.map((item)=>{
1239
1264
  count = count + item.unreadCount;
1240
1265
  });
1266
+ if (count > 0) {
1267
+ return /*#__PURE__*/ _jsx("span", {
1268
+ className: styles.count,
1269
+ children: count > 99 ? "99+" : count
1270
+ });
1271
+ } else {
1272
+ return "";
1273
+ }
1274
+ };
1275
+ //显示聊天室名字
1276
+ const showChatRoomName = ()=>{
1277
+ let title = "AI助手";
1278
+ let list = contactsList.filter((e)=>e.roomId == roomId);
1279
+ if (list.length > 0 && list[0].name) {
1280
+ title = list[0].name;
1281
+ }
1282
+ return title;
1283
+ };
1284
+ //渲染头部
1285
+ const renderHeader = ()=>{
1241
1286
  if (showType == 4) {
1242
1287
  return /*#__PURE__*/ _jsxs("div", {
1243
1288
  className: styles.top,
@@ -1245,7 +1290,7 @@ const CustomerService = (props)=>{
1245
1290
  /*#__PURE__*/ _jsx("div", {
1246
1291
  className: styles.user,
1247
1292
  children: /*#__PURE__*/ _jsx("p", {
1248
- children: title
1293
+ children: showChatRoomName()
1249
1294
  })
1250
1295
  }),
1251
1296
  /*#__PURE__*/ _jsxs("div", {
@@ -1296,13 +1341,10 @@ const CustomerService = (props)=>{
1296
1341
  },
1297
1342
  children: [
1298
1343
  /*#__PURE__*/ _jsx(CustomContacts, {}),
1299
- count > 0 ? /*#__PURE__*/ _jsx("span", {
1300
- className: styles.count,
1301
- children: count > 99 ? '99+' : count
1302
- }) : ''
1344
+ showUnreadMessage()
1303
1345
  ]
1304
1346
  }),
1305
- title
1347
+ showChatRoomName()
1306
1348
  ]
1307
1349
  })
1308
1350
  }),
@@ -1325,7 +1367,13 @@ const CustomerService = (props)=>{
1325
1367
  onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
1326
1368
  // switchDialogBox(3, true);
1327
1369
  setShowType(2);
1328
- childRef.current.roomsListTimer();
1370
+ setTimeout(()=>{
1371
+ setKeyWord(" ");
1372
+ }, 100);
1373
+ setTimeout(()=>{
1374
+ setKeyWord("");
1375
+ }, 300);
1376
+ // childRef.current.roomsListTimer();
1329
1377
  },
1330
1378
  children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
1331
1379
  }) : /*#__PURE__*/ _jsx("i", {
@@ -1350,7 +1398,7 @@ const CustomerService = (props)=>{
1350
1398
  const resettingBottomHei = ()=>{
1351
1399
  setTimeout(()=>{
1352
1400
  if (showType == 1 || showType == 3) {
1353
- if (document.getElementById("Drawer_buttom_modal")) {
1401
+ if (document.getElementById("Drawer_buttom")) {
1354
1402
  let hei = document.getElementById("Drawer_buttom").offsetHeight;
1355
1403
  setButtomHei(hei);
1356
1404
  }
@@ -1364,28 +1412,48 @@ const CustomerService = (props)=>{
1364
1412
  };
1365
1413
  //切换聊天室 type == renew ,存在新消息
1366
1414
  const switchChatRoom = (id, type)=>{
1367
- setLastId("");
1368
- setPageNum(1);
1369
- setPageCount(0);
1370
- setRoomId(id);
1371
- //
1372
- // if (type == "renew") {
1373
- // getHistoryMessage(1, 3,id);
1374
- // }else{
1375
- // setRoomId(id);
1376
- // }
1377
- readMessage(id, urllocation, userData, http);
1378
- };
1379
- const saveContactsList = (list)=>{
1380
- if (list != undefined) {
1381
- setRoomList(list);
1415
+ if (type != "1") {
1416
+ readMessage(id, urllocation, userData, http);
1417
+ setLastId("");
1418
+ setPageNum(1);
1419
+ setPageCount(0);
1420
+ setRoomId(id);
1421
+ try {
1422
+ if (ctrl && ctrl.current) {
1423
+ ctrl.current.abort();
1424
+ }
1425
+ setFinished(true);
1426
+ } catch (error) {}
1427
+ setTimeout(()=>{
1428
+ roomsListTimer();
1429
+ }, 500);
1382
1430
  }
1431
+ //删除聊天室
1432
+ if (type == "1") {
1433
+ if (id == roomId) {
1434
+ // console.log(contactsList,888888);
1435
+ switchChatRoom(contactsList[0].roomId, '');
1436
+ }
1437
+ setContactsList((list)=>{
1438
+ let newList = list;
1439
+ newList = newList.filter((v)=>v.roomId != id);
1440
+ return newList;
1441
+ });
1442
+ }
1443
+ // if (type == "renew") {
1444
+ // getHistoryMessage(1, 3,id);
1445
+ // }else{
1446
+ // setRoomId(id);
1447
+ // }
1383
1448
  };
1449
+ // const saveContactsList = (list: any)=>{
1450
+ // console.log(list,44444444)
1451
+ // // if(list != undefined){
1452
+ // // setRoomList(list);
1453
+ // // }
1454
+ // }
1384
1455
  //渲染问答
1385
1456
  const renderQuestion = ()=>{
1386
- // 2023-12-01T14:34:07
1387
- // console.log(lastId,'lastIdlastIdlastId')
1388
- // console.log(mid, historyMessageList, "ddkfdscksdcs");
1389
1457
  if (historyMessageList.length > 0) {
1390
1458
  return /*#__PURE__*/ _jsx("ul", {
1391
1459
  className: styles.message_con,
@@ -1434,56 +1502,61 @@ const CustomerService = (props)=>{
1434
1502
  children: /*#__PURE__*/ _jsxs("div", {
1435
1503
  className: styles.main_content,
1436
1504
  children: [
1437
- /*#__PURE__*/ _jsx("div", {
1438
- className: styles.operate_modal,
1439
- children: /*#__PURE__*/ _jsxs("p", {
1440
- className: styles.operate,
1441
- children: [
1442
- /*#__PURE__*/ _jsx("i", {
1443
- className: "yinyong_quote1",
1444
- onClick: ()=>{
1445
- setCitationContent({
1446
- content: item.message,
1447
- id: item.id
1448
- });
1449
- resettingBottomHei();
1450
- onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
1451
- },
1452
- children: /*#__PURE__*/ _jsx(CustomQuote, {})
1453
- }),
1454
- copyTextOBJ.length > 0 && copyTextOBJ.some((list)=>list == item.id) ? /*#__PURE__*/ _jsx("i", {
1455
- className: `tongyong-xuanzhongdui`,
1456
- children: /*#__PURE__*/ _jsx(CustomDuihao, {})
1457
- }) : /*#__PURE__*/ _jsx("i", {
1458
- className: "fuzhi21",
1459
- onClick: ()=>{
1460
- let bol = copyText(item.message);
1461
- if (bol) {
1462
- let obj = copyTextOBJ;
1463
- obj = obj.filter((list)=>list != item.id);
1464
- obj.push(item.id);
1465
- setCopyTextObj(obj);
1466
- }
1467
- setTimeout(()=>{
1468
- let obj = copyTextOBJ;
1469
- obj = obj.filter((list)=>list != item.id);
1470
- setCopyTextObj(obj);
1471
- }, 3000);
1472
- onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
1505
+ /*#__PURE__*/ _jsxs("div", {
1506
+ className: styles.main_content_flag,
1507
+ children: [
1508
+ /*#__PURE__*/ _jsx("div", {
1509
+ className: styles.operate_modal,
1510
+ children: /*#__PURE__*/ _jsxs("p", {
1511
+ className: styles.operate,
1512
+ children: [
1513
+ /*#__PURE__*/ _jsx("i", {
1514
+ className: "yinyong_quote1",
1515
+ onClick: ()=>{
1516
+ setCitationContent({
1517
+ content: item.message,
1518
+ id: item.id
1519
+ });
1520
+ resettingBottomHei();
1521
+ onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
1522
+ },
1523
+ children: /*#__PURE__*/ _jsx(CustomQuote, {})
1524
+ }),
1525
+ copyTextOBJ.length > 0 && copyTextOBJ.some((list)=>list == item.id) ? /*#__PURE__*/ _jsx("i", {
1526
+ className: `tongyong-xuanzhongdui`,
1527
+ children: /*#__PURE__*/ _jsx(CustomDuihao, {})
1528
+ }) : /*#__PURE__*/ _jsx("i", {
1529
+ className: "fuzhi21",
1530
+ onClick: ()=>{
1531
+ let bol = copyText(item.message);
1532
+ if (bol) {
1533
+ let obj = copyTextOBJ;
1534
+ obj = obj.filter((list)=>list != item.id);
1535
+ obj.push(item.id);
1536
+ setCopyTextObj(obj);
1537
+ }
1538
+ setTimeout(()=>{
1539
+ let obj = copyTextOBJ;
1540
+ obj = obj.filter((list)=>list != item.id);
1541
+ setCopyTextObj(obj);
1542
+ }, 3000);
1543
+ onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
1544
+ },
1545
+ children: /*#__PURE__*/ _jsx(CustomCopy, {})
1546
+ })
1547
+ ]
1548
+ })
1549
+ }),
1550
+ /*#__PURE__*/ _jsx("div", {
1551
+ className: styles.content,
1552
+ children: /*#__PURE__*/ _jsx("p", {
1553
+ dangerouslySetInnerHTML: {
1554
+ __html: remarkable.render(message)
1473
1555
  },
1474
- children: /*#__PURE__*/ _jsx(CustomCopy, {})
1556
+ className: styles.content_child
1475
1557
  })
1476
- ]
1477
- })
1478
- }),
1479
- /*#__PURE__*/ _jsx("div", {
1480
- className: styles.content,
1481
- children: /*#__PURE__*/ _jsx("p", {
1482
- dangerouslySetInnerHTML: {
1483
- __html: remarkable.render(message)
1484
- },
1485
- className: styles.content_child
1486
- })
1558
+ })
1559
+ ]
1487
1560
  }),
1488
1561
  //引用消息
1489
1562
  item.quotedMessage && /*#__PURE__*/ _jsx("div", {
@@ -1521,13 +1594,16 @@ const CustomerService = (props)=>{
1521
1594
  });
1522
1595
  } else {
1523
1596
  //获取用户头像
1524
- let headImg = '';
1525
- let chatWindow = roomList.filter((item)=>item.roomId == roomId);
1526
- if (chatWindow.length > 0 && chatWindow[0].headImg != '') {
1597
+ let headImg = "";
1598
+ let chatWindow = [];
1599
+ let isAiChatWindow;
1600
+ chatWindow = contactsList.filter((item)=>item.roomId == roomId);
1601
+ if (chatWindow.length > 0 && chatWindow[0].headImg != "") {
1527
1602
  headImg = chatWindow[0].headImg;
1528
1603
  }
1604
+ // console.log(chatWindow,'chatWindowchatWindow')
1529
1605
  //是否在智能客服窗口
1530
- let isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == 'AI' ? true : false;
1606
+ isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
1531
1607
  let header = 2; //代表是ai头像
1532
1608
  if (isAiChatWindow && item.extraInfo != undefined && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
1533
1609
  //使用AI头像
@@ -1559,34 +1635,39 @@ const CustomerService = (props)=>{
1559
1635
  children: /*#__PURE__*/ _jsxs("div", {
1560
1636
  className: styles.main_content,
1561
1637
  children: [
1562
- /*#__PURE__*/ _jsx("div", {
1563
- className: styles.operate_modal,
1564
- children: // 不是最后一行,
1565
- historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
1566
- }),
1567
1638
  /*#__PURE__*/ _jsxs("div", {
1568
- className: styles.content,
1639
+ className: styles.main_content_flag,
1569
1640
  children: [
1570
- /*#__PURE__*/ _jsx("p", {
1571
- dangerouslySetInnerHTML: {
1572
- __html: remarkable.render(message)
1573
- },
1574
- className: styles.content_child
1641
+ /*#__PURE__*/ _jsx("div", {
1642
+ className: styles.operate_modal,
1643
+ children: // 不是最后一行,
1644
+ historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
1575
1645
  }),
1576
- 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", {
1577
- className: styles.association_problem,
1578
- children: JSON.parse(item.extraInfo).map((list, index)=>{
1579
- return /*#__PURE__*/ _jsxs("li", {
1580
- onClick: ()=>{
1581
- sendMessage(list, 1);
1646
+ /*#__PURE__*/ _jsxs("div", {
1647
+ className: styles.content,
1648
+ children: [
1649
+ /*#__PURE__*/ _jsx("p", {
1650
+ dangerouslySetInnerHTML: {
1651
+ __html: remarkable.render(message)
1582
1652
  },
1583
- children: [
1584
- index + 1,
1585
- ".",
1586
- list.question
1587
- ]
1588
- }, i + "_" + index + "_" + list.value);
1589
- })
1653
+ className: styles.content_child
1654
+ }),
1655
+ 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", {
1656
+ className: styles.association_problem,
1657
+ children: JSON.parse(item.extraInfo).map((list, index)=>{
1658
+ return /*#__PURE__*/ _jsxs("li", {
1659
+ onClick: ()=>{
1660
+ sendMessage(list, 1);
1661
+ },
1662
+ children: [
1663
+ index + 1,
1664
+ ".",
1665
+ list.question
1666
+ ]
1667
+ }, i + "_" + index + "_" + list.value);
1668
+ })
1669
+ })
1670
+ ]
1590
1671
  })
1591
1672
  ]
1592
1673
  }),
@@ -1612,7 +1693,7 @@ const CustomerService = (props)=>{
1612
1693
  !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && renderLastOperateBtn(item, isAiChatWindow, i),
1613
1694
  //召唤老师回答按钮
1614
1695
  isAiChatWindow && item.findTeacher && userData.modules.some((item)=>item.short == "TeacherAnswer") ? /*#__PURE__*/ _jsx("div", {
1615
- className: `${styles.operate_modal_bottom}`,
1696
+ className: `${styles.operate_modal_bottom} `,
1616
1697
  children: /*#__PURE__*/ _jsx("p", {
1617
1698
  className: styles.stop_findTeacher,
1618
1699
  children: /*#__PURE__*/ _jsx("span", {
@@ -1626,7 +1707,7 @@ const CustomerService = (props)=>{
1626
1707
  children: "停止召唤老师"
1627
1708
  })
1628
1709
  })
1629
- }) : ''
1710
+ }) : ""
1630
1711
  ]
1631
1712
  })
1632
1713
  })
@@ -1647,8 +1728,8 @@ const CustomerService = (props)=>{
1647
1728
  //问候语及点赞下面不需要展示相关按钮
1648
1729
  let extraInfo = item.extraInfo;
1649
1730
  //JSON.parse(extraInfo)[0].key == 'questionId' 是联想问题
1650
- if (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == 'messageSource' || extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == 'isVoteMessage') {
1651
- return '';
1731
+ if (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
1732
+ return "";
1652
1733
  }
1653
1734
  return /*#__PURE__*/ _jsxs("p", {
1654
1735
  className: styles.operate,
@@ -1777,30 +1858,34 @@ const CustomerService = (props)=>{
1777
1858
  };
1778
1859
  //渲染最后一条的操作按钮
1779
1860
  const renderLastOperateBtn = (item, isAiChatWindow, i)=>{
1780
- {}
1861
+ {
1862
+ /* 停止生成按钮 最后一次生成答案的支持点击 */ }
1781
1863
  //问候语及点赞下面不需要展示相关按钮
1782
1864
  let extraInfo = item.extraInfo;
1783
1865
  //JSON.parse(extraInfo)[0].key == 'questionId' 是联想问题
1784
- if (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == 'messageSource' || extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == 'isVoteMessage') {
1785
- return '';
1866
+ if (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
1867
+ return "";
1786
1868
  }
1787
1869
  //1、是否显示停止生成按钮 finished 是否生产完成
1788
1870
  let showStopBtn = false;
1789
- if (!finished && item.sender == 'AI' && item.extraInfo == null) {
1871
+ if (!finished && item.sender == "AI" && item.extraInfo == null) {
1790
1872
  showStopBtn = true;
1791
1873
  }
1792
1874
  //2、是否展示重新生成按钮
1793
1875
  let regenerationBtn = false;
1794
- if (finished && item.sender == 'AI' && item.extraInfo == null) {
1876
+ if (finished && item.sender == "AI" && item.extraInfo == null) {
1795
1877
  regenerationBtn = true;
1796
1878
  }
1797
1879
  //3、是否显示召唤老师回答按钮
1798
1880
  let findTeacherBtn = false;
1799
- if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == 'questionId' || extraInfo == null)) {
1881
+ if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
1800
1882
  findTeacherBtn = true;
1801
1883
  }
1802
1884
  return /*#__PURE__*/ _jsxs("div", {
1803
1885
  className: `${styles.operate_modal_bottom}`,
1886
+ style: {
1887
+ position: showStopBtn ? 'sticky' : 'relative'
1888
+ },
1804
1889
  children: [
1805
1890
  /*#__PURE__*/ _jsxs("p", {
1806
1891
  className: styles.stop_generate,
@@ -1851,8 +1936,6 @@ const CustomerService = (props)=>{
1851
1936
  question: historyMessageList[i - 1].message,
1852
1937
  user: problem.user
1853
1938
  });
1854
- console.log(item, '88888999999');
1855
- // if(item.extraInfo == null){
1856
1939
  setHistoryMessageList((historyMessageList)=>{
1857
1940
  let newHistoryMessageList = historyMessageList.concat({
1858
1941
  id: -1,
@@ -1871,30 +1954,6 @@ const CustomerService = (props)=>{
1871
1954
  });
1872
1955
  return newHistoryMessageList;
1873
1956
  });
1874
- // }else{
1875
- // setHistoryMessageList(
1876
- // (historyMessageList) => {
1877
- // let newHistoryMessageList =
1878
- // historyMessageList.concat({
1879
- // id: -1,
1880
- // roomId: roomId,
1881
- // sender: "AI",
1882
- // recevier: mid,
1883
- // message:
1884
- // "请告诉我您要召唤的老师名字",
1885
- // createdAt: getDataTime(-1),
1886
- // findTeacher:true,
1887
- // extraInfo: JSON.stringify([
1888
- // {
1889
- // key: "questionId",
1890
- // value: "questionId",
1891
- // },
1892
- // ])
1893
- // });
1894
- // return newHistoryMessageList;
1895
- // }
1896
- // );
1897
- // }
1898
1957
  setTimeout(()=>{
1899
1958
  scrollToBottom();
1900
1959
  }, 200);
@@ -2057,6 +2116,7 @@ const CustomerService = (props)=>{
2057
2116
  if (answerMode == 1) {
2058
2117
  getTeacherList(String(e.target.value));
2059
2118
  } else {
2119
+ let roomList = contactsList;
2060
2120
  if (roomList.length > 0 && roomList[0].roomId != roomId) return;
2061
2121
  getQuestiionsList(String(e.target.value), 2);
2062
2122
  }
@@ -2070,13 +2130,31 @@ const CustomerService = (props)=>{
2070
2130
  e.stopPropagation();
2071
2131
  e.preventDefault();
2072
2132
  clearTimeout(timer.current);
2073
- setKeyWord('');
2133
+ setKeyWord("");
2074
2134
  setCitationContent({});
2135
+ //查找是否是召唤老师回答并有相应的老师名称
2136
+ if (answerMode == 1 && teacherList.length > 0) {
2137
+ let list = teacherList.filter((v)=>v.name == keyWord.trim());
2138
+ if (list.length > 0) {
2139
+ //直接进入召唤老师回答模式
2140
+ enterTeacherChat(list[0]);
2141
+ setButtomHei(45);
2142
+ return;
2143
+ }
2144
+ }
2075
2145
  //跟老师对话
2146
+ let roomList = contactsList;
2076
2147
  if (roomList.length > 0 && roomList[0].roomId != roomId) {
2077
2148
  sendToTeacher(2);
2078
2149
  } else {
2079
- sendMessage('', 0);
2150
+ clearTimeout(timer.current);
2151
+ setQuestionsList([]);
2152
+ setAnswerMode(-1);
2153
+ setTeacherList([]);
2154
+ setHistoryMessageList((historyMessageList)=>{
2155
+ return historyMessageList.filter((item)=>item.id != "-1");
2156
+ });
2157
+ sendMessage("", 0);
2080
2158
  }
2081
2159
  setButtomHei(45);
2082
2160
  } else {
@@ -2115,7 +2193,7 @@ const CustomerService = (props)=>{
2115
2193
  className: styles.voice,
2116
2194
  children: [
2117
2195
  voiceRecordingStatus == 1 || voiceRecordingStatus == 3 ? /*#__PURE__*/ _jsx("i", {
2118
- className: `${!disabled ? styles.disabled : ''}`,
2196
+ className: `${!disabled ? styles.disabled : ""}`,
2119
2197
  onClick: ()=>{
2120
2198
  //开始录音
2121
2199
  if (!disabled) return;
@@ -2150,18 +2228,36 @@ const CustomerService = (props)=>{
2150
2228
  /*#__PURE__*/ _jsx("p", {
2151
2229
  className: `${styles.sending}`,
2152
2230
  children: /*#__PURE__*/ _jsx("i", {
2153
- className: `${!disabled || keyWord.trim() == '' ? styles.disabled : ''}`,
2231
+ className: `${!disabled || keyWord.trim() == "" ? styles.disabled : ""}`,
2154
2232
  onClick: ()=>{
2155
2233
  if (!disabled) return;
2156
2234
  setCitationContent({});
2157
2235
  setButtomHei(45);
2158
2236
  if (keyWord.trim() != "") {
2159
- setKeyWord('');
2237
+ //查找是否是召唤老师回答并有相应的老师名称
2238
+ if (answerMode == 1 && teacherList.length > 0) {
2239
+ let list = teacherList.filter((v)=>v.name == keyWord.trim());
2240
+ if (list.length > 0) {
2241
+ //直接进入召唤老师回答模式
2242
+ enterTeacherChat(list[0]);
2243
+ setButtomHei(45);
2244
+ return;
2245
+ }
2246
+ }
2247
+ setKeyWord("");
2160
2248
  //跟老师对话
2249
+ let roomList = contactsList;
2161
2250
  if (roomList.length > 0 && roomList[0].roomId != roomId) {
2162
2251
  sendToTeacher(2);
2163
2252
  } else {
2164
- sendMessage('', 0);
2253
+ clearTimeout(timer.current);
2254
+ setQuestionsList([]);
2255
+ setAnswerMode(-1);
2256
+ setTeacherList([]);
2257
+ setHistoryMessageList((historyMessageList)=>{
2258
+ return historyMessageList.filter((item)=>item.id != "-1");
2259
+ });
2260
+ sendMessage("", 0);
2165
2261
  }
2166
2262
  onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
2167
2263
  }
@@ -2172,6 +2268,32 @@ const CustomerService = (props)=>{
2172
2268
  ]
2173
2269
  });
2174
2270
  };
2271
+ //进入与老师的聊天
2272
+ const enterTeacherChat = (item)=>{
2273
+ setTeacherList([]);
2274
+ //提问的问题
2275
+ setProblem({
2276
+ question: problem.question,
2277
+ user: item.uid
2278
+ });
2279
+ setKeyWord("");
2280
+ //setUpdateRecords(true);
2281
+ setAnswerMode(-1);
2282
+ setChatWith(item);
2283
+ let roomList = contactsList;
2284
+ let list = roomList.filter((e)=>e.sender == item.uid);
2285
+ setShowContacts(true);
2286
+ if (list.length > 0) {
2287
+ setRoomId(list[0].roomId); //已有聊天室
2288
+ } else {
2289
+ createRooms(item.uid).then((res)=>{
2290
+ // childRef.current.roomsListTimer();
2291
+ roomsListTimer();
2292
+ let id = res.data.id;
2293
+ setRoomId(id); //新的聊天室id
2294
+ });
2295
+ }
2296
+ };
2175
2297
  //渲染联想问题及联想的老师名称
2176
2298
  const renderAssociationProblem = ()=>{
2177
2299
  if (answerMode == 1) {
@@ -2181,33 +2303,24 @@ const CustomerService = (props)=>{
2181
2303
  bottom: `${buttomHei + 14}px`
2182
2304
  },
2183
2305
  children: teacherList.map((item)=>{
2184
- let span = item.name.replaceAll(keyWord, ()=>{
2185
- return `<span class=${styles.sign}>${keyWord}</span>`;
2186
- });
2306
+ let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2307
+ let span = '';
2308
+ //搜索内容是否有特殊字符
2309
+ if (reg.test(keyWord)) {
2310
+ span = item.name.replaceAll(keyWord, (e)=>{
2311
+ return `<span class=${styles.sign}>${e}</span>`;
2312
+ });
2313
+ } else {
2314
+ span = item.name.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
2315
+ // console.log(i,'skdcnsdjk')
2316
+ return `<span class=${styles.sign}>${i}</span>`;
2317
+ });
2318
+ }
2187
2319
  return /*#__PURE__*/ _jsx("p", {
2188
2320
  className: styles.item,
2189
2321
  children: /*#__PURE__*/ _jsx("span", {
2190
2322
  onClick: ()=>{
2191
- setTeacherList([]);
2192
- //提问的问题
2193
- setProblem({
2194
- question: problem.question,
2195
- user: item.uid
2196
- });
2197
- setKeyWord("");
2198
- //setUpdateRecords(true);
2199
- setAnswerMode(-1);
2200
- setChatWith(item);
2201
- let list = roomList.filter((e)=>e.sender == item.uid);
2202
- if (list.length > 0) {
2203
- setRoomId(list[0].roomId); //已有聊天室
2204
- } else {
2205
- createRooms(item.uid).then((res)=>{
2206
- childRef.current.roomsListTimer();
2207
- let id = res.data.id;
2208
- setRoomId(id); //新的聊天室id
2209
- });
2210
- }
2323
+ enterTeacherChat(item);
2211
2324
  },
2212
2325
  dangerouslySetInnerHTML: {
2213
2326
  __html: span
@@ -2223,9 +2336,19 @@ const CustomerService = (props)=>{
2223
2336
  bottom: `${buttomHei + 6}px`
2224
2337
  },
2225
2338
  children: questionsList.map((item)=>{
2226
- let span = item.question.replaceAll(keyWord, ()=>{
2227
- return `<span class=${styles.sign}>${keyWord}</span>`;
2228
- });
2339
+ let reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2340
+ let span = '';
2341
+ //搜索内容是否有特殊字符
2342
+ if (reg.test(keyWord)) {
2343
+ span = item.question.replaceAll(keyWord, (e)=>{
2344
+ return `<span class=${styles.sign}>${e}</span>`;
2345
+ });
2346
+ } else {
2347
+ span = item.question.replaceAll(new RegExp(keyWord, "ig"), (i)=>{
2348
+ // console.log(i,'skdcnsdjk')
2349
+ return `<span class=${styles.sign}>${i}</span>`;
2350
+ });
2351
+ }
2229
2352
  return /*#__PURE__*/ _jsx("p", {
2230
2353
  className: styles.item,
2231
2354
  children: /*#__PURE__*/ _jsx("span", {
@@ -2245,30 +2368,33 @@ const CustomerService = (props)=>{
2245
2368
  };
2246
2369
  //加载指定数据,点击历史记录
2247
2370
  const loadSpecifiedData = (renewRoomId, page, id, receiver)=>{
2371
+ // let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
2372
+ // let page = 1;
2373
+ // let id = '0e459f0a3a62438698f170b42b94d150';
2374
+ // let receiver = mid;
2248
2375
  if (page != 1) {
2249
2376
  setPageNumHistory(page);
2250
2377
  }
2251
- setPageNum(page);
2252
2378
  setLastId(id); //用于定位
2379
+ setPageNum(page);
2253
2380
  //如果是当前聊天室
2254
2381
  if (renewRoomId == roomId) {
2255
2382
  getHistoryMessage(page, 1);
2256
2383
  } else {
2257
2384
  setRoomId(renewRoomId);
2258
- if (childRef.current) {
2259
- if (receiver != mid) {
2260
- createRooms(receiver);
2261
- }
2262
- setTimeout(()=>{
2263
- childRef.current.roomsListTimer();
2264
- }, 500);
2385
+ if (receiver != mid) {
2386
+ createRooms(receiver);
2265
2387
  }
2388
+ setTimeout(()=>{
2389
+ roomsListTimer();
2390
+ }, 500);
2266
2391
  }
2392
+ setShowContacts(true);
2267
2393
  };
2268
2394
  return /*#__PURE__*/ _jsxs(_Fragment, {
2269
2395
  children: [
2270
2396
  /*#__PURE__*/ _jsxs(Drawer, {
2271
- title: "智能问答",
2397
+ title: "AI助手",
2272
2398
  width: 560,
2273
2399
  onClose: ()=>{
2274
2400
  onCancel();
@@ -2293,9 +2419,9 @@ const CustomerService = (props)=>{
2293
2419
  onClose: ()=>{
2294
2420
  setShowContacts(false);
2295
2421
  },
2296
- // roomIdAi={roomIdAi}
2297
2422
  switchChatRoom: switchChatRoom,
2298
- saveContactsList: saveContactsList,
2423
+ // saveContactsList={saveContactsList}
2424
+ contactsList: contactsList,
2299
2425
  ref: childRef
2300
2426
  })
2301
2427
  }),
@@ -2352,7 +2478,7 @@ const CustomerService = (props)=>{
2352
2478
  ]
2353
2479
  }),
2354
2480
  /*#__PURE__*/ _jsxs(Modal, {
2355
- title: "智能问答",
2481
+ title: "AI助手",
2356
2482
  open: showType == 2 ? true : false,
2357
2483
  onCancel: ()=>{
2358
2484
  onCancel();
@@ -2391,7 +2517,8 @@ const CustomerService = (props)=>{
2391
2517
  setShowContacts(false);
2392
2518
  },
2393
2519
  switchChatRoom: switchChatRoom,
2394
- saveContactsList: saveContactsList,
2520
+ contactsList: contactsList,
2521
+ // saveContactsList={saveContactsList}
2395
2522
  ref: childRef
2396
2523
  }),
2397
2524
  /*#__PURE__*/ _jsxs("div", {
@@ -2447,7 +2574,7 @@ const CustomerService = (props)=>{
2447
2574
  /*#__PURE__*/ _jsx("div", {
2448
2575
  className: styles.user,
2449
2576
  children: /*#__PURE__*/ _jsx("p", {
2450
- children: roomList.filter((e)=>e.roomId == roomId).length > 0 && roomList.filter((e)=>e.roomId == roomId)[0].name != undefined ? roomList.filter((e)=>e.roomId == roomId)[0].name : '智能问答'
2577
+ children: showChatRoomName()
2451
2578
  })
2452
2579
  }),
2453
2580
  /*#__PURE__*/ _jsxs("div", {
@@ -2468,7 +2595,7 @@ const CustomerService = (props)=>{
2468
2595
  onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
2469
2596
  setFirstLoad(false);
2470
2597
  setShowType(4);
2471
- childRef.current.roomsListTimer();
2598
+ // childRef.current.roomsListTimer();
2472
2599
  },
2473
2600
  children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
2474
2601
  }),
@@ -2536,17 +2663,18 @@ const CustomerService = (props)=>{
2536
2663
  onClose: ()=>{
2537
2664
  setShowContacts(false);
2538
2665
  },
2666
+ contactsList: contactsList,
2539
2667
  switchChatRoom: switchChatRoom,
2540
- saveContactsList: saveContactsList,
2668
+ // saveContactsList={saveContactsList}
2541
2669
  ref: childRef
2542
2670
  })
2543
2671
  })
2544
2672
  ]
2545
- }) : '',
2673
+ }) : "",
2546
2674
  showType == 4 && /*#__PURE__*/ _jsxs(_Fragment, {
2547
2675
  children: [
2548
2676
  /*#__PURE__*/ _jsxs(Modal, {
2549
- title: "智能问答",
2677
+ title: "AI助手",
2550
2678
  open: true,
2551
2679
  onCancel: ()=>{
2552
2680
  onCancel();
@@ -2584,8 +2712,9 @@ const CustomerService = (props)=>{
2584
2712
  onClose: ()=>{
2585
2713
  setShowContacts(false);
2586
2714
  },
2715
+ contactsList: contactsList,
2587
2716
  switchChatRoom: switchChatRoom,
2588
- saveContactsList: saveContactsList,
2717
+ // saveContactsList={saveContactsList}
2589
2718
  ref: childRef
2590
2719
  }),
2591
2720
  /*#__PURE__*/ _jsxs("div", {
@@ -2641,7 +2770,7 @@ const CustomerService = (props)=>{
2641
2770
  /*#__PURE__*/ _jsx("div", {
2642
2771
  className: styles.user,
2643
2772
  children: /*#__PURE__*/ _jsx("p", {
2644
- children: roomList.filter((e)=>e.roomId == roomId).length > 0 && !roomList.filter((e)=>e.roomId == roomId)[0].name ? roomList.filter((e)=>e.roomId == roomId)[0].name : '智能问答'
2773
+ children: showChatRoomName()
2645
2774
  })
2646
2775
  }),
2647
2776
  /*#__PURE__*/ _jsxs("div", {
@@ -2660,7 +2789,7 @@ const CustomerService = (props)=>{
2660
2789
  onClick: ()=>{
2661
2790
  onEvent(serverName + serverUrl(), "click_智能问答_全屏", "提交");
2662
2791
  setShowType(4);
2663
- childRef.current.roomsListTimer();
2792
+ // childRef.current.roomsListTimer();
2664
2793
  },
2665
2794
  children: /*#__PURE__*/ _jsx(CustomFullScreen, {})
2666
2795
  }),
@@ -2717,8 +2846,9 @@ const CustomerService = (props)=>{
2717
2846
  onClose: ()=>{
2718
2847
  setShowContacts(false);
2719
2848
  },
2849
+ contactsList: contactsList,
2720
2850
  switchChatRoom: switchChatRoom,
2721
- saveContactsList: saveContactsList,
2851
+ // saveContactsList={saveContactsList}
2722
2852
  ref: childRef
2723
2853
  })
2724
2854
  })