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.
- package/dist/index.esm.es5.development.css +1644 -1495
- package/dist/index.esm.es5.development.js +369 -157
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +408 -408
- package/dist/vendor.esm.es5.production.js +12 -12
- package/es2017/AIMessageList/components/footer/index.js +2 -2
- package/es2017/AIMessageList/components/virtuosoList/index.js +11 -2
- package/es2017/customerService/common.module.less +3 -0
- package/es2017/customerService/function.js +5 -2
- package/es2017/customerService/index.js +182 -57
- package/es2017/customerService/index.module.less +57 -1
- package/es2017/customerService/index2.module.less +58 -1
- package/es2017/utils/Date.js +5 -1
- package/esm/AIMessageList/components/footer/index.js +2 -2
- package/esm/AIMessageList/components/virtuosoList/index.js +11 -2
- package/esm/customerService/common.module.less +3 -0
- package/esm/customerService/function.js +5 -2
- package/esm/customerService/index.js +345 -144
- package/esm/customerService/index.module.less +57 -1
- package/esm/customerService/index2.module.less +58 -1
- package/esm/utils/Date.js +4 -0
- package/package.json +1 -1
|
@@ -58,6 +58,13 @@ function escapeHtml(str) {
|
|
|
58
58
|
}
|
|
59
59
|
return str;
|
|
60
60
|
}
|
|
61
|
+
var pattern = /!\[.*?\]\((.*?)\)/;
|
|
62
|
+
var exactRegex = /class\s*=\s*["']think-block["']/;
|
|
63
|
+
// 去掉think
|
|
64
|
+
var replaceThinkAndYaml = function() {
|
|
65
|
+
var text = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
66
|
+
return text.replace(/```(\s)?yaml(?:.|\n)*?```/ig, "").replace(/<thinking>([\s\S]*?)<\/thinking>/g, "").replace(RegExp('<div\\s+class="think-block">.*?<\\/div>', "gs"), "");
|
|
67
|
+
};
|
|
61
68
|
mermaid.initialize({
|
|
62
69
|
startOnLoad: false,
|
|
63
70
|
theme: "default",
|
|
@@ -140,6 +147,7 @@ var CustomerService = function(props) {
|
|
|
140
147
|
var getLisyFlagRef = useRef(0);
|
|
141
148
|
var _useState36 = _sliced_to_array(useState(false), 2), showMemaid = _useState36[0], setShowMemaid = _useState36[1]; //是否显示mermaid弹窗
|
|
142
149
|
var _useState37 = _sliced_to_array(useState(""), 2), memaidContent = _useState37[0], setMemaidContent = _useState37[1]; //mermaid内容
|
|
150
|
+
var shouqiTimer = useRef(null);
|
|
143
151
|
var remarkable = new Remarkable({
|
|
144
152
|
html: true,
|
|
145
153
|
highlight: function highlight(str, lang) {
|
|
@@ -226,6 +234,7 @@ var CustomerService = function(props) {
|
|
|
226
234
|
// //获取热门推荐
|
|
227
235
|
// videoPageQuestiionsList(1);
|
|
228
236
|
// }
|
|
237
|
+
console.log("initShowType", initShowType);
|
|
229
238
|
setShowType(initShowType);
|
|
230
239
|
}, [
|
|
231
240
|
initShowType
|
|
@@ -819,100 +828,176 @@ var CustomerService = function(props) {
|
|
|
819
828
|
});
|
|
820
829
|
};
|
|
821
830
|
//AI窗口,type:1发送打招呼信息欢迎语 2点赞消息 3踩消息 4没有AI客服权限,5,发送超过10万字消息 6, 没有AI客服权限,发送最热的问题
|
|
822
|
-
var sendGreetingMessage = function(
|
|
823
|
-
var
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
return
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
{
|
|
850
|
-
key: "messageSource",
|
|
851
|
-
value: "knowledgebase"
|
|
852
|
-
}
|
|
853
|
-
]
|
|
854
|
-
};
|
|
855
|
-
} else if (type == 4) {
|
|
856
|
-
obj = {
|
|
857
|
-
roomId: roomId,
|
|
858
|
-
sender: mid,
|
|
859
|
-
recevier: "AI",
|
|
860
|
-
message: keyWord,
|
|
861
|
-
createdAt: getDataTime(-1),
|
|
862
|
-
quotedMessage: citationContent.content,
|
|
863
|
-
extraInfos: [
|
|
864
|
-
{
|
|
865
|
-
key: "messageSource",
|
|
866
|
-
value: "knowledgebase"
|
|
867
|
-
}
|
|
868
|
-
]
|
|
869
|
-
};
|
|
870
|
-
} else if (type == 5) {
|
|
871
|
-
obj = {
|
|
872
|
-
roomId: roomId,
|
|
873
|
-
sender: "AI",
|
|
874
|
-
recevier: mid,
|
|
875
|
-
message: "抱歉!您今日的提问量已经达到最大限额,请您明日再来提问。",
|
|
876
|
-
createdAt: getDataTime(-1),
|
|
877
|
-
quotedMessage: citationContent.content,
|
|
878
|
-
extraInfos: [
|
|
879
|
-
{
|
|
880
|
-
key: "messageSource",
|
|
881
|
-
value: "knowledgebase"
|
|
882
|
-
}
|
|
883
|
-
]
|
|
884
|
-
};
|
|
885
|
-
} else if (type == 6) {
|
|
886
|
-
getAssociativeProblem();
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
setKeyWord("");
|
|
890
|
-
setQuestionsList([]);
|
|
891
|
-
setCitationContent({});
|
|
892
|
-
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
893
|
-
if (res.data.id) {
|
|
894
|
-
if (pageNumHistory <= 1) {
|
|
895
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
896
|
-
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
897
|
-
id: res.data.id,
|
|
898
|
-
upvoted: false,
|
|
899
|
-
downvoted: false,
|
|
900
|
-
quotedMessage: "",
|
|
831
|
+
var sendGreetingMessage = function() {
|
|
832
|
+
var _ref = _async_to_generator(function(type) {
|
|
833
|
+
var message, obj, imageUrl, base64;
|
|
834
|
+
var _arguments = arguments;
|
|
835
|
+
return _ts_generator(this, function(_state) {
|
|
836
|
+
switch(_state.label){
|
|
837
|
+
case 0:
|
|
838
|
+
message = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : "";
|
|
839
|
+
obj = {};
|
|
840
|
+
if (!(type == 1)) return [
|
|
841
|
+
3,
|
|
842
|
+
1
|
|
843
|
+
];
|
|
844
|
+
sendWelcomMessage();
|
|
845
|
+
return [
|
|
846
|
+
2
|
|
847
|
+
];
|
|
848
|
+
case 1:
|
|
849
|
+
if (!(type == 2)) return [
|
|
850
|
+
3,
|
|
851
|
+
2
|
|
852
|
+
];
|
|
853
|
+
obj = {
|
|
854
|
+
roomId: roomId,
|
|
855
|
+
sender: "AI",
|
|
856
|
+
recevier: mid,
|
|
857
|
+
message: "您的点赞是我最大的鼓励!",
|
|
901
858
|
createdAt: getDataTime(-1),
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
859
|
+
extraInfos: [
|
|
860
|
+
{
|
|
861
|
+
key: "messageSource",
|
|
862
|
+
value: "knowledgebase"
|
|
863
|
+
}
|
|
864
|
+
]
|
|
865
|
+
};
|
|
866
|
+
return [
|
|
867
|
+
3,
|
|
868
|
+
7
|
|
869
|
+
];
|
|
870
|
+
case 2:
|
|
871
|
+
if (!(type == 3)) return [
|
|
872
|
+
3,
|
|
873
|
+
3
|
|
874
|
+
];
|
|
875
|
+
obj = {
|
|
876
|
+
roomId: roomId,
|
|
877
|
+
sender: "AI",
|
|
878
|
+
recevier: mid,
|
|
879
|
+
message: "谢谢您的反馈,我会努力改进的!",
|
|
880
|
+
createdAt: getDataTime(-1),
|
|
881
|
+
extraInfos: [
|
|
882
|
+
{
|
|
883
|
+
key: "messageSource",
|
|
884
|
+
value: "knowledgebase"
|
|
885
|
+
}
|
|
886
|
+
]
|
|
887
|
+
};
|
|
888
|
+
return [
|
|
889
|
+
3,
|
|
890
|
+
7
|
|
891
|
+
];
|
|
892
|
+
case 3:
|
|
893
|
+
if (!(type == 4)) return [
|
|
894
|
+
3,
|
|
895
|
+
6
|
|
896
|
+
];
|
|
897
|
+
obj = {
|
|
898
|
+
roomId: roomId,
|
|
899
|
+
sender: mid,
|
|
900
|
+
recevier: "AI",
|
|
901
|
+
message: message ? message : keyWord,
|
|
902
|
+
createdAt: getDataTime(-1),
|
|
903
|
+
quotedMessage: citationContent.content,
|
|
904
|
+
extraInfos: [
|
|
905
|
+
{
|
|
906
|
+
key: "messageSource",
|
|
907
|
+
value: "knowledgebase"
|
|
908
|
+
}
|
|
909
|
+
]
|
|
910
|
+
};
|
|
911
|
+
imageUrl = "";
|
|
912
|
+
if (!citationContent.imageUrl) return [
|
|
913
|
+
3,
|
|
914
|
+
5
|
|
915
|
+
];
|
|
916
|
+
return [
|
|
917
|
+
4,
|
|
918
|
+
urlToBase64(citationContent.imageUrl)
|
|
919
|
+
];
|
|
920
|
+
case 4:
|
|
921
|
+
base64 = _state.sent();
|
|
922
|
+
imageUrl = base64;
|
|
923
|
+
_state.label = 5;
|
|
924
|
+
case 5:
|
|
925
|
+
if (screenshotBese64) {
|
|
926
|
+
imageUrl = screenshotBese64;
|
|
927
|
+
}
|
|
928
|
+
console.log("imageUrl", imageUrl);
|
|
929
|
+
if (imageUrl) {
|
|
930
|
+
obj.image = imageUrl;
|
|
931
|
+
obj.extraInfos.push({
|
|
932
|
+
key: "imageUrl",
|
|
933
|
+
value: imageUrl
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
return [
|
|
937
|
+
3,
|
|
938
|
+
7
|
|
939
|
+
];
|
|
940
|
+
case 6:
|
|
941
|
+
if (type == 5) {
|
|
942
|
+
obj = {
|
|
943
|
+
roomId: roomId,
|
|
944
|
+
sender: "AI",
|
|
945
|
+
recevier: mid,
|
|
946
|
+
message: "抱歉!您今日的提问量已经达到最大限额,请您明日再来提问。",
|
|
947
|
+
createdAt: getDataTime(-1),
|
|
948
|
+
quotedMessage: citationContent.content,
|
|
949
|
+
extraInfos: [
|
|
950
|
+
{
|
|
951
|
+
key: "messageSource",
|
|
952
|
+
value: "knowledgebase"
|
|
953
|
+
}
|
|
954
|
+
]
|
|
955
|
+
};
|
|
956
|
+
} else if (type == 6) {
|
|
957
|
+
getAssociativeProblem();
|
|
958
|
+
return [
|
|
959
|
+
2
|
|
960
|
+
];
|
|
961
|
+
}
|
|
962
|
+
_state.label = 7;
|
|
963
|
+
case 7:
|
|
964
|
+
setKeyWord("");
|
|
965
|
+
setQuestionsList([]);
|
|
966
|
+
setCitationContent({});
|
|
967
|
+
setScreenshotBese64("");
|
|
968
|
+
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
969
|
+
if (res.data.id) {
|
|
970
|
+
if (pageNumHistory <= 1) {
|
|
971
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
972
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
973
|
+
id: res.data.id,
|
|
974
|
+
upvoted: false,
|
|
975
|
+
downvoted: false,
|
|
976
|
+
quotedMessage: "",
|
|
977
|
+
createdAt: getDataTime(-1),
|
|
978
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
979
|
+
}));
|
|
980
|
+
return newHistoryMessageList;
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
scrollToBottom();
|
|
984
|
+
if (type == 4) {
|
|
985
|
+
sendGreetingMessage(6);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}).catch(function(err) {
|
|
989
|
+
console.log(err);
|
|
990
|
+
});
|
|
991
|
+
return [
|
|
992
|
+
2
|
|
993
|
+
];
|
|
910
994
|
}
|
|
911
|
-
}
|
|
912
|
-
}).catch(function(err) {
|
|
913
|
-
console.log(err);
|
|
995
|
+
});
|
|
914
996
|
});
|
|
915
|
-
|
|
997
|
+
return function sendGreetingMessage(type) {
|
|
998
|
+
return _ref.apply(this, arguments);
|
|
999
|
+
};
|
|
1000
|
+
}();
|
|
916
1001
|
//消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
|
|
917
1002
|
var sendToTeacher = function() {
|
|
918
1003
|
var _ref = _async_to_generator(function(type) {
|
|
@@ -1292,7 +1377,7 @@ var CustomerService = function(props) {
|
|
|
1292
1377
|
roomId: roomId,
|
|
1293
1378
|
sender: "AI",
|
|
1294
1379
|
recevier: mid,
|
|
1295
|
-
message: "
|
|
1380
|
+
message: "正在思考...",
|
|
1296
1381
|
id: "123456",
|
|
1297
1382
|
createdAt: getDataTime(-1),
|
|
1298
1383
|
extraInfo: null
|
|
@@ -1306,7 +1391,7 @@ var CustomerService = function(props) {
|
|
|
1306
1391
|
roomId: roomId,
|
|
1307
1392
|
sender: "AI",
|
|
1308
1393
|
recevier: mid,
|
|
1309
|
-
message: "
|
|
1394
|
+
message: "正在思考...",
|
|
1310
1395
|
id: "123456",
|
|
1311
1396
|
createdAt: getDataTime(-1),
|
|
1312
1397
|
extraInfo: null
|
|
@@ -1319,6 +1404,7 @@ var CustomerService = function(props) {
|
|
|
1319
1404
|
//先请求问题列表
|
|
1320
1405
|
videoPageQuestiionsList(3);
|
|
1321
1406
|
}
|
|
1407
|
+
var hasYamlStarted = false;
|
|
1322
1408
|
//使用fetchEventSource接收数据
|
|
1323
1409
|
var eventSource = fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
1324
1410
|
method: "POST",
|
|
@@ -1428,7 +1514,12 @@ var CustomerService = function(props) {
|
|
|
1428
1514
|
//识别的内容
|
|
1429
1515
|
// console.log("eventSource msg: ", event.data);
|
|
1430
1516
|
var msg = JSON.parse(event.data);
|
|
1431
|
-
if (msg.message) {
|
|
1517
|
+
if (msg.message) {
|
|
1518
|
+
if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
1519
|
+
hasYamlStarted = true;
|
|
1520
|
+
}
|
|
1521
|
+
msg.message = msg.message.replace(/<thinking>/g, '<div class="think-block">').replace(/<\/thinking>/g, "</div>\n");
|
|
1522
|
+
}
|
|
1432
1523
|
finishedRef.current = false;
|
|
1433
1524
|
setFinished(false);
|
|
1434
1525
|
msgStreamingCountRef.current = msgStreamingCountRef.current + 1;
|
|
@@ -1445,6 +1536,20 @@ var CustomerService = function(props) {
|
|
|
1445
1536
|
videoPageQuestiionsList(2);
|
|
1446
1537
|
}
|
|
1447
1538
|
testLabQuestion(JSON.parse(data).message, content, "");
|
|
1539
|
+
if (shouqiTimer.current) {
|
|
1540
|
+
clearTimeout(shouqiTimer.current);
|
|
1541
|
+
}
|
|
1542
|
+
shouqiTimer.current = setTimeout(function() {
|
|
1543
|
+
if ($(".think-block").last().css("display") === "block") {
|
|
1544
|
+
clearTimeout(shouqiTimer.current);
|
|
1545
|
+
$(".think-block").last().parent().find(".think-block").css({
|
|
1546
|
+
display: "none"
|
|
1547
|
+
});
|
|
1548
|
+
$(".think-block").last().parent().parent().find("i").css({
|
|
1549
|
+
transform: "rotate(180deg)"
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
}, 1000);
|
|
1448
1553
|
} else {}
|
|
1449
1554
|
},
|
|
1450
1555
|
onclose: function onclose() {
|
|
@@ -1464,7 +1569,8 @@ var CustomerService = function(props) {
|
|
|
1464
1569
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
1465
1570
|
if (pageNumHistory > 1) return;
|
|
1466
1571
|
var obj = msg;
|
|
1467
|
-
var
|
|
1572
|
+
var tempId = "ai thought process";
|
|
1573
|
+
var id = tempId; // 原:let id = msg.messageId; 备注:解决思考过程返回的messageId和下边回复的内容值不同问题,新:改成临时固定相同id,finished完成时替换为实际返回的messageId值
|
|
1468
1574
|
setHistoryMessageList(function(prevHistoryMessageList) {
|
|
1469
1575
|
var list1 = prevHistoryMessageList;
|
|
1470
1576
|
//删除临时数据
|
|
@@ -1531,6 +1637,17 @@ var CustomerService = function(props) {
|
|
|
1531
1637
|
console.log("isPosition", isPosition.current);
|
|
1532
1638
|
scrollToBottom();
|
|
1533
1639
|
if (msg.finished) {
|
|
1640
|
+
setHistoryMessageList(function(prevHistoryMessageList) {
|
|
1641
|
+
return prevHistoryMessageList.map(function(item) {
|
|
1642
|
+
if (item.id === tempId) {
|
|
1643
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
1644
|
+
id: msg.messageId
|
|
1645
|
+
});
|
|
1646
|
+
} else {
|
|
1647
|
+
return item;
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
1650
|
+
});
|
|
1534
1651
|
console.log("返回完成", msg, msgStreamingCountRef.current);
|
|
1535
1652
|
//发送结束
|
|
1536
1653
|
finishedRef.current = true;
|
|
@@ -1638,6 +1755,12 @@ var CustomerService = function(props) {
|
|
|
1638
1755
|
// getHistoryMessage(page-1,5,'1',dataList);
|
|
1639
1756
|
// return;
|
|
1640
1757
|
// }
|
|
1758
|
+
dataList = dataList.map(function(ele, index) {
|
|
1759
|
+
if (ele.message.includes("<thinking>") && !ele.message.includes("</thinking>")) {
|
|
1760
|
+
ele.message = ele.message + "</thinking>";
|
|
1761
|
+
}
|
|
1762
|
+
return ele;
|
|
1763
|
+
});
|
|
1641
1764
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
1642
1765
|
setFirstItemIndex(total - maxPageSize * (page - 1));
|
|
1643
1766
|
var newHistoryMessageList = [];
|
|
@@ -2417,6 +2540,12 @@ var CustomerService = function(props) {
|
|
|
2417
2540
|
var message = item.message;
|
|
2418
2541
|
var li;
|
|
2419
2542
|
// 是否需要显示日期
|
|
2543
|
+
// 判断是否第一项:
|
|
2544
|
+
// 如果是第一项显示日期+时间;
|
|
2545
|
+
//
|
|
2546
|
+
// 如果不是第一项:
|
|
2547
|
+
// 先判断是否跨天;如果跨天:就显示日期+时间;
|
|
2548
|
+
// 如果不跨天:判断是否超过10分钟,超过10分钟判断是否是当天,如果当天显示时间,不是当天就显示日期+时间;没超过10分钟不显示
|
|
2420
2549
|
var itemIndex = historyMessageList.findIndex(function(ite) {
|
|
2421
2550
|
return ite.id === item.id;
|
|
2422
2551
|
});
|
|
@@ -2428,16 +2557,30 @@ var CustomerService = function(props) {
|
|
|
2428
2557
|
} else {
|
|
2429
2558
|
//非第一项 与上一项进行对比
|
|
2430
2559
|
var beforeTime = historyMessageList[itemIndex - 1].createdAt;
|
|
2431
|
-
//判断与上一条数据 是否跨天
|
|
2432
2560
|
var beforeTimeObj = parseDate(beforeTime);
|
|
2561
|
+
// 上一条的日期
|
|
2433
2562
|
var beforeTimeStr = "".concat(beforeTimeObj.year, "-").concat(beforeTimeObj.month, "-").concat(beforeTimeObj.day);
|
|
2563
|
+
// 当前这条的日期
|
|
2434
2564
|
var curTimeStr = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day);
|
|
2565
|
+
var now = new Date();
|
|
2566
|
+
// 当天的日期
|
|
2567
|
+
var nowTimeStr = "".concat(now.getFullYear(), "-").concat(String(now.getMonth() + 1).padStart(2, "0"), "-").concat(String(now.getDate()).padStart(2, "0"));
|
|
2568
|
+
//判断与上一条数据 是否跨天
|
|
2435
2569
|
if (beforeTimeStr !== curTimeStr) {
|
|
2570
|
+
// 跨天
|
|
2571
|
+
// 显示日期+时间
|
|
2436
2572
|
time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
2437
2573
|
} else {
|
|
2438
2574
|
//没有跨天 判断是否相隔超过10分钟
|
|
2439
2575
|
if (new Date(item.createdAt).valueOf() - new Date(beforeTime).valueOf() > 10 * 60 * 1000) {
|
|
2440
|
-
|
|
2576
|
+
//判断是否当天
|
|
2577
|
+
if (curTimeStr === nowTimeStr) {
|
|
2578
|
+
// 当天,显示时间
|
|
2579
|
+
time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
2580
|
+
} else {
|
|
2581
|
+
// 非当天,显示日期+时间
|
|
2582
|
+
time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
2583
|
+
}
|
|
2441
2584
|
}
|
|
2442
2585
|
}
|
|
2443
2586
|
}
|
|
@@ -2450,6 +2593,9 @@ var CustomerService = function(props) {
|
|
|
2450
2593
|
message = removeMermaidBlockComments(message);
|
|
2451
2594
|
}
|
|
2452
2595
|
message = handleRenderSyntaxBlock(message, finishedRef.current || i != historyMessageList.length - 1);
|
|
2596
|
+
message = message.replace(/<thinking>([\s\S]*?)<\/thinking>/g, '<div class="think-block">$1</div>\n');
|
|
2597
|
+
message = message.replace(/```(\s)?yaml(?:.|\n)*?```/ig, "");
|
|
2598
|
+
message = message.replace(/```\s*yaml[\s\S]*/, "");
|
|
2453
2599
|
if (lastId == item.id && keyWordProblem != "") {
|
|
2454
2600
|
//点击历史记录时,找到关键字,防止关键字和标签名重复
|
|
2455
2601
|
// let key_sign = 'sign_'+new Date().getTime();+'sign';
|
|
@@ -2498,6 +2644,8 @@ var CustomerService = function(props) {
|
|
|
2498
2644
|
/*#__PURE__*/ _jsx("i", {
|
|
2499
2645
|
className: "yinyong_quote1",
|
|
2500
2646
|
onClick: function() {
|
|
2647
|
+
// 问题的引用
|
|
2648
|
+
item.message = replaceThinkAndYaml(item.message);
|
|
2501
2649
|
setCitationContent({
|
|
2502
2650
|
content: item.message,
|
|
2503
2651
|
id: item.id,
|
|
@@ -2548,17 +2696,23 @@ var CustomerService = function(props) {
|
|
|
2548
2696
|
},
|
|
2549
2697
|
className: styles.content_child
|
|
2550
2698
|
}),
|
|
2551
|
-
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)
|
|
2699
|
+
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo).find(function(x) {
|
|
2700
|
+
return x.key == "imageUrl";
|
|
2701
|
+
}) && /*#__PURE__*/ _jsxs("p", {
|
|
2552
2702
|
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
2553
2703
|
children: [
|
|
2554
2704
|
/*#__PURE__*/ _jsx("img", {
|
|
2555
|
-
src: JSON.parse(item.extraInfo)
|
|
2705
|
+
src: JSON.parse(item.extraInfo).find(function(x) {
|
|
2706
|
+
return x.key == "imageUrl";
|
|
2707
|
+
}).value
|
|
2556
2708
|
}),
|
|
2557
2709
|
/*#__PURE__*/ _jsx("div", {
|
|
2558
2710
|
className: styles.mask_zoom,
|
|
2559
2711
|
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
2560
2712
|
onClick: function() {
|
|
2561
|
-
setViewBase64(JSON.parse(item.extraInfo)
|
|
2713
|
+
setViewBase64(JSON.parse(item.extraInfo).find(function(x) {
|
|
2714
|
+
return x.key == "imageUrl";
|
|
2715
|
+
}).value);
|
|
2562
2716
|
setVisible(true);
|
|
2563
2717
|
}
|
|
2564
2718
|
})
|
|
@@ -2573,14 +2727,14 @@ var CustomerService = function(props) {
|
|
|
2573
2727
|
item.quotedMessage && /*#__PURE__*/ _jsxs("div", {
|
|
2574
2728
|
className: styles.citation_content,
|
|
2575
2729
|
children: [
|
|
2576
|
-
getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
2730
|
+
getByteLen(replaceThinkAndYaml(item.quotedMessage)) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
2577
2731
|
overlayClassName: styles.popover_main_content,
|
|
2578
|
-
title: item.quotedMessage,
|
|
2732
|
+
title: replaceThinkAndYaml(item.quotedMessage),
|
|
2579
2733
|
placement: "leftTop",
|
|
2580
2734
|
children: /*#__PURE__*/ _jsxs("p", {
|
|
2581
2735
|
className: styles.text_exceed,
|
|
2582
2736
|
children: [
|
|
2583
|
-
item.quotedMessage,
|
|
2737
|
+
replaceThinkAndYaml(item.quotedMessage),
|
|
2584
2738
|
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
2585
2739
|
]
|
|
2586
2740
|
})
|
|
@@ -2656,7 +2810,10 @@ var CustomerService = function(props) {
|
|
|
2656
2810
|
style: {
|
|
2657
2811
|
marginRight: "12px"
|
|
2658
2812
|
},
|
|
2659
|
-
children: isAiChatWindow ? item.extraInfo == null || header == 1
|
|
2813
|
+
children: isAiChatWindow ? // item.extraInfo == null || header == 1
|
|
2814
|
+
userData.modules.some(function(item) {
|
|
2815
|
+
return item.short == "AIservice";
|
|
2816
|
+
}) ? /*#__PURE__*/ _jsx(CustomAiIcon, {}) : /*#__PURE__*/ _jsx("img", {
|
|
2660
2817
|
src: knowledge_icon
|
|
2661
2818
|
}) : /*#__PURE__*/ _jsx("img", {
|
|
2662
2819
|
src: headImg
|
|
@@ -2735,6 +2892,35 @@ var CustomerService = function(props) {
|
|
|
2735
2892
|
/*#__PURE__*/ _jsxs("div", {
|
|
2736
2893
|
className: styles.content,
|
|
2737
2894
|
children: [
|
|
2895
|
+
!exactRegex.test(message) ? null : /*#__PURE__*/ _jsxs("div", {
|
|
2896
|
+
id: "click_" + i,
|
|
2897
|
+
onClick: function() {
|
|
2898
|
+
if ($("#click_".concat(i, " + p .think-block")).css("display") === "inline-block" || $("#click_".concat(i, " + p .think-block")).css("display") === "block") {
|
|
2899
|
+
$("#click_".concat(i, " + p .think-block")).css({
|
|
2900
|
+
display: "none"
|
|
2901
|
+
});
|
|
2902
|
+
$("#click_".concat(i, " i")).css({
|
|
2903
|
+
transform: "rotate(180deg)"
|
|
2904
|
+
});
|
|
2905
|
+
} else {
|
|
2906
|
+
$("#click_".concat(i, " + p .think-block")).css({
|
|
2907
|
+
display: "block"
|
|
2908
|
+
});
|
|
2909
|
+
$("#click_".concat(i, " i")).css({
|
|
2910
|
+
transform: "rotate(0deg)"
|
|
2911
|
+
});
|
|
2912
|
+
}
|
|
2913
|
+
},
|
|
2914
|
+
className: styles.content_put,
|
|
2915
|
+
children: [
|
|
2916
|
+
/*#__PURE__*/ _jsx("span", {
|
|
2917
|
+
children: "思考过程"
|
|
2918
|
+
}),
|
|
2919
|
+
/*#__PURE__*/ _jsx("i", {
|
|
2920
|
+
className: "iconfont iconfangxiang-xiaxiao"
|
|
2921
|
+
})
|
|
2922
|
+
]
|
|
2923
|
+
}),
|
|
2738
2924
|
item.message != "AI助手繁忙,请稍后再提问或" && /*#__PURE__*/ _jsx("p", {
|
|
2739
2925
|
dangerouslySetInnerHTML: {
|
|
2740
2926
|
__html: message
|
|
@@ -2762,17 +2948,23 @@ var CustomerService = function(props) {
|
|
|
2762
2948
|
})
|
|
2763
2949
|
]
|
|
2764
2950
|
}),
|
|
2765
|
-
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)
|
|
2951
|
+
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo).find(function(x) {
|
|
2952
|
+
return x.key == "imageUrl";
|
|
2953
|
+
}) && /*#__PURE__*/ _jsxs("p", {
|
|
2766
2954
|
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
2767
2955
|
children: [
|
|
2768
2956
|
/*#__PURE__*/ _jsx("img", {
|
|
2769
|
-
src: JSON.parse(item.extraInfo)
|
|
2957
|
+
src: JSON.parse(item.extraInfo).find(function(x) {
|
|
2958
|
+
return x.key == "imageUrl";
|
|
2959
|
+
}).value
|
|
2770
2960
|
}),
|
|
2771
2961
|
/*#__PURE__*/ _jsx("div", {
|
|
2772
2962
|
className: styles.mask_zoom,
|
|
2773
2963
|
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
2774
2964
|
onClick: function() {
|
|
2775
|
-
setViewBase64(JSON.parse(item.extraInfo)
|
|
2965
|
+
setViewBase64(JSON.parse(item.extraInfo).find(function(x) {
|
|
2966
|
+
return x.key == "imageUrl";
|
|
2967
|
+
}).value);
|
|
2776
2968
|
setVisible(true);
|
|
2777
2969
|
}
|
|
2778
2970
|
})
|
|
@@ -2813,14 +3005,14 @@ var CustomerService = function(props) {
|
|
|
2813
3005
|
item.quotedMessage && /*#__PURE__*/ _jsxs("div", {
|
|
2814
3006
|
className: styles.citation_content,
|
|
2815
3007
|
children: [
|
|
2816
|
-
getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
3008
|
+
getByteLen(replaceThinkAndYaml(item.quotedMessage)) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
2817
3009
|
overlayClassName: styles.popover_main_content,
|
|
2818
|
-
title: item.quotedMessage,
|
|
3010
|
+
title: replaceThinkAndYaml(item.quotedMessage),
|
|
2819
3011
|
placement: "rightTop",
|
|
2820
3012
|
children: /*#__PURE__*/ _jsxs("p", {
|
|
2821
3013
|
className: styles.text_exceed,
|
|
2822
3014
|
children: [
|
|
2823
|
-
item.quotedMessage,
|
|
3015
|
+
replaceThinkAndYaml(item.quotedMessage),
|
|
2824
3016
|
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
2825
3017
|
]
|
|
2826
3018
|
})
|
|
@@ -3048,6 +3240,8 @@ var CustomerService = function(props) {
|
|
|
3048
3240
|
/*#__PURE__*/ _jsx("i", {
|
|
3049
3241
|
className: "yinyong_quote1",
|
|
3050
3242
|
onClick: function() {
|
|
3243
|
+
// 答案的引用
|
|
3244
|
+
item.message = replaceThinkAndYaml(item.message);
|
|
3051
3245
|
setCitationContent({
|
|
3052
3246
|
content: item.message,
|
|
3053
3247
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
@@ -3256,6 +3450,7 @@ var CustomerService = function(props) {
|
|
|
3256
3450
|
/*#__PURE__*/ _jsx("i", {
|
|
3257
3451
|
className: "yinyong_quote1",
|
|
3258
3452
|
onClick: function() {
|
|
3453
|
+
item.message = replaceThinkAndYaml(item.message);
|
|
3259
3454
|
setCitationContent({
|
|
3260
3455
|
content: item.message,
|
|
3261
3456
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
@@ -3401,44 +3596,50 @@ var CustomerService = function(props) {
|
|
|
3401
3596
|
};
|
|
3402
3597
|
//发送截图信息
|
|
3403
3598
|
var sendScreenshotData = function(message) {
|
|
3404
|
-
if (
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3599
|
+
if (userData.modules.some(function(item) {
|
|
3600
|
+
return item.short == "AIservice";
|
|
3601
|
+
})) {
|
|
3602
|
+
if (contactsList.length > 0 && contactsList[0].roomId == roomId) {
|
|
3603
|
+
setKeyWord("");
|
|
3604
|
+
setCitationContent({});
|
|
3605
|
+
setBottomRecommendationQuestions([]);
|
|
3606
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3607
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
3608
|
+
id: "p" + new Date().getTime(),
|
|
3609
|
+
roomId: roomId,
|
|
3610
|
+
sender: mid,
|
|
3611
|
+
recevier: "AI",
|
|
3612
|
+
message: message,
|
|
3613
|
+
createdAt: getDataTime(-1),
|
|
3614
|
+
extraInfo: JSON.stringify([
|
|
3615
|
+
{
|
|
3616
|
+
key: "imageUrl",
|
|
3617
|
+
value: screenshotBese64
|
|
3618
|
+
}
|
|
3619
|
+
])
|
|
3620
|
+
});
|
|
3621
|
+
return newHistoryMessageList;
|
|
3622
|
+
});
|
|
3623
|
+
//ai窗口
|
|
3624
|
+
aiSendQuestions(3, {
|
|
3625
|
+
//相关数据
|
|
3411
3626
|
roomId: roomId,
|
|
3412
|
-
sender: mid,
|
|
3413
|
-
recevier: "AI",
|
|
3414
3627
|
message: message,
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
}
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
//相关数据
|
|
3428
|
-
roomId: roomId,
|
|
3429
|
-
message: message,
|
|
3430
|
-
image: screenshotBese64,
|
|
3431
|
-
quotedMessage: citationContent.content || "",
|
|
3432
|
-
regenerate: citationContent.content != "" ? false : true,
|
|
3433
|
-
generateUpvoteOrDownvoteMessage: false
|
|
3434
|
-
}, 1);
|
|
3435
|
-
setScreenshotBese64("");
|
|
3628
|
+
image: screenshotBese64,
|
|
3629
|
+
quotedMessage: citationContent.content || "",
|
|
3630
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
3631
|
+
generateUpvoteOrDownvoteMessage: false
|
|
3632
|
+
}, 1);
|
|
3633
|
+
setScreenshotBese64("");
|
|
3634
|
+
} else {
|
|
3635
|
+
//老师窗口
|
|
3636
|
+
sendToTeacher(3, message);
|
|
3637
|
+
}
|
|
3638
|
+
scrollToBottom();
|
|
3639
|
+
resettingBottomHei();
|
|
3436
3640
|
} else {
|
|
3437
|
-
|
|
3438
|
-
sendToTeacher(3, message);
|
|
3641
|
+
sendGreetingMessage(4, message);
|
|
3439
3642
|
}
|
|
3440
|
-
scrollToBottom();
|
|
3441
|
-
resettingBottomHei();
|
|
3442
3643
|
};
|
|
3443
3644
|
//渲染底部按钮
|
|
3444
3645
|
var renderBottomAnt = function() {
|