bhd-components 0.7.20 → 0.7.21

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.
@@ -5,7 +5,7 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
5
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
6
6
  import React, { useEffect, useState, useRef } from "react";
7
7
  import { Modal, Drawer, Input, Tooltip } from "antd";
8
- import { ViewImage } from "bhd-components";
8
+ import ViewImage from "../viewImage";
9
9
  // import html2canvas from "html2canvas";
10
10
  import cssStyle from "./index.module.less";
11
11
  import cssStyleOnline from "./index2.module.less";
@@ -18,6 +18,7 @@ import { CloseOutlined, RightOutlined, ZoomInOutlined } from "@ant-design/icons"
18
18
  import HistoryFun from "./historyFun";
19
19
  import ContactsList from "./contactsList";
20
20
  import ScreenshotTool from "./screenshotTool";
21
+ import TeacherList from "./teacherList";
21
22
  import { parseDate } from "../utils/Date";
22
23
  import { Remarkable } from "remarkable";
23
24
  import hljs from "highlight.js";
@@ -54,20 +55,21 @@ var CustomerService = function(props) {
54
55
  var _useState17 = _sliced_to_array(useState(45), 2), buttomHei = _useState17[0], setButtomHei = _useState17[1]; //底部输入框的高度
55
56
  var _useState18 = _sliced_to_array(useState(false), 2), showHistory = _useState18[0], setShowHistory = _useState18[1]; //是否显示历史记录
56
57
  var _useState19 = _sliced_to_array(useState(false), 2), showContacts = _useState19[0], setShowContacts = _useState19[1]; //是否显示老师列表
57
- var _useState20 = _sliced_to_array(useState(-1), 2), showType = _useState20[0], setShowType = _useState20[1]; //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
58
- var _useState21 = _sliced_to_array(useState(-1), 2), answerMode = _useState21[0], setAnswerMode = _useState21[1]; //设置回答模式。1,召唤老师回答
59
- var _useState22 = _sliced_to_array(useState([]), 2), teacherList = _useState22[0], setTeacherList = _useState22[1]; //老师列表
60
- var _useState23 = _sliced_to_array(useState({}), 2), problem = _useState23[0], setProblem = _useState23[1]; //召唤老师回答的问题
61
- var _useState24 = _sliced_to_array(useState([]), 2), contactsList = _useState24[0], setContactsList = _useState24[1]; //老师列表
62
- var _useState25 = _sliced_to_array(useState([]), 2), chatObj = _useState25[0], setChatObj = _useState25[1]; //聊天记录id保存,用来在实验报告中记录
63
- var _useState26 = _sliced_to_array(useState(""), 2), keyWordProblem = _useState26[0], setKeyWordProblem = _useState26[1]; //历史记录搜索的内容
64
- var _useState27 = _sliced_to_array(useState(""), 2), imgBese64 = _useState27[0], setImgBese64 = _useState27[1]; //屏幕截图
65
- var _useState28 = _sliced_to_array(useState(""), 2), screenshotBese64 = _useState28[0], setScreenshotBese64 = _useState28[1]; //bese64图片
66
- var _useState29 = _sliced_to_array(useState(""), 2), viewBase64 = _useState29[0], setViewBase64 = _useState29[1]; //图片预览
67
- var _useState30 = _sliced_to_array(useState(false), 2), visible = _useState30[0], setVisible = _useState30[1]; //是否显示图片预览
68
- var _useState31 = _sliced_to_array(useState([]), 2), bottomRecommendationQuestions = _useState31[0], setBottomRecommendationQuestions = _useState31[1]; //底部推荐问题
69
- var _useState32 = _sliced_to_array(useState(false), 2), showScreenshot = _useState32[0], setShowScreenshot = _useState32[1]; //是否显示截图 主要用于newlabo页面
70
- var _useState33 = _sliced_to_array(useState(-1), 2), saveShowType = _useState33[0], setSaveShowType = _useState33[1]; //保存截图时的状态
58
+ var _useState20 = _sliced_to_array(useState([]), 2), contactsList = _useState20[0], setContactsList = _useState20[1]; //老师列表
59
+ var _useState21 = _sliced_to_array(useState(-1), 2), showType = _useState21[0], setShowType = _useState21[1]; //显示聊天框类型 1、侧边栏 2 modal 3 相应的div中 newlabo中使用
60
+ // const [answerMode, setAnswerMode] = useState(-1); //设置回答模式。1,召唤老师回答
61
+ // const [teacherList, setTeacherList] = useState([]); //老师列表
62
+ var _useState22 = _sliced_to_array(useState({}), 2), problem = _useState22[0], setProblem = _useState22[1]; //召唤老师回答的问题
63
+ var _useState23 = _sliced_to_array(useState([]), 2), chatObj = _useState23[0], setChatObj = _useState23[1]; //聊天记录id保存,用来在实验报告中记录
64
+ var _useState24 = _sliced_to_array(useState(""), 2), keyWordProblem = _useState24[0], setKeyWordProblem = _useState24[1]; //历史记录搜索的内容
65
+ var _useState25 = _sliced_to_array(useState(""), 2), imgBese64 = _useState25[0], setImgBese64 = _useState25[1]; //屏幕截图
66
+ var _useState26 = _sliced_to_array(useState(""), 2), screenshotBese64 = _useState26[0], setScreenshotBese64 = _useState26[1]; //bese64图片
67
+ var _useState27 = _sliced_to_array(useState(""), 2), viewBase64 = _useState27[0], setViewBase64 = _useState27[1]; //图片预览
68
+ var _useState28 = _sliced_to_array(useState(false), 2), visible = _useState28[0], setVisible = _useState28[1]; //是否显示图片预览
69
+ var _useState29 = _sliced_to_array(useState([]), 2), bottomRecommendationQuestions = _useState29[0], setBottomRecommendationQuestions = _useState29[1]; //底部推荐问题
70
+ var _useState30 = _sliced_to_array(useState(false), 2), showScreenshot = _useState30[0], setShowScreenshot = _useState30[1]; //是否显示截图 主要用于newlabo页面
71
+ var _useState31 = _sliced_to_array(useState(-1), 2), saveShowType = _useState31[0], setSaveShowType = _useState31[1]; //保存截图时的状态
72
+ var _useState32 = _sliced_to_array(useState(false), 2), showTeacherList = _useState32[0], setShowTeacherList = _useState32[1]; //是否显示召唤老师列表
71
73
  var timer = useRef(null); //文本框输入时
72
74
  var receiveMessageTimer = useRef(null); //接收ai发回的消息
73
75
  // let voiceCountdownTimer = useRef(null); //语音录制倒计时
@@ -81,6 +83,7 @@ var CustomerService = function(props) {
81
83
  var recommendeQuestionID = useRef([]); //推荐问题id
82
84
  var videoHotQuestionsList = useRef([]); //视频热门问题
83
85
  var newHotQuestionsList = useRef([]); //视频热门问题
86
+ var newShowType = useRef(false);
84
87
  var mid = props.userData.mid;
85
88
  var remarkable = new Remarkable({
86
89
  highlight: function highlight(str, lang) {
@@ -154,6 +157,7 @@ var CustomerService = function(props) {
154
157
  //|| showScreenshot
155
158
  if (showType == 5 || showScreenshot) {
156
159
  try {
160
+ newShowType.current = true;
157
161
  setImgBese64("");
158
162
  // let dom = document.getElementById(screenshotAreaId);
159
163
  html2canvas(screenshotAreaId, {
@@ -559,6 +563,7 @@ var CustomerService = function(props) {
559
563
  };
560
564
  //消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
561
565
  var sendToTeacher = function(type) {
566
+ var message = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
562
567
  console.log("消息发送给老师111");
563
568
  var obj = {};
564
569
  if (type == 1) {
@@ -568,8 +573,11 @@ var CustomerService = function(props) {
568
573
  recevier: chatWith.uid,
569
574
  message: problem.question
570
575
  };
576
+ if (problem.url) {
577
+ obj.image = problem.url;
578
+ }
571
579
  setProblem({});
572
- } else if (type == 2) {
580
+ } else if (type == 2 || type == 3) {
573
581
  var list = contactsList.filter(function(item) {
574
582
  return item.roomId == roomId;
575
583
  });
@@ -581,9 +589,13 @@ var CustomerService = function(props) {
581
589
  roomId: roomId,
582
590
  sender: mid,
583
591
  recevier: recevier,
584
- message: keyWord,
592
+ message: type == 2 ? keyWord : message,
585
593
  quotedMessage: citationContent.content || ""
586
594
  };
595
+ if (screenshotBese64) {
596
+ obj.image = screenshotBese64;
597
+ setScreenshotBese64("");
598
+ }
587
599
  }
588
600
  http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
589
601
  if (res.data.id) {
@@ -594,7 +606,13 @@ var CustomerService = function(props) {
594
606
  id: res.data.id,
595
607
  upvoted: false,
596
608
  downvoted: false,
597
- createdAt: getDataTime(-1)
609
+ createdAt: getDataTime(-1),
610
+ extraInfo: obj.image ? JSON.stringify([
611
+ {
612
+ key: "imageUrl",
613
+ value: obj.image
614
+ }
615
+ ]) : null
598
616
  }));
599
617
  return newHistoryMessageList;
600
618
  });
@@ -1247,8 +1265,9 @@ var CustomerService = function(props) {
1247
1265
  roomMessage.current = setTimeout(function() {
1248
1266
  getRoomidHistoryMessage(totalNumber, rid);
1249
1267
  }, 5000);
1250
- if (rid == "") return;
1251
- // console.log(roomList,2222222);
1268
+ // console.log(showType, imgBese64,showScreenshot,newShowType.current,9999999);
1269
+ //newShowType.current 截图中,不循环
1270
+ if (rid == "" || newShowType.current) return;
1252
1271
  return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
1253
1272
  params: {
1254
1273
  roomId: rid,
@@ -1505,19 +1524,6 @@ var CustomerService = function(props) {
1505
1524
  }
1506
1525
  }
1507
1526
  };
1508
- //获取老师列表
1509
- var getTeacherList = function(keyWord) {
1510
- http.get("".concat(urllocation, "/chat-service/public/v1.0/teachers"), {
1511
- params: {
1512
- name: keyWord
1513
- }
1514
- }).then(function(res) {
1515
- console.log(res);
1516
- if (res.data) {
1517
- setTeacherList(res.data.teachers);
1518
- }
1519
- });
1520
- };
1521
1527
  //获取聊天室列表
1522
1528
  var roomsListTimer = function() {
1523
1529
  if (chatRoomList != null) clearTimeout(chatRoomList.current);
@@ -2051,7 +2057,7 @@ var CustomerService = function(props) {
2051
2057
  ]
2052
2058
  })
2053
2059
  }),
2054
- showType == 2 || showType == 4 ? /*#__PURE__*/ _jsx("div", {
2060
+ (showType == 2 || showType == 4) && /*#__PURE__*/ _jsx("div", {
2055
2061
  className: styles.head_sculpture,
2056
2062
  style: {
2057
2063
  marginLeft: "12px"
@@ -2059,7 +2065,7 @@ var CustomerService = function(props) {
2059
2065
  children: /*#__PURE__*/ _jsx("img", {
2060
2066
  src: userData.avatar
2061
2067
  })
2062
- }) : ""
2068
+ })
2063
2069
  ]
2064
2070
  }, item.id)
2065
2071
  ]
@@ -2171,28 +2177,7 @@ var CustomerService = function(props) {
2171
2177
  ]
2172
2178
  }),
2173
2179
  //findTeacher//是否在召唤老师过程中,是否是最后一条消息
2174
- !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != "123456_date" && renderLastOperateBtn(item, isAiChatWindow, i),
2175
- //召唤老师回答按钮
2176
- isAiChatWindow && item.findTeacher && userData.modules.some(function(item) {
2177
- return item.short == "TeacherAnswer";
2178
- }) && /*#__PURE__*/ _jsx("div", {
2179
- className: "".concat(styles.operate_modal_bottom, " "),
2180
- children: /*#__PURE__*/ _jsx("p", {
2181
- className: styles.stop_findTeacher,
2182
- children: /*#__PURE__*/ _jsx("span", {
2183
- onClick: function() {
2184
- setAnswerMode(-1);
2185
- setTeacherList([]);
2186
- setHistoryMessageList(function(historyMessageList) {
2187
- return historyMessageList.filter(function(item) {
2188
- return item.id != "-1";
2189
- });
2190
- });
2191
- },
2192
- children: "停止召唤老师"
2193
- })
2194
- })
2195
- })
2180
+ !item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != "123456_date" && renderLastOperateBtn(item, isAiChatWindow, i)
2196
2181
  ]
2197
2182
  })
2198
2183
  ]
@@ -2238,52 +2223,26 @@ var CustomerService = function(props) {
2238
2223
  if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "messageSource" || extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "isVoteMessage") {
2239
2224
  return "";
2240
2225
  }
2241
- // console.log(historyMessageList,i,'sdcsd;sldcscsdsd')
2242
- //根据上一行数据,判断是否显示招唤老师按钮
2243
- var showTeacherBtn = true;
2244
- var previousLineData = historyMessageList[i - 1];
2245
- if (!previousLineData) {
2246
- showTeacherBtn = true;
2247
- } else if (!previousLineData.extraInfo) {
2248
- showTeacherBtn = true;
2249
- } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2250
- showTeacherBtn = false;
2251
- }
2252
2226
  return /*#__PURE__*/ _jsxs("p", {
2253
2227
  className: styles.operate,
2254
2228
  children: [
2255
2229
  // 不在智能客服窗口,并已经点击了召唤老师,并有召唤老师权限
2256
- isAiChatWindow && answerMode != 1 && userData.modules.some(function(item) {
2230
+ isAiChatWindow && userData.modules.some(function(item) {
2257
2231
  return item.short == "TeacherAnswer";
2258
- }) && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
2232
+ }) && /*#__PURE__*/ _jsx("span", {
2259
2233
  className: styles.ask_question,
2260
2234
  onClick: function() {
2261
- setAnswerMode(1);
2235
+ console.log(historyMessageList[i - 1], 4444444);
2236
+ var extraInfo = historyMessageList[i - 1].extraInfo;
2237
+ var url = "";
2238
+ if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
2239
+ url = JSON.parse(extraInfo)[0].value;
2240
+ }
2262
2241
  setProblem({
2263
2242
  question: historyMessageList[i - 1].message,
2264
- user: problem.user
2243
+ url: url
2265
2244
  });
2266
- setHistoryMessageList(function(historyMessageList) {
2267
- var newHistoryMessageList = historyMessageList.concat({
2268
- id: -1,
2269
- roomId: roomId,
2270
- sender: "AI",
2271
- recevier: mid,
2272
- message: "请告诉我您要召唤的老师名字",
2273
- createdAt: getDataTime(-1),
2274
- findTeacher: true,
2275
- extraInfo: item.extraInfo == null ? null : JSON.stringify([
2276
- {
2277
- key: "questionId",
2278
- value: "questionId"
2279
- }
2280
- ])
2281
- });
2282
- return newHistoryMessageList;
2283
- });
2284
- setTimeout(function() {
2285
- scrollToBottom();
2286
- }, 200);
2245
+ setShowTeacherList(true);
2287
2246
  },
2288
2247
  children: "召唤老师回答"
2289
2248
  }),
@@ -2296,7 +2255,6 @@ var CustomerService = function(props) {
2296
2255
  });
2297
2256
  resettingBottomHei();
2298
2257
  onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
2299
- console.log("引用222222");
2300
2258
  },
2301
2259
  children: /*#__PURE__*/ _jsx(CustomQuote, {})
2302
2260
  }),
@@ -2339,7 +2297,6 @@ var CustomerService = function(props) {
2339
2297
  if (!isAiChatWindow) return;
2340
2298
  //只有最后一条回答,支持发送点赞或踩
2341
2299
  if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
2342
- console.log("判断是AI还是智能问答", item);
2343
2300
  if (!item.extraInfo && item.sender == "AI") {
2344
2301
  aiSendQuestions(1, {
2345
2302
  roomId: roomId,
@@ -2349,7 +2306,6 @@ var CustomerService = function(props) {
2349
2306
  generateUpvoteOrDownvoteMessage: true
2350
2307
  }, 1);
2351
2308
  } else {
2352
- console.log("AI回答2255555");
2353
2309
  sendGreetingMessage(2);
2354
2310
  }
2355
2311
  }
@@ -2407,17 +2363,6 @@ var CustomerService = function(props) {
2407
2363
  if (!showStopBtn && isAiChatWindow && (extraInfo != undefined && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "questionId" || extraInfo == null)) {
2408
2364
  findTeacherBtn = true;
2409
2365
  }
2410
- //根据上一行数据,判断是否显示招唤老师按钮
2411
- var showTeacherBtn = true;
2412
- var previousLineData = historyMessageList[i - 1];
2413
- if (!previousLineData) {
2414
- showTeacherBtn = true;
2415
- } else if (!previousLineData.extraInfo) {
2416
- showTeacherBtn = true;
2417
- } else if (JSON.parse(previousLineData.extraInfo).length > 0 && JSON.parse(previousLineData.extraInfo)[0].key == "imageUrl") {
2418
- showTeacherBtn = false;
2419
- }
2420
- /// style={{position:showStopBtn && isPosition.current ? 'sticky' : 'relative'}}
2421
2366
  return /*#__PURE__*/ _jsxs("div", {
2422
2367
  className: "".concat(styles.operate_modal_bottom),
2423
2368
  children: [
@@ -2468,35 +2413,19 @@ var CustomerService = function(props) {
2468
2413
  //在ai窗口并ai已经生成完答案
2469
2414
  findTeacherBtn && userData.modules.some(function(item) {
2470
2415
  return item.short == "TeacherAnswer";
2471
- }) && showTeacherBtn && /*#__PURE__*/ _jsx("span", {
2416
+ }) && /*#__PURE__*/ _jsx("span", {
2472
2417
  className: styles.find_teacher,
2473
2418
  onClick: function() {
2474
- setAnswerMode(1);
2419
+ var extraInfo = historyMessageList[i - 1].extraInfo;
2420
+ var url = "";
2421
+ if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
2422
+ url = JSON.parse(extraInfo)[0].value;
2423
+ }
2475
2424
  setProblem({
2476
2425
  question: historyMessageList[i - 1].message,
2477
- user: problem.user
2426
+ url: url
2478
2427
  });
2479
- setHistoryMessageList(function(historyMessageList) {
2480
- var newHistoryMessageList = historyMessageList.concat({
2481
- id: -1,
2482
- roomId: roomId,
2483
- sender: "AI",
2484
- recevier: mid,
2485
- message: "请告诉我您要召唤的老师名字",
2486
- createdAt: getDataTime(-1),
2487
- findTeacher: true,
2488
- extraInfo: item.extraInfo == null ? null : JSON.stringify([
2489
- {
2490
- key: "questionId",
2491
- value: "questionId"
2492
- }
2493
- ])
2494
- });
2495
- return newHistoryMessageList;
2496
- });
2497
- setTimeout(function() {
2498
- scrollToBottom();
2499
- }, 200);
2428
+ setShowTeacherList(true);
2500
2429
  },
2501
2430
  children: "召唤老师回答"
2502
2431
  })
@@ -2648,6 +2577,44 @@ var CustomerService = function(props) {
2648
2577
  }
2649
2578
  }
2650
2579
  };
2580
+ //发送截图信息
2581
+ var sendScreenshotData = function(message) {
2582
+ if (contactsList.length > 0 && contactsList[0].roomId == roomId) {
2583
+ setHistoryMessageList(function(historyMessageList) {
2584
+ var newHistoryMessageList = historyMessageList.concat({
2585
+ id: "p" + new Date().getTime(),
2586
+ roomId: roomId,
2587
+ sender: mid,
2588
+ recevier: "AI",
2589
+ message: message,
2590
+ createdAt: getDataTime(-1),
2591
+ extraInfo: JSON.stringify([
2592
+ {
2593
+ key: "imageUrl",
2594
+ value: screenshotBese64
2595
+ }
2596
+ ])
2597
+ });
2598
+ return newHistoryMessageList;
2599
+ });
2600
+ //ai窗口
2601
+ aiSendQuestions(3, {
2602
+ //相关数据
2603
+ roomId: roomId,
2604
+ message: message,
2605
+ image: screenshotBese64,
2606
+ quotedMessage: citationContent.content || "",
2607
+ regenerate: citationContent.content != "" ? false : true,
2608
+ generateUpvoteOrDownvoteMessage: false
2609
+ }, 1);
2610
+ setScreenshotBese64("");
2611
+ } else {
2612
+ //老师窗口
2613
+ sendToTeacher(3, message);
2614
+ }
2615
+ scrollToBottom();
2616
+ resettingBottomHei();
2617
+ };
2651
2618
  //渲染底部按钮
2652
2619
  var renderBottomAnt = function() {
2653
2620
  var placeholder = "";
@@ -2707,35 +2674,7 @@ var CustomerService = function(props) {
2707
2674
  children: [
2708
2675
  /*#__PURE__*/ _jsxs("p", {
2709
2676
  onClick: function() {
2710
- setHistoryMessageList(function(historyMessageList) {
2711
- var newHistoryMessageList = historyMessageList.concat({
2712
- id: "p" + new Date().getTime(),
2713
- roomId: roomId,
2714
- sender: mid,
2715
- recevier: "AI",
2716
- message: "讲解这张图片涉及到的知识内容",
2717
- createdAt: getDataTime(-1),
2718
- extraInfo: JSON.stringify([
2719
- {
2720
- key: "imageUrl",
2721
- value: screenshotBese64
2722
- }
2723
- ])
2724
- });
2725
- return newHistoryMessageList;
2726
- });
2727
- scrollToBottom();
2728
- aiSendQuestions(3, {
2729
- //相关数据
2730
- roomId: roomId,
2731
- message: "讲解这张图片涉及到的知识内容",
2732
- image: screenshotBese64,
2733
- quotedMessage: citationContent.content || "",
2734
- regenerate: citationContent.content != "" ? false : true,
2735
- generateUpvoteOrDownvoteMessage: false
2736
- }, 1);
2737
- setScreenshotBese64("");
2738
- resettingBottomHei();
2677
+ sendScreenshotData("讲解这张图片涉及到的知识内容");
2739
2678
  },
2740
2679
  children: [
2741
2680
  /*#__PURE__*/ _jsx(CustomKnowledgeContent, {}),
@@ -2745,35 +2684,7 @@ var CustomerService = function(props) {
2745
2684
  /*#__PURE__*/ _jsx("br", {}),
2746
2685
  /*#__PURE__*/ _jsxs("p", {
2747
2686
  onClick: function() {
2748
- setHistoryMessageList(function(historyMessageList) {
2749
- var newHistoryMessageList = historyMessageList.concat({
2750
- id: "p" + new Date().getTime(),
2751
- roomId: roomId,
2752
- sender: mid,
2753
- recevier: "AI",
2754
- message: "帮助我更深入地理解图片中的概念",
2755
- createdAt: getDataTime(-1),
2756
- extraInfo: JSON.stringify([
2757
- {
2758
- key: "imageUrl",
2759
- value: screenshotBese64
2760
- }
2761
- ])
2762
- });
2763
- return newHistoryMessageList;
2764
- });
2765
- scrollToBottom();
2766
- aiSendQuestions(3, {
2767
- //相关数据
2768
- roomId: roomId,
2769
- message: "帮助我更深入地理解图片中的概念",
2770
- image: screenshotBese64,
2771
- quotedMessage: citationContent.content || "",
2772
- regenerate: citationContent.content != "" ? false : true,
2773
- generateUpvoteOrDownvoteMessage: false
2774
- }, 1);
2775
- setScreenshotBese64("");
2776
- resettingBottomHei();
2687
+ sendScreenshotData("帮助我更深入地理解图片中的概念");
2777
2688
  },
2778
2689
  children: [
2779
2690
  /*#__PURE__*/ _jsx(CustomWenhaoRound, {}),
@@ -2795,22 +2706,14 @@ var CustomerService = function(props) {
2795
2706
  setKeyWord(e.target.value);
2796
2707
  if (e.target.value == "") {
2797
2708
  setQuestionsList([]);
2798
- setTeacherList([]);
2799
2709
  clearTimeout(timer.current);
2800
2710
  } else {
2801
2711
  clearTimeout(timer.current);
2802
2712
  timer.current = setTimeout(function() {
2803
- if (answerMode == 1) {
2804
- getTeacherList(String(e.target.value));
2713
+ if (config && config.type == "video") {
2714
+ getQuestiionsList(String(e.target.value), 3);
2805
2715
  } else {
2806
- var roomList = contactsList;
2807
- if (roomList.length > 0 && roomList[0].roomId != roomId) return;
2808
- console.log(props, 333333);
2809
- if (config && config.type == "video") {
2810
- getQuestiionsList(String(e.target.value), 3);
2811
- } else {
2812
- getQuestiionsList(String(e.target.value), 2);
2813
- }
2716
+ getQuestiionsList(String(e.target.value), 2);
2814
2717
  }
2815
2718
  }, 1000);
2816
2719
  }
@@ -2827,44 +2730,21 @@ var CustomerService = function(props) {
2827
2730
  setKeyWord("");
2828
2731
  setCitationContent({});
2829
2732
  setBottomRecommendationQuestions([]);
2830
- resettingBottomHei();
2831
- //查找是否是召唤老师回答并有相应的老师名称
2832
- if (answerMode == 1 && teacherList.length > 0) {
2833
- var list = teacherList.filter(function(v) {
2834
- return v.name == keyWord.trim();
2835
- });
2836
- if (list.length > 0) {
2837
- //直接进入召唤老师回答模式
2838
- enterTeacherChat(list[0]);
2839
- setButtomHei(45);
2840
- return;
2841
- }
2842
- }
2843
2733
  //跟老师对话
2844
- var roomList = contactsList;
2845
- if (roomList.length > 0 && roomList[0].roomId != roomId) {
2734
+ if (contactsList.length > 0 && contactsList[0].roomId != roomId) {
2846
2735
  sendToTeacher(2);
2847
2736
  } else {
2848
2737
  setFinished(false);
2849
- clearTimeout(timer.current);
2850
2738
  setQuestionsList([]);
2851
- setAnswerMode(-1);
2852
- setTeacherList([]);
2853
- setTimeout(function() {
2854
- setQuestionsList([]);
2855
- setTeacherList([]);
2856
- clearTimeout(timer.current);
2857
- }, 200);
2858
- setHistoryMessageList(function(historyMessageList) {
2859
- return historyMessageList.filter(function(item) {
2860
- return item.id != "-1";
2861
- });
2862
- });
2863
2739
  sendMessage("", 0);
2864
2740
  }
2741
+ setTimeout(function() {
2742
+ setQuestionsList([]);
2743
+ clearTimeout(timer.current);
2744
+ }, 200);
2745
+ resettingBottomHei();
2865
2746
  setButtomHei(45);
2866
2747
  } else {
2867
- console.log("回车事件");
2868
2748
  resettingBottomHei();
2869
2749
  }
2870
2750
  },
@@ -2898,9 +2778,9 @@ var CustomerService = function(props) {
2898
2778
  })
2899
2779
  ]
2900
2780
  }),
2901
- userData.modules.some(function(item) {
2781
+ (userData.modules.some(function(item) {
2902
2782
  return item.short == "AIservice";
2903
- }) && contactsList.length > 0 && contactsList[0].roomId == roomId && /*#__PURE__*/ _jsx("p", {
2783
+ }) || contactsList.length > 0 && contactsList[0].roomId !== roomId) && /*#__PURE__*/ _jsx("p", {
2904
2784
  className: styles.screenshot,
2905
2785
  children: /*#__PURE__*/ _jsx("i", {
2906
2786
  className: "".concat(!finished ? styles.disabled : ""),
@@ -2927,40 +2807,20 @@ var CustomerService = function(props) {
2927
2807
  setCitationContent({});
2928
2808
  setButtomHei(45);
2929
2809
  if (keyWord.trim() != "") {
2930
- //查找是否是召唤老师回答并有相应的老师名称
2931
- if (answerMode == 1 && teacherList.length > 0) {
2932
- var list = teacherList.filter(function(v) {
2933
- return v.name == keyWord.trim();
2934
- });
2935
- if (list.length > 0) {
2936
- //直接进入召唤老师回答模式
2937
- enterTeacherChat(list[0]);
2938
- setButtomHei(45);
2939
- return;
2940
- }
2941
- }
2942
2810
  setKeyWord("");
2943
2811
  //跟老师对话
2944
- var roomList = contactsList;
2945
- if (roomList.length > 0 && roomList[0].roomId != roomId) {
2812
+ if (contactsList.length > 0 && contactsList[0].roomId != roomId) {
2946
2813
  sendToTeacher(2);
2947
2814
  } else {
2948
2815
  clearTimeout(timer.current);
2949
2816
  setQuestionsList([]);
2950
- setAnswerMode(-1);
2951
- setTeacherList([]);
2952
- setTimeout(function() {
2953
- setQuestionsList([]);
2954
- setTeacherList([]);
2955
- clearTimeout(timer.current);
2956
- }, 200);
2957
- setHistoryMessageList(function(historyMessageList) {
2958
- return historyMessageList.filter(function(item) {
2959
- return item.id != "-1";
2960
- });
2961
- });
2962
2817
  sendMessage("", 0);
2963
2818
  }
2819
+ resettingBottomHei();
2820
+ setTimeout(function() {
2821
+ setQuestionsList([]);
2822
+ clearTimeout(timer.current);
2823
+ }, 200);
2964
2824
  onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
2965
2825
  }
2966
2826
  },
@@ -2972,15 +2832,12 @@ var CustomerService = function(props) {
2972
2832
  };
2973
2833
  //进入与老师的聊天
2974
2834
  var enterTeacherChat = function(item) {
2975
- setTeacherList([]);
2835
+ setShowTeacherList(false);
2976
2836
  //提问的问题
2977
- setProblem({
2837
+ setProblem(_object_spread_props(_object_spread({}, problem), {
2978
2838
  question: problem.question,
2979
2839
  user: item.uid
2980
- });
2981
- setKeyWord("");
2982
- //setUpdateRecords(true);
2983
- setAnswerMode(-1);
2840
+ }));
2984
2841
  setChatWith(item);
2985
2842
  var roomList = contactsList;
2986
2843
  var list = roomList.filter(function(e) {
@@ -2991,7 +2848,6 @@ var CustomerService = function(props) {
2991
2848
  setRoomId(list[0].roomId); //已有聊天室
2992
2849
  } else {
2993
2850
  createRooms(item.uid).then(function(res) {
2994
- // childRef.current.roomsListTimer();
2995
2851
  roomsListTimer();
2996
2852
  var id = res.data.id;
2997
2853
  setRoomId(id); //新的聊天室id
@@ -3000,82 +2856,47 @@ var CustomerService = function(props) {
3000
2856
  };
3001
2857
  //渲染联想问题及联想的老师名称
3002
2858
  var renderAssociationProblem = function() {
3003
- if (answerMode == 1) {
3004
- return /*#__PURE__*/ _jsx("div", {
3005
- className: "".concat(styles.issues_list, " ").concat(styles.issues_list_teacherList),
3006
- style: {
3007
- bottom: "".concat(buttomHei + 14, "px")
3008
- },
3009
- children: teacherList.map(function(item) {
3010
- var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
3011
- var span = "";
3012
- //搜索内容是否有特殊字符
3013
- if (reg.test(keyWord)) {
3014
- span = item.name.replaceAll(keyWord, function(e) {
3015
- return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
3016
- });
3017
- } else {
3018
- span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
3019
- // console.log(i,'skdcnsdjk')
3020
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
3021
- });
3022
- }
2859
+ return /*#__PURE__*/ _jsx("div", {
2860
+ className: styles.issues_list,
2861
+ style: {
2862
+ bottom: "".concat(buttomHei + 6, "px")
2863
+ },
2864
+ children: questionsList.map(function(item, i) {
2865
+ if (i > 4) return "";
2866
+ var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
2867
+ var span = "";
2868
+ //搜索内容是否有特殊字符
2869
+ if (reg.test(keyWord)) {
2870
+ span = item.question.replaceAll(keyWord, function(e) {
2871
+ return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
2872
+ });
2873
+ } else {
2874
+ span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
2875
+ // console.log(i,'skdcnsdjk')
2876
+ return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
2877
+ });
2878
+ }
2879
+ if (userData.modules.some(function(item) {
2880
+ return item.short == "AIservice";
2881
+ }) || item.answer) {
3023
2882
  return /*#__PURE__*/ _jsx("p", {
3024
2883
  className: styles.item,
3025
2884
  children: /*#__PURE__*/ _jsx("span", {
3026
2885
  onClick: function() {
3027
- enterTeacherChat(item);
2886
+ sendMessage(item, 2, "AssociativeProblem");
2887
+ setKeyWord("");
2888
+ onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
3028
2889
  },
3029
2890
  dangerouslySetInnerHTML: {
3030
2891
  __html: span
3031
2892
  }
3032
2893
  })
3033
2894
  });
3034
- })
3035
- });
3036
- } else {
3037
- return /*#__PURE__*/ _jsx("div", {
3038
- className: styles.issues_list,
3039
- style: {
3040
- bottom: "".concat(buttomHei + 6, "px")
3041
- },
3042
- children: questionsList.map(function(item, i) {
3043
- if (i > 4) return "";
3044
- var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
3045
- var span = "";
3046
- //搜索内容是否有特殊字符
3047
- if (reg.test(keyWord)) {
3048
- span = item.question.replaceAll(keyWord, function(e) {
3049
- return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
3050
- });
3051
- } else {
3052
- span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
3053
- // console.log(i,'skdcnsdjk')
3054
- return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
3055
- });
3056
- }
3057
- if (userData.modules.some(function(item) {
3058
- return item.short == "AIservice";
3059
- }) || item.answer) {
3060
- return /*#__PURE__*/ _jsx("p", {
3061
- className: styles.item,
3062
- children: /*#__PURE__*/ _jsx("span", {
3063
- onClick: function() {
3064
- sendMessage(item, 2, "AssociativeProblem");
3065
- setKeyWord("");
3066
- onEvent(serverName + serverUrl(), "click_智能问答_ 发送", "提交");
3067
- },
3068
- dangerouslySetInnerHTML: {
3069
- __html: span
3070
- }
3071
- })
3072
- });
3073
- } else {
3074
- return null;
3075
- }
3076
- })
3077
- });
3078
- }
2895
+ } else {
2896
+ return null;
2897
+ }
2898
+ })
2899
+ });
3079
2900
  };
3080
2901
  //视频页面底部推荐问题
3081
2902
  var renderBottomAssociationProblem = function() {
@@ -3251,6 +3072,16 @@ var CustomerService = function(props) {
3251
3072
  setShowHistory(false);
3252
3073
  },
3253
3074
  loadSpecifiedData: loadSpecifiedData
3075
+ }),
3076
+ showType == 1 && showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3077
+ type: showType,
3078
+ userData: userData,
3079
+ http: http,
3080
+ urllocation: urllocation,
3081
+ onClose: function() {
3082
+ setShowTeacherList(false);
3083
+ },
3084
+ enterTeacherChat: enterTeacherChat
3254
3085
  })
3255
3086
  ]
3256
3087
  }),
@@ -3338,6 +3169,16 @@ var CustomerService = function(props) {
3338
3169
  setShowHistory(false);
3339
3170
  },
3340
3171
  loadSpecifiedData: loadSpecifiedData
3172
+ }),
3173
+ showType == 2 && showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3174
+ type: showType,
3175
+ userData: userData,
3176
+ http: http,
3177
+ urllocation: urllocation,
3178
+ onClose: function() {
3179
+ setShowTeacherList(false);
3180
+ },
3181
+ enterTeacherChat: enterTeacherChat
3341
3182
  })
3342
3183
  ]
3343
3184
  })
@@ -3435,6 +3276,16 @@ var CustomerService = function(props) {
3435
3276
  },
3436
3277
  loadSpecifiedData: loadSpecifiedData
3437
3278
  }),
3279
+ showType == 3 && showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3280
+ type: showType,
3281
+ userData: userData,
3282
+ http: http,
3283
+ urllocation: urllocation,
3284
+ onClose: function() {
3285
+ setShowTeacherList(false);
3286
+ },
3287
+ enterTeacherChat: enterTeacherChat
3288
+ }),
3438
3289
  showType == 3 && /*#__PURE__*/ _jsx("div", {
3439
3290
  style: {
3440
3291
  display: "".concat(showType == 3 && showContacts && roomId != "" ? "block" : "none")
@@ -3542,6 +3393,16 @@ var CustomerService = function(props) {
3542
3393
  setShowHistory(false);
3543
3394
  },
3544
3395
  loadSpecifiedData: loadSpecifiedData
3396
+ }),
3397
+ showTeacherList && /*#__PURE__*/ _jsx(TeacherList, {
3398
+ type: showType,
3399
+ userData: userData,
3400
+ http: http,
3401
+ urllocation: urllocation,
3402
+ onClose: function() {
3403
+ setShowTeacherList(false);
3404
+ },
3405
+ enterTeacherChat: enterTeacherChat
3545
3406
  })
3546
3407
  ]
3547
3408
  })
@@ -3649,6 +3510,7 @@ var CustomerService = function(props) {
3649
3510
  (showType == 5 || showScreenshot) && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
3650
3511
  imgBese64: imgBese64,
3651
3512
  saveScreenshotBese64: function(base64) {
3513
+ newShowType.current = false;
3652
3514
  setScreenshotBese64(base64);
3653
3515
  if (saveShowType != -1) {
3654
3516
  setShowType(saveShowType);
@@ -3658,6 +3520,7 @@ var CustomerService = function(props) {
3658
3520
  setShowScreenshot(false);
3659
3521
  },
3660
3522
  cancelScreenshot: function() {
3523
+ newShowType.current = false;
3661
3524
  if (saveShowType != -1) {
3662
3525
  setShowType(saveShowType);
3663
3526
  } else {