bhd-components 0.10.36 → 0.10.38

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.
@@ -242,7 +242,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
242
242
  apiRef.contentApi.addMsg({
243
243
  id: msgId,
244
244
  createTime: createTime,
245
- content: "正在输入...",
245
+ content: "正在思考...",
246
246
  location: "left",
247
247
  reference: recordObj.reference || null,
248
248
  source: null,
@@ -252,7 +252,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
252
252
  apiRef.contentApi.addMsg({
253
253
  id: msgId,
254
254
  createTime: createTime,
255
- content: "正在输入...",
255
+ content: "正在思考...",
256
256
  location: "left",
257
257
  reference: null,
258
258
  source: null,
@@ -608,8 +608,17 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
608
608
  } else {
609
609
  // 没有跨天 判断是否相隔超过10分钟
610
610
  if (timeObj.timestamp - beforeTimeObj.timestamp > 10 * 60 * 1000) {
611
- // 超过10分钟 显示 时分
612
- time = `${timeObj.hours}:${timeObj.minutes}`;
611
+ // 超过10分钟 显示
612
+ let now = new Date();
613
+ // 当天的日期
614
+ let nowTimeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
615
+ if (nowTimeStr === `${timeObj.year}-${timeObj.month}-${timeObj.day}`) {
616
+ // 是当天 显示 时分
617
+ time = `${timeObj.hours}:${timeObj.minutes}`;
618
+ } else {
619
+ // 不是当天 显示 年月日 时分
620
+ time = `${timeObj.year}-${timeObj.month}-${timeObj.day} ${timeObj.hours}:${timeObj.minutes}`;
621
+ }
613
622
  }
614
623
  }
615
624
  }
@@ -463,6 +463,9 @@
463
463
  padding: 8px;
464
464
  border-radius: 2px;
465
465
  background: #e7e7e7;
466
+ img {
467
+ width: 100%;
468
+ }
466
469
  p {
467
470
  color: @color-text-Secondary-Tr;
468
471
  font-size: 12px;
@@ -136,9 +136,12 @@ const getBase64Image = (src)=>{
136
136
  };
137
137
  const formatDate = (dateStr)=>{
138
138
  const today = new Date();
139
+ today.setHours(0, 0, 0, 0); // 将时间部分设为0,只比较日期
139
140
  const date = new Date(dateStr);
141
+ const cloneDate = new Date(dateStr);
142
+ cloneDate.setHours(0, 0, 0, 0); // 将时间部分设为0,只比较日期
140
143
  let isSameDay = today.getFullYear() === date.getFullYear() && today.getMonth() === date.getMonth() && today.getDate() === date.getDate();
141
- const dayDiff = Math.ceil((today - date) / (1000 * 60 * 60 * 24)); // 计算天数差
144
+ const dayDiff = Math.ceil((today - cloneDate) / (1000 * 60 * 60 * 24)); // 计算天数差
142
145
  // 判断当前的日期 是否于传入的日期为同一天 同一天则显示时间 不是同一天则判断是否超过一周
143
146
  // console.log(dayDiff,'dayDiffdayDiff',today,'___',date);
144
147
  if (isSameDay) {
@@ -146,7 +149,7 @@ const formatDate = (dateStr)=>{
146
149
  return date.toLocaleTimeString('zh-CN', {
147
150
  hour12: false
148
151
  }).substring(0, 5);
149
- } else if (dayDiff <= 7) {
152
+ } else if (dayDiff < 7) {
150
153
  // 一周内
151
154
  return date.toLocaleString('zh-CN', {
152
155
  weekday: 'short'
@@ -54,6 +54,12 @@ function escapeHtml(str) {
54
54
  }
55
55
  return str;
56
56
  }
57
+ const pattern = /!\[.*?\]\((.*?)\)/;
58
+ const exactRegex = /class\s*=\s*["']think-block["']/;
59
+ // 去掉think
60
+ const replaceThinkAndYaml = (text = "")=>{
61
+ return text.replace(/```(\s)?yaml(?:.|\n)*?```/ig, "").replace(/<thinking>([\s\S]*?)<\/thinking>/g, "").replace(RegExp('<div\\s+class="think-block">.*?<\\/div>', "gs"), '');
62
+ };
57
63
  mermaid.initialize({
58
64
  startOnLoad: false,
59
65
  theme: 'default',
@@ -136,6 +142,7 @@ const CustomerService = (props)=>{
136
142
  const getLisyFlagRef = useRef(0);
137
143
  const [showMemaid, setShowMemaid] = useState(false); //是否显示mermaid弹窗
138
144
  const [memaidContent, setMemaidContent] = useState(""); //mermaid内容
145
+ const shouqiTimer = useRef(null);
139
146
  const remarkable = new Remarkable({
140
147
  html: true,
141
148
  highlight: function(str, lang) {
@@ -222,6 +229,7 @@ const CustomerService = (props)=>{
222
229
  // //获取热门推荐
223
230
  // videoPageQuestiionsList(1);
224
231
  // }
232
+ console.log('initShowType', initShowType);
225
233
  setShowType(initShowType);
226
234
  }, [
227
235
  initShowType
@@ -804,7 +812,7 @@ const CustomerService = (props)=>{
804
812
  });
805
813
  };
806
814
  //AI窗口,type:1发送打招呼信息欢迎语 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
807
- const sendGreetingMessage = (type)=>{
815
+ const sendGreetingMessage = async (type, message = "")=>{
808
816
  let obj = {};
809
817
  if (type == 1) {
810
818
  sendWelcomMessage();
@@ -842,7 +850,7 @@ const CustomerService = (props)=>{
842
850
  roomId: roomId,
843
851
  sender: mid,
844
852
  recevier: "AI",
845
- message: keyWord,
853
+ message: message ? message : keyWord,
846
854
  createdAt: getDataTime(-1),
847
855
  quotedMessage: citationContent.content,
848
856
  extraInfos: [
@@ -852,6 +860,22 @@ const CustomerService = (props)=>{
852
860
  }
853
861
  ]
854
862
  };
863
+ let imageUrl = '';
864
+ if (citationContent.imageUrl) {
865
+ let base64 = await urlToBase64(citationContent.imageUrl);
866
+ imageUrl = base64;
867
+ }
868
+ if (screenshotBese64) {
869
+ imageUrl = screenshotBese64;
870
+ }
871
+ console.log('imageUrl', imageUrl);
872
+ if (imageUrl) {
873
+ obj.image = imageUrl;
874
+ obj.extraInfos.push({
875
+ key: "imageUrl",
876
+ value: imageUrl
877
+ });
878
+ }
855
879
  } else if (type == 5) {
856
880
  obj = {
857
881
  roomId: roomId,
@@ -874,6 +898,7 @@ const CustomerService = (props)=>{
874
898
  setKeyWord("");
875
899
  setQuestionsList([]);
876
900
  setCitationContent({});
901
+ setScreenshotBese64('');
877
902
  http.post(`${urllocation}/chat-service/public/v1.0/history-messages`, obj).then((res)=>{
878
903
  if (res.data.id) {
879
904
  if (pageNumHistory <= 1) {
@@ -1217,7 +1242,7 @@ const CustomerService = (props)=>{
1217
1242
  roomId: roomId,
1218
1243
  sender: "AI",
1219
1244
  recevier: mid,
1220
- message: "正在输入...",
1245
+ message: "正在思考...",
1221
1246
  id: "123456",
1222
1247
  createdAt: getDataTime(-1),
1223
1248
  extraInfo: null
@@ -1231,7 +1256,7 @@ const CustomerService = (props)=>{
1231
1256
  roomId: roomId,
1232
1257
  sender: "AI",
1233
1258
  recevier: mid,
1234
- message: "正在输入...",
1259
+ message: "正在思考...",
1235
1260
  id: "123456",
1236
1261
  createdAt: getDataTime(-1),
1237
1262
  extraInfo: null
@@ -1244,6 +1269,7 @@ const CustomerService = (props)=>{
1244
1269
  //先请求问题列表
1245
1270
  videoPageQuestiionsList(3);
1246
1271
  }
1272
+ let hasYamlStarted = false;
1247
1273
  //使用fetchEventSource接收数据
1248
1274
  const eventSource = fetchEventSource(`${urllocation}/chat-service/public/v1.0/chat-with-ai/messages`, {
1249
1275
  method: "POST",
@@ -1340,7 +1366,12 @@ const CustomerService = (props)=>{
1340
1366
  //识别的内容
1341
1367
  // console.log("eventSource msg: ", event.data);
1342
1368
  let msg = JSON.parse(event.data);
1343
- if (msg.message) {}
1369
+ if (msg.message) {
1370
+ if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
1371
+ hasYamlStarted = true;
1372
+ }
1373
+ msg.message = msg.message.replace(/<thinking>/g, '<div class="think-block">').replace(/<\/thinking>/g, '</div>\n');
1374
+ }
1344
1375
  finishedRef.current = false;
1345
1376
  setFinished(false);
1346
1377
  msgStreamingCountRef.current = msgStreamingCountRef.current + 1;
@@ -1357,6 +1388,20 @@ const CustomerService = (props)=>{
1357
1388
  videoPageQuestiionsList(2);
1358
1389
  }
1359
1390
  testLabQuestion(JSON.parse(data).message, content, "");
1391
+ if (shouqiTimer.current) {
1392
+ clearTimeout(shouqiTimer.current);
1393
+ }
1394
+ shouqiTimer.current = setTimeout(()=>{
1395
+ if ($(".think-block").last().css("display") === 'block') {
1396
+ clearTimeout(shouqiTimer.current);
1397
+ $(".think-block").last().parent().find(".think-block").css({
1398
+ display: "none"
1399
+ });
1400
+ $(".think-block").last().parent().parent().find("i").css({
1401
+ transform: "rotate(180deg)"
1402
+ });
1403
+ }
1404
+ }, 1000);
1360
1405
  } else {}
1361
1406
  },
1362
1407
  onclose () {
@@ -1374,7 +1419,8 @@ const CustomerService = (props)=>{
1374
1419
  // console.log(aiSendQuestions().abort(),'slkdsdsdsd')
1375
1420
  if (pageNumHistory > 1) return;
1376
1421
  let obj = msg;
1377
- let id = msg.messageId;
1422
+ let tempId = "ai thought process";
1423
+ let id = tempId; // 原:let id = msg.messageId; 备注:解决思考过程返回的messageId和下边回复的内容值不同问题,新:改成临时固定相同id,finished完成时替换为实际返回的messageId值
1378
1424
  setHistoryMessageList((prevHistoryMessageList)=>{
1379
1425
  let list1 = prevHistoryMessageList;
1380
1426
  //删除临时数据
@@ -1441,6 +1487,17 @@ const CustomerService = (props)=>{
1441
1487
  console.log("isPosition", isPosition.current);
1442
1488
  scrollToBottom();
1443
1489
  if (msg.finished) {
1490
+ setHistoryMessageList((prevHistoryMessageList)=>{
1491
+ return prevHistoryMessageList.map((item)=>{
1492
+ if (item.id === tempId) {
1493
+ return _object_spread_props(_object_spread({}, item), {
1494
+ id: msg.messageId
1495
+ });
1496
+ } else {
1497
+ return item;
1498
+ }
1499
+ });
1500
+ });
1444
1501
  console.log('返回完成', msg, msgStreamingCountRef.current);
1445
1502
  //发送结束
1446
1503
  finishedRef.current = true;
@@ -1545,6 +1602,12 @@ const CustomerService = (props)=>{
1545
1602
  // getHistoryMessage(page-1,5,'1',dataList);
1546
1603
  // return;
1547
1604
  // }
1605
+ dataList = dataList.map((ele, index)=>{
1606
+ if (ele.message.includes("<thinking>") && !ele.message.includes("</thinking>")) {
1607
+ ele.message = ele.message + "</thinking>";
1608
+ }
1609
+ return ele;
1610
+ });
1548
1611
  setPageCount(Math.ceil(total / maxPageSize));
1549
1612
  setFirstItemIndex(total - maxPageSize * (page - 1));
1550
1613
  let newHistoryMessageList = [];
@@ -2298,6 +2361,12 @@ const CustomerService = (props)=>{
2298
2361
  let message = item.message;
2299
2362
  let li;
2300
2363
  // 是否需要显示日期
2364
+ // 判断是否第一项:
2365
+ // 如果是第一项显示日期+时间;
2366
+ //
2367
+ // 如果不是第一项:
2368
+ // 先判断是否跨天;如果跨天:就显示日期+时间;
2369
+ // 如果不跨天:判断是否超过10分钟,超过10分钟判断是否是当天,如果当天显示时间,不是当天就显示日期+时间;没超过10分钟不显示
2301
2370
  let itemIndex = historyMessageList.findIndex((ite)=>ite.id === item.id);
2302
2371
  let time = "";
2303
2372
  if (historyMessageList.length > 1) {
@@ -2307,16 +2376,30 @@ const CustomerService = (props)=>{
2307
2376
  } else {
2308
2377
  //非第一项 与上一项进行对比
2309
2378
  let beforeTime = historyMessageList[itemIndex - 1].createdAt;
2310
- //判断与上一条数据 是否跨天
2311
2379
  let beforeTimeObj = parseDate(beforeTime);
2380
+ // 上一条的日期
2312
2381
  let beforeTimeStr = `${beforeTimeObj.year}-${beforeTimeObj.month}-${beforeTimeObj.day}`;
2382
+ // 当前这条的日期
2313
2383
  let curTimeStr = `${timeObj.year}-${timeObj.month}-${timeObj.day}`;
2384
+ let now = new Date();
2385
+ // 当天的日期
2386
+ let nowTimeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
2387
+ //判断与上一条数据 是否跨天
2314
2388
  if (beforeTimeStr !== curTimeStr) {
2389
+ // 跨天
2390
+ // 显示日期+时间
2315
2391
  time = `${timeObj.year}-${timeObj.month}-${timeObj.day} ${timeObj.hours}:${timeObj.minutes}`;
2316
2392
  } else {
2317
2393
  //没有跨天 判断是否相隔超过10分钟
2318
2394
  if (new Date(item.createdAt).valueOf() - new Date(beforeTime).valueOf() > 10 * 60 * 1000) {
2319
- time = `${timeObj.hours}:${timeObj.minutes}`;
2395
+ //判断是否当天
2396
+ if (curTimeStr === nowTimeStr) {
2397
+ // 当天,显示时间
2398
+ time = `${timeObj.hours}:${timeObj.minutes}`;
2399
+ } else {
2400
+ // 非当天,显示日期+时间
2401
+ time = `${timeObj.year}-${timeObj.month}-${timeObj.day} ${timeObj.hours}:${timeObj.minutes}`;
2402
+ }
2320
2403
  }
2321
2404
  }
2322
2405
  }
@@ -2329,6 +2412,9 @@ const CustomerService = (props)=>{
2329
2412
  message = removeMermaidBlockComments(message);
2330
2413
  }
2331
2414
  message = handleRenderSyntaxBlock(message, finishedRef.current || i != historyMessageList.length - 1);
2415
+ message = message.replace(/<thinking>([\s\S]*?)<\/thinking>/g, '<div class="think-block">$1</div>\n');
2416
+ message = message.replace(/```(\s)?yaml(?:.|\n)*?```/ig, "");
2417
+ message = message.replace(/```\s*yaml[\s\S]*/, '');
2332
2418
  if (lastId == item.id && keyWordProblem != "") {
2333
2419
  //点击历史记录时,找到关键字,防止关键字和标签名重复
2334
2420
  // let key_sign = 'sign_'+new Date().getTime();+'sign';
@@ -2410,6 +2496,8 @@ const CustomerService = (props)=>{
2410
2496
  /*#__PURE__*/ _jsx("i", {
2411
2497
  className: "yinyong_quote1",
2412
2498
  onClick: ()=>{
2499
+ // 问题的引用
2500
+ item.message = replaceThinkAndYaml(item.message);
2413
2501
  setCitationContent({
2414
2502
  content: item.message,
2415
2503
  id: item.id,
@@ -2454,17 +2542,17 @@ const CustomerService = (props)=>{
2454
2542
  },
2455
2543
  className: styles.content_child
2456
2544
  }),
2457
- !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
2458
- className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ""}`,
2545
+ !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo).find((x)=>x.key == "imageUrl") && /*#__PURE__*/ _jsxs("p", {
2546
+ className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ''}`,
2459
2547
  children: [
2460
2548
  /*#__PURE__*/ _jsx("img", {
2461
- src: JSON.parse(item.extraInfo)[0].value
2549
+ src: JSON.parse(item.extraInfo).find((x)=>x.key == "imageUrl").value
2462
2550
  }),
2463
2551
  /*#__PURE__*/ _jsx("div", {
2464
2552
  className: styles.mask_zoom,
2465
2553
  children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
2466
2554
  onClick: ()=>{
2467
- setViewBase64(JSON.parse(item.extraInfo)[0].value);
2555
+ setViewBase64(JSON.parse(item.extraInfo).find((x)=>x.key == "imageUrl").value);
2468
2556
  setVisible(true);
2469
2557
  }
2470
2558
  })
@@ -2479,14 +2567,14 @@ const CustomerService = (props)=>{
2479
2567
  item.quotedMessage && /*#__PURE__*/ _jsxs("div", {
2480
2568
  className: styles.citation_content,
2481
2569
  children: [
2482
- getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
2570
+ getByteLen(replaceThinkAndYaml(item.quotedMessage)) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
2483
2571
  overlayClassName: styles.popover_main_content,
2484
- title: item.quotedMessage,
2572
+ title: replaceThinkAndYaml(item.quotedMessage),
2485
2573
  placement: "leftTop",
2486
2574
  children: /*#__PURE__*/ _jsxs("p", {
2487
2575
  className: styles.text_exceed,
2488
2576
  children: [
2489
- item.quotedMessage,
2577
+ replaceThinkAndYaml(item.quotedMessage),
2490
2578
  /*#__PURE__*/ _jsx(RightOutlined, {})
2491
2579
  ]
2492
2580
  })
@@ -2560,7 +2648,8 @@ const CustomerService = (props)=>{
2560
2648
  style: {
2561
2649
  marginRight: "12px"
2562
2650
  },
2563
- children: isAiChatWindow ? item.extraInfo == null || header == 1 ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
2651
+ children: isAiChatWindow ? // item.extraInfo == null || header == 1
2652
+ userData.modules.some((item)=>item.short == "AIservice") ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
2564
2653
  src: knowledge_icon
2565
2654
  }) : /*#__PURE__*/ _jsx("img", {
2566
2655
  src: headImg
@@ -2639,6 +2728,35 @@ const CustomerService = (props)=>{
2639
2728
  /*#__PURE__*/ _jsxs("div", {
2640
2729
  className: styles.content,
2641
2730
  children: [
2731
+ !exactRegex.test(message) ? null : /*#__PURE__*/ _jsxs("div", {
2732
+ id: "click_" + i,
2733
+ onClick: ()=>{
2734
+ if ($(`#click_${i} + p .think-block`).css("display") === 'inline-block' || $(`#click_${i} + p .think-block`).css("display") === 'block') {
2735
+ $(`#click_${i} + p .think-block`).css({
2736
+ display: "none"
2737
+ });
2738
+ $(`#click_${i} i`).css({
2739
+ transform: "rotate(180deg)"
2740
+ });
2741
+ } else {
2742
+ $(`#click_${i} + p .think-block`).css({
2743
+ display: "block"
2744
+ });
2745
+ $(`#click_${i} i`).css({
2746
+ transform: "rotate(0deg)"
2747
+ });
2748
+ }
2749
+ },
2750
+ className: styles.content_put,
2751
+ children: [
2752
+ /*#__PURE__*/ _jsx("span", {
2753
+ children: "思考过程"
2754
+ }),
2755
+ /*#__PURE__*/ _jsx("i", {
2756
+ className: "iconfont iconfangxiang-xiaxiao"
2757
+ })
2758
+ ]
2759
+ }),
2642
2760
  item.message != "AI助手繁忙,请稍后再提问或" && /*#__PURE__*/ _jsx("p", {
2643
2761
  dangerouslySetInnerHTML: {
2644
2762
  __html: message
@@ -2666,17 +2784,17 @@ const CustomerService = (props)=>{
2666
2784
  })
2667
2785
  ]
2668
2786
  }),
2669
- !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
2670
- className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ""}`,
2787
+ !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo).find((x)=>x.key == "imageUrl") && /*#__PURE__*/ _jsxs("p", {
2788
+ className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ''}`,
2671
2789
  children: [
2672
2790
  /*#__PURE__*/ _jsx("img", {
2673
- src: JSON.parse(item.extraInfo)[0].value
2791
+ src: JSON.parse(item.extraInfo).find((x)=>x.key == "imageUrl").value
2674
2792
  }),
2675
2793
  /*#__PURE__*/ _jsx("div", {
2676
2794
  className: styles.mask_zoom,
2677
2795
  children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
2678
2796
  onClick: ()=>{
2679
- setViewBase64(JSON.parse(item.extraInfo)[0].value);
2797
+ setViewBase64(JSON.parse(item.extraInfo).find((x)=>x.key == "imageUrl").value);
2680
2798
  setVisible(true);
2681
2799
  }
2682
2800
  })
@@ -2717,14 +2835,14 @@ const CustomerService = (props)=>{
2717
2835
  item.quotedMessage && /*#__PURE__*/ _jsxs("div", {
2718
2836
  className: styles.citation_content,
2719
2837
  children: [
2720
- getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
2838
+ getByteLen(replaceThinkAndYaml(item.quotedMessage)) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
2721
2839
  overlayClassName: styles.popover_main_content,
2722
- title: item.quotedMessage,
2840
+ title: replaceThinkAndYaml(item.quotedMessage),
2723
2841
  placement: "rightTop",
2724
2842
  children: /*#__PURE__*/ _jsxs("p", {
2725
2843
  className: styles.text_exceed,
2726
2844
  children: [
2727
- item.quotedMessage,
2845
+ replaceThinkAndYaml(item.quotedMessage),
2728
2846
  /*#__PURE__*/ _jsx(RightOutlined, {})
2729
2847
  ]
2730
2848
  })
@@ -2950,6 +3068,8 @@ const CustomerService = (props)=>{
2950
3068
  /*#__PURE__*/ _jsx("i", {
2951
3069
  className: "yinyong_quote1",
2952
3070
  onClick: ()=>{
3071
+ // 答案的引用
3072
+ item.message = replaceThinkAndYaml(item.message);
2953
3073
  setCitationContent({
2954
3074
  content: item.message,
2955
3075
  imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
@@ -3146,6 +3266,7 @@ const CustomerService = (props)=>{
3146
3266
  /*#__PURE__*/ _jsx("i", {
3147
3267
  className: "yinyong_quote1",
3148
3268
  onClick: ()=>{
3269
+ item.message = replaceThinkAndYaml(item.message);
3149
3270
  setCitationContent({
3150
3271
  content: item.message,
3151
3272
  imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
@@ -3284,44 +3405,48 @@ const CustomerService = (props)=>{
3284
3405
  };
3285
3406
  //发送截图信息
3286
3407
  const sendScreenshotData = (message)=>{
3287
- if (contactsList.length > 0 && contactsList[0].roomId == roomId) {
3288
- setKeyWord("");
3289
- setCitationContent({});
3290
- setBottomRecommendationQuestions([]);
3291
- setHistoryMessageList((historyMessageList)=>{
3292
- let newHistoryMessageList = historyMessageList.concat({
3293
- id: 'p' + new Date().getTime(),
3408
+ if (userData.modules.some((item)=>item.short == "AIservice")) {
3409
+ if (contactsList.length > 0 && contactsList[0].roomId == roomId) {
3410
+ setKeyWord("");
3411
+ setCitationContent({});
3412
+ setBottomRecommendationQuestions([]);
3413
+ setHistoryMessageList((historyMessageList)=>{
3414
+ let newHistoryMessageList = historyMessageList.concat({
3415
+ id: 'p' + new Date().getTime(),
3416
+ roomId: roomId,
3417
+ sender: mid,
3418
+ recevier: 'AI',
3419
+ message: message,
3420
+ createdAt: getDataTime(-1),
3421
+ extraInfo: JSON.stringify([
3422
+ {
3423
+ key: "imageUrl",
3424
+ value: screenshotBese64
3425
+ }
3426
+ ])
3427
+ });
3428
+ return newHistoryMessageList;
3429
+ });
3430
+ //ai窗口
3431
+ aiSendQuestions(3, {
3432
+ //相关数据
3294
3433
  roomId: roomId,
3295
- sender: mid,
3296
- recevier: 'AI',
3297
3434
  message: message,
3298
- createdAt: getDataTime(-1),
3299
- extraInfo: JSON.stringify([
3300
- {
3301
- key: "imageUrl",
3302
- value: screenshotBese64
3303
- }
3304
- ])
3305
- });
3306
- return newHistoryMessageList;
3307
- });
3308
- //ai窗口
3309
- aiSendQuestions(3, {
3310
- //相关数据
3311
- roomId: roomId,
3312
- message: message,
3313
- image: screenshotBese64,
3314
- quotedMessage: citationContent.content || "",
3315
- regenerate: citationContent.content != "" ? false : true,
3316
- generateUpvoteOrDownvoteMessage: false
3317
- }, 1);
3318
- setScreenshotBese64('');
3435
+ image: screenshotBese64,
3436
+ quotedMessage: citationContent.content || "",
3437
+ regenerate: citationContent.content != "" ? false : true,
3438
+ generateUpvoteOrDownvoteMessage: false
3439
+ }, 1);
3440
+ setScreenshotBese64('');
3441
+ } else {
3442
+ //老师窗口
3443
+ sendToTeacher(3, message);
3444
+ }
3445
+ scrollToBottom();
3446
+ resettingBottomHei();
3319
3447
  } else {
3320
- //老师窗口
3321
- sendToTeacher(3, message);
3448
+ sendGreetingMessage(4, message);
3322
3449
  }
3323
- scrollToBottom();
3324
- resettingBottomHei();
3325
3450
  };
3326
3451
  //渲染底部按钮
3327
3452
  const renderBottomAnt = ()=>{
@@ -369,6 +369,42 @@
369
369
  .content_child {
370
370
  padding: 0;
371
371
  line-height: 1;
372
+ img {
373
+ width: 100%;
374
+ }
375
+ :global {
376
+ .think-block {
377
+ padding: 12px;
378
+ border-left: 1px solid rgba(0, 0, 0, 0.15);
379
+ background: rgba(0, 0, 0, 0.04);
380
+ // display: inline-block;
381
+ margin-bottom: 8px;
382
+ width: 100%;
383
+ font-weight: 400;
384
+ font-size: 12px;
385
+ line-height: 1.5;
386
+ color: rgba(0, 0, 0, 0.45);
387
+ * {
388
+ color: rgba(0, 0, 0, 0.45);
389
+ font-weight: 400;
390
+ font-size: 12px;
391
+ line-height: 150%;
392
+ }
393
+ &:not(:first-of-type, :last-of-type){
394
+ padding-top:0;
395
+ padding-bottom: 0;
396
+ }
397
+ &:first-of-type{
398
+ padding-top: 12px !important;
399
+ }
400
+ &:last-of-type{
401
+ padding-bottom: 12px !important;
402
+ }
403
+ &+.think-block{
404
+ margin-top: -8px;
405
+ }
406
+ }
407
+ }
372
408
 
373
409
  p{
374
410
  word-break: break-all;
@@ -441,7 +477,7 @@
441
477
  // > ul + *, > ol + * {
442
478
  // margin-top:16px;
443
479
  // }
444
- > *:not(pre){
480
+ > *:not(pre):not(:global(.think-block)){
445
481
  word-break: break-all;
446
482
  padding-top: 8px;
447
483
  padding-bottom: 8px;
@@ -2279,4 +2315,24 @@ strong {
2279
2315
  padding: 10px;
2280
2316
  }
2281
2317
 
2318
+ }
2319
+
2320
+ .content_put {
2321
+ display: flex;
2322
+ padding: 4px 16px;
2323
+ margin-bottom: 8px;
2324
+ border-radius: 100px;
2325
+ background: rgba(0, 0, 0, 0.04);
2326
+ width: max-content;
2327
+ align-items: center;
2328
+ cursor: pointer;
2329
+ span {
2330
+ color: rgba(0, 0, 0, 0.65);
2331
+ font-size: 12px;
2332
+ font-weight: 400;
2333
+ line-height: 150%;
2334
+ }
2335
+ i {
2336
+ margin-left: 8px;
2337
+ }
2282
2338
  }