bhd-components 0.10.38 → 0.10.39
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.js +43 -57
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +1 -1
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/customerService/index.js +33 -45
- package/esm/customerService/index.js +33 -45
- package/package.json +1 -1
|
@@ -8184,6 +8184,16 @@ var ScreenShot = /*#__PURE__*/ function() {
|
|
|
8184
8184
|
return ScreenShot;
|
|
8185
8185
|
}();
|
|
8186
8186
|
|
|
8187
|
+
var guidGenerator = function() {
|
|
8188
|
+
var d = new Date().getTime();
|
|
8189
|
+
var uuid = "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
8190
|
+
var r = (d + Math.random() * 16) % 16 | 0;
|
|
8191
|
+
d = Math.floor(d / 16);
|
|
8192
|
+
return (c == "x" ? r : r & 3 | 8).toString(16);
|
|
8193
|
+
});
|
|
8194
|
+
return uuid;
|
|
8195
|
+
};
|
|
8196
|
+
|
|
8187
8197
|
var styles = modules_63b47c51$f;
|
|
8188
8198
|
var TextArea$1 = BhdEnterInput.TextArea;
|
|
8189
8199
|
/*
|
|
@@ -8209,7 +8219,7 @@ var exactRegex = /class\s*=\s*["']think-block["']/;
|
|
|
8209
8219
|
// 去掉think
|
|
8210
8220
|
var replaceThinkAndYaml = function() {
|
|
8211
8221
|
var text = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
8212
|
-
return text.replace(/```(\s)?yaml(?:.|\n)*?```/ig, "").replace(/<thinking>([\s\S]*?)<\/thinking>/g, "").replace(RegExp('<div\\s+class="think-block">.*?<\\/div>', "gs"), "");
|
|
8222
|
+
return text.replace(/```(\s)?yaml(?:.|\n)*?```/ig, "").replace(/<thinking>([\s\S]*?)<\/thinking>/g, "").replace(RegExp('<div\\s+class="think-block">.*?<\\/div>', "gs"), "").replace(/^[ \n]+/g, "");
|
|
8213
8223
|
};
|
|
8214
8224
|
r.initialize({
|
|
8215
8225
|
startOnLoad: false,
|
|
@@ -8277,7 +8287,7 @@ var CustomerService = function(props) {
|
|
|
8277
8287
|
var ctrl = useRef(); //停止生成ai回答时使用
|
|
8278
8288
|
var childRef = useRef(null); //获取子组件方法
|
|
8279
8289
|
useRef(0);
|
|
8280
|
-
var _useState33 = _sliced_to_array(useState(true), 2)
|
|
8290
|
+
var _useState33 = _sliced_to_array(useState(true), 2); _useState33[0]; var setIsPositionState = _useState33[1];
|
|
8281
8291
|
var isPosition = useRef(true);
|
|
8282
8292
|
var recommendeQuestionID = useRef([]); //推荐问题id
|
|
8283
8293
|
var videoHotQuestionsList = useRef([]); //视频热门问题
|
|
@@ -9550,7 +9560,7 @@ var CustomerService = function(props) {
|
|
|
9550
9560
|
//先请求问题列表
|
|
9551
9561
|
videoPageQuestiionsList(3);
|
|
9552
9562
|
}
|
|
9553
|
-
var
|
|
9563
|
+
var tempMessageId = guidGenerator();
|
|
9554
9564
|
//使用fetchEventSource接收数据
|
|
9555
9565
|
fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
9556
9566
|
method: "POST",
|
|
@@ -9658,10 +9668,11 @@ var CustomerService = function(props) {
|
|
|
9658
9668
|
//识别的内容
|
|
9659
9669
|
// console.log("eventSource msg: ", event.data);
|
|
9660
9670
|
var msg = JSON.parse(event.data);
|
|
9671
|
+
msg.tempMessageId = tempMessageId;
|
|
9661
9672
|
if (msg.message) {
|
|
9662
|
-
if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
9663
|
-
|
|
9664
|
-
}
|
|
9673
|
+
// if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
9674
|
+
// hasYamlStarted = true;
|
|
9675
|
+
// }
|
|
9665
9676
|
msg.message = msg.message.replace(/<thinking>/g, '<div class="think-block">').replace(/<\/thinking>/g, "</div>\n");
|
|
9666
9677
|
}
|
|
9667
9678
|
finishedRef.current = false;
|
|
@@ -9713,8 +9724,7 @@ var CustomerService = function(props) {
|
|
|
9713
9724
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
9714
9725
|
if (pageNumHistory > 1) return;
|
|
9715
9726
|
var obj = msg;
|
|
9716
|
-
var
|
|
9717
|
-
var id = tempId; // 原:let id = msg.messageId; 备注:解决思考过程返回的messageId和下边回复的内容值不同问题,新:改成临时固定相同id,finished完成时替换为实际返回的messageId值
|
|
9727
|
+
var id = msg.tempMessageId;
|
|
9718
9728
|
setHistoryMessageList(function(prevHistoryMessageList) {
|
|
9719
9729
|
var list1 = prevHistoryMessageList;
|
|
9720
9730
|
//删除临时数据
|
|
@@ -9739,6 +9749,7 @@ var CustomerService = function(props) {
|
|
|
9739
9749
|
recevier: mid,
|
|
9740
9750
|
message: message,
|
|
9741
9751
|
id: id,
|
|
9752
|
+
messageId: msg.messageId,
|
|
9742
9753
|
upvoted: false,
|
|
9743
9754
|
downvoted: false,
|
|
9744
9755
|
createdAt: getDataTime(-1),
|
|
@@ -9769,6 +9780,7 @@ var CustomerService = function(props) {
|
|
|
9769
9780
|
if (item.id == id) {
|
|
9770
9781
|
return _object_spread_props(_object_spread({}, item), {
|
|
9771
9782
|
message: message,
|
|
9783
|
+
messageId: msg.messageId,
|
|
9772
9784
|
extraInfo: extraInfo == null ? item.extraInfo : JSON.stringify(extraInfo)
|
|
9773
9785
|
});
|
|
9774
9786
|
} else {
|
|
@@ -9781,17 +9793,6 @@ var CustomerService = function(props) {
|
|
|
9781
9793
|
console.log("isPosition", isPosition.current);
|
|
9782
9794
|
scrollToBottom();
|
|
9783
9795
|
if (msg.finished) {
|
|
9784
|
-
setHistoryMessageList(function(prevHistoryMessageList) {
|
|
9785
|
-
return prevHistoryMessageList.map(function(item) {
|
|
9786
|
-
if (item.id === tempId) {
|
|
9787
|
-
return _object_spread_props(_object_spread({}, item), {
|
|
9788
|
-
id: msg.messageId
|
|
9789
|
-
});
|
|
9790
|
-
} else {
|
|
9791
|
-
return item;
|
|
9792
|
-
}
|
|
9793
|
-
});
|
|
9794
|
-
});
|
|
9795
9796
|
console.log("返回完成", msg, msgStreamingCountRef.current);
|
|
9796
9797
|
//发送结束
|
|
9797
9798
|
finishedRef.current = true;
|
|
@@ -9903,7 +9904,9 @@ var CustomerService = function(props) {
|
|
|
9903
9904
|
if (ele.message.includes("<thinking>") && !ele.message.includes("</thinking>")) {
|
|
9904
9905
|
ele.message = ele.message + "</thinking>";
|
|
9905
9906
|
}
|
|
9906
|
-
return ele
|
|
9907
|
+
return _object_spread_props(_object_spread({}, ele), {
|
|
9908
|
+
messageId: ele.id
|
|
9909
|
+
});
|
|
9907
9910
|
});
|
|
9908
9911
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
9909
9912
|
setFirstItemIndex(total - maxPageSize * (page - 1));
|
|
@@ -10096,7 +10099,7 @@ var CustomerService = function(props) {
|
|
|
10096
10099
|
} catch (error) {}
|
|
10097
10100
|
};
|
|
10098
10101
|
//点赞消息
|
|
10099
|
-
var likeMessage = function(
|
|
10102
|
+
var likeMessage = function(messageId, state, id) {
|
|
10100
10103
|
var url = "";
|
|
10101
10104
|
//点赞状态
|
|
10102
10105
|
if (!state) {
|
|
@@ -10105,7 +10108,7 @@ var CustomerService = function(props) {
|
|
|
10105
10108
|
url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:cancelUpvote");
|
|
10106
10109
|
}
|
|
10107
10110
|
http.post(url, {
|
|
10108
|
-
messageId:
|
|
10111
|
+
messageId: messageId
|
|
10109
10112
|
}).then(function(res) {
|
|
10110
10113
|
setHistoryMessageList(function(historyMessageList) {
|
|
10111
10114
|
var list = historyMessageList;
|
|
@@ -10120,7 +10123,7 @@ var CustomerService = function(props) {
|
|
|
10120
10123
|
});
|
|
10121
10124
|
};
|
|
10122
10125
|
//踩
|
|
10123
|
-
var disagreeMessage = function(
|
|
10126
|
+
var disagreeMessage = function(messageId, state, id) {
|
|
10124
10127
|
var url = "";
|
|
10125
10128
|
//点赞状态
|
|
10126
10129
|
if (!state) {
|
|
@@ -10129,7 +10132,7 @@ var CustomerService = function(props) {
|
|
|
10129
10132
|
url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:cancelDownvote");
|
|
10130
10133
|
}
|
|
10131
10134
|
http.post(url, {
|
|
10132
|
-
messageId:
|
|
10135
|
+
messageId: messageId
|
|
10133
10136
|
}).then(function(res) {
|
|
10134
10137
|
setHistoryMessageList(function(historyMessageList) {
|
|
10135
10138
|
var list = historyMessageList;
|
|
@@ -10789,9 +10792,8 @@ var CustomerService = function(props) {
|
|
|
10789
10792
|
className: "yinyong_quote1",
|
|
10790
10793
|
onClick: function() {
|
|
10791
10794
|
// 问题的引用
|
|
10792
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
10793
10795
|
setCitationContent({
|
|
10794
|
-
content: item.message,
|
|
10796
|
+
content: replaceThinkAndYaml(item.message),
|
|
10795
10797
|
id: item.id,
|
|
10796
10798
|
imageUrl: !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" ? JSON.parse(item.extraInfo)[0].value : ""
|
|
10797
10799
|
});
|
|
@@ -10808,7 +10810,7 @@ var CustomerService = function(props) {
|
|
|
10808
10810
|
}) : /*#__PURE__*/ jsx("i", {
|
|
10809
10811
|
className: "fuzhi21",
|
|
10810
10812
|
onClick: function() {
|
|
10811
|
-
copyText(item.message);
|
|
10813
|
+
copyText(replaceThinkAndYaml(item.message));
|
|
10812
10814
|
{
|
|
10813
10815
|
var obj = copyTextOBJ;
|
|
10814
10816
|
obj = obj.filter(function(list) {
|
|
@@ -11221,11 +11223,7 @@ var CustomerService = function(props) {
|
|
|
11221
11223
|
style: {
|
|
11222
11224
|
height: "100%"
|
|
11223
11225
|
},
|
|
11224
|
-
initialTopMostItemIndex
|
|
11225
|
-
index: "LAST",
|
|
11226
|
-
align: "end",
|
|
11227
|
-
offset: showType === 3 ? 58 : showType === 4 ? 144 : 58
|
|
11228
|
-
},
|
|
11226
|
+
// initialTopMostItemIndex={!finished&&isPositionState?undefined:{ index: "LAST", align: "end",offset:showType===3?58:showType===4?144:58 }}
|
|
11229
11227
|
initialItemCount: 10,
|
|
11230
11228
|
itemsRendered: function() {
|
|
11231
11229
|
renderMermaid();
|
|
@@ -11381,9 +11379,8 @@ var CustomerService = function(props) {
|
|
|
11381
11379
|
className: "yinyong_quote1",
|
|
11382
11380
|
onClick: function() {
|
|
11383
11381
|
// 答案的引用
|
|
11384
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
11385
11382
|
setCitationContent({
|
|
11386
|
-
content: item.message,
|
|
11383
|
+
content: replaceThinkAndYaml(item.message),
|
|
11387
11384
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
11388
11385
|
id: item.id
|
|
11389
11386
|
});
|
|
@@ -11400,7 +11397,7 @@ var CustomerService = function(props) {
|
|
|
11400
11397
|
}) : /*#__PURE__*/ jsx("i", {
|
|
11401
11398
|
className: "fuzhi21",
|
|
11402
11399
|
onClick: function() {
|
|
11403
|
-
copyText(item.message);
|
|
11400
|
+
copyText(replaceThinkAndYaml(item.message));
|
|
11404
11401
|
{
|
|
11405
11402
|
var obj = copyTextOBJ;
|
|
11406
11403
|
obj = obj.filter(function(list) {
|
|
@@ -11426,7 +11423,7 @@ var CustomerService = function(props) {
|
|
|
11426
11423
|
/*#__PURE__*/ jsx("i", {
|
|
11427
11424
|
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
11428
11425
|
onClick: function() {
|
|
11429
|
-
likeMessage(item.id, item.upvoted);
|
|
11426
|
+
likeMessage(item.id, item.upvoted, item.id);
|
|
11430
11427
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
11431
11428
|
if (!isAiChatWindow) return;
|
|
11432
11429
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -11434,7 +11431,7 @@ var CustomerService = function(props) {
|
|
|
11434
11431
|
if (!item.extraInfo && item.sender == "AI") {
|
|
11435
11432
|
aiSendQuestions(1, {
|
|
11436
11433
|
roomId: roomId,
|
|
11437
|
-
message: "
|
|
11434
|
+
message: "\x03\x03\x03你给出的答案我非常满意,赞!\x03\x03\x03",
|
|
11438
11435
|
quotedMessage: "",
|
|
11439
11436
|
regenerate: false,
|
|
11440
11437
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -11449,7 +11446,7 @@ var CustomerService = function(props) {
|
|
|
11449
11446
|
/*#__PURE__*/ jsx("i", {
|
|
11450
11447
|
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
11451
11448
|
onClick: function() {
|
|
11452
|
-
disagreeMessage(item.id, item.downvoted);
|
|
11449
|
+
disagreeMessage(item.id, item.downvoted, item.id);
|
|
11453
11450
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
11454
11451
|
if (!isAiChatWindow) return;
|
|
11455
11452
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -11457,7 +11454,7 @@ var CustomerService = function(props) {
|
|
|
11457
11454
|
if (!item.extraInfo && item.sender == "AI") {
|
|
11458
11455
|
aiSendQuestions(1, {
|
|
11459
11456
|
roomId: roomId,
|
|
11460
|
-
message: "
|
|
11457
|
+
message: "\x03\x03\x03你给出的答案很糟糕,我不满意,踩!\x03\x03\x03",
|
|
11461
11458
|
quotedMessage: "",
|
|
11462
11459
|
regenerate: false,
|
|
11463
11460
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -11588,11 +11585,10 @@ var CustomerService = function(props) {
|
|
|
11588
11585
|
/*#__PURE__*/ jsx("i", {
|
|
11589
11586
|
className: "yinyong_quote1",
|
|
11590
11587
|
onClick: function() {
|
|
11591
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
11592
11588
|
setCitationContent({
|
|
11593
|
-
content: item.message,
|
|
11589
|
+
content: replaceThinkAndYaml(item.message),
|
|
11594
11590
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
11595
|
-
id: item.
|
|
11591
|
+
id: item.messageId
|
|
11596
11592
|
});
|
|
11597
11593
|
resettingBottomHei();
|
|
11598
11594
|
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
@@ -11607,7 +11603,7 @@ var CustomerService = function(props) {
|
|
|
11607
11603
|
}) : /*#__PURE__*/ jsx("i", {
|
|
11608
11604
|
className: "fuzhi21",
|
|
11609
11605
|
onClick: function() {
|
|
11610
|
-
copyText(item.message);
|
|
11606
|
+
copyText(replaceThinkAndYaml(item.message));
|
|
11611
11607
|
{
|
|
11612
11608
|
var obj = copyTextOBJ;
|
|
11613
11609
|
obj = obj.filter(function(list) {
|
|
@@ -11633,7 +11629,7 @@ var CustomerService = function(props) {
|
|
|
11633
11629
|
/*#__PURE__*/ jsx("i", {
|
|
11634
11630
|
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
11635
11631
|
onClick: function() {
|
|
11636
|
-
likeMessage(item.
|
|
11632
|
+
likeMessage(item.messageId, item.upvoted, item.id);
|
|
11637
11633
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
11638
11634
|
if (!isAiChatWindow) return;
|
|
11639
11635
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -11642,7 +11638,7 @@ var CustomerService = function(props) {
|
|
|
11642
11638
|
if (!item.extraInfo && item.sender == "AI") {
|
|
11643
11639
|
aiSendQuestions(1, {
|
|
11644
11640
|
roomId: roomId,
|
|
11645
|
-
message: "
|
|
11641
|
+
message: "\x03\x03\x03你给出的答案我非常满意,赞!\x03\x03\x03",
|
|
11646
11642
|
quotedMessage: "",
|
|
11647
11643
|
regenerate: false,
|
|
11648
11644
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -11658,7 +11654,7 @@ var CustomerService = function(props) {
|
|
|
11658
11654
|
/*#__PURE__*/ jsx("i", {
|
|
11659
11655
|
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
11660
11656
|
onClick: function() {
|
|
11661
|
-
disagreeMessage(item.
|
|
11657
|
+
disagreeMessage(item.messageId, item.downvoted, item.id);
|
|
11662
11658
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
11663
11659
|
if (!isAiChatWindow) return;
|
|
11664
11660
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -11669,7 +11665,7 @@ var CustomerService = function(props) {
|
|
|
11669
11665
|
//AI回答
|
|
11670
11666
|
aiSendQuestions(1, {
|
|
11671
11667
|
roomId: roomId,
|
|
11672
|
-
message: "
|
|
11668
|
+
message: "\x03\x03\x03你给出的答案很糟糕,我不满意,踩!\x03\x03\x03",
|
|
11673
11669
|
quotedMessage: "",
|
|
11674
11670
|
regenerate: false,
|
|
11675
11671
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -15644,16 +15640,6 @@ var UploadFileBtn = SendBtn;
|
|
|
15644
15640
|
|
|
15645
15641
|
var modules_63b47c51$1 = {"footer-fileList-wrapper":"index_module_footerFileListWrapper__e818c28d","footer-fileList-list":"index_module_footerFileListList__e818c28d","footer-fileList-listItem":"index_module_footerFileListListItem__e818c28d","footer-fileList-listItem-icon":"index_module_footerFileListListItemIcon__e818c28d","footer-fileList-listItem-text":"index_module_footerFileListListItemText__e818c28d","footer-fileList-listItem-status":"index_module_footerFileListListItemStatus__e818c28d","footer-fileList-listItem-delete":"index_module_footerFileListListItemDelete__e818c28d","footer-fileList-pre":"index_module_footerFileListPre__e818c28d","footer-fileList-next":"index_module_footerFileListNext__e818c28d"};
|
|
15646
15642
|
|
|
15647
|
-
var guidGenerator = function() {
|
|
15648
|
-
var d = new Date().getTime();
|
|
15649
|
-
var uuid = "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
15650
|
-
var r = (d + Math.random() * 16) % 16 | 0;
|
|
15651
|
-
d = Math.floor(d / 16);
|
|
15652
|
-
return (c == "x" ? r : r & 3 | 8).toString(16);
|
|
15653
|
-
});
|
|
15654
|
-
return uuid;
|
|
15655
|
-
};
|
|
15656
|
-
|
|
15657
15643
|
// 通过文件名 获取文件后缀
|
|
15658
15644
|
var getSuffix = function(fileName) {
|
|
15659
15645
|
return fileName.split(".").pop().toLowerCase();
|