bhd-components 0.10.57 → 0.10.58
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/README.md +1 -1
- package/dist/index.esm.es5.development.js +75 -43
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +137 -137
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/customerService/index.js +76 -43
- package/esm/customerService/index.js +75 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8305,6 +8305,68 @@ var CustomerService = function(props) {
|
|
|
8305
8305
|
var _useState36 = _sliced_to_array(useState(false), 2); _useState36[0]; _useState36[1]; //是否显示mermaid弹窗
|
|
8306
8306
|
var _useState37 = _sliced_to_array(useState(""), 2); _useState37[0]; _useState37[1]; //mermaid内容
|
|
8307
8307
|
var shouqiTimer = useRef(null);
|
|
8308
|
+
var waitMesssageListRef = useRef([]);
|
|
8309
|
+
var handleRenderMsgTimer = useRef(null);
|
|
8310
|
+
var handleRenderMsg = function() {
|
|
8311
|
+
if (handleRenderMsgTimer.current) return;
|
|
8312
|
+
var processMessages = function() {
|
|
8313
|
+
var list = waitMesssageListRef.current.slice(0, 12);
|
|
8314
|
+
waitMesssageListRef.current = waitMesssageListRef.current.slice(12);
|
|
8315
|
+
list.forEach(function(item) {
|
|
8316
|
+
var data = item.data, tempMessageId = item.tempMessageId, id = item.id, type = item.type, flagKeyWord = item.flagKeyWord;
|
|
8317
|
+
//识别的内容
|
|
8318
|
+
// console.log("eventSource msg: ", event.data);
|
|
8319
|
+
var msg = JSON.parse(data);
|
|
8320
|
+
// console.log('tempMessageId',tempMessageId)
|
|
8321
|
+
msg.tempMessageId = tempMessageId;
|
|
8322
|
+
if (msg.message) {
|
|
8323
|
+
// if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
8324
|
+
// hasYamlStarted = true;
|
|
8325
|
+
// }
|
|
8326
|
+
msg.message = msg.message.replace(/<thinking>/g, '<div class="think-block">').replace(/<\/thinking>/g, "</div>\n");
|
|
8327
|
+
}
|
|
8328
|
+
finishedRef.current = false;
|
|
8329
|
+
setFinished(false);
|
|
8330
|
+
// msgStreamingCountRef.current=msgStreamingCountRef.current+1
|
|
8331
|
+
// console.log("返回中", msg);
|
|
8332
|
+
content = content + msg.message;
|
|
8333
|
+
// renderAiAnswerTimer.current = setTimeout(() => {
|
|
8334
|
+
// }, 1*msgStreamingCountRef.current);
|
|
8335
|
+
if (!finishedRef.current) {
|
|
8336
|
+
renderAiAnswer(msg, id, type);
|
|
8337
|
+
}
|
|
8338
|
+
if (msg.finished) {
|
|
8339
|
+
// console.log('返回完成',msg)
|
|
8340
|
+
if (!flagKeyWord) {
|
|
8341
|
+
videoPageQuestiionsList(2);
|
|
8342
|
+
}
|
|
8343
|
+
testLabQuestion(JSON.parse(data).message, content, "");
|
|
8344
|
+
if (shouqiTimer.current) {
|
|
8345
|
+
clearTimeout(shouqiTimer.current);
|
|
8346
|
+
}
|
|
8347
|
+
shouqiTimer.current = setTimeout(function() {
|
|
8348
|
+
if ($(".think-block").last().css("display") === "block") {
|
|
8349
|
+
clearTimeout(shouqiTimer.current);
|
|
8350
|
+
$(".think-block").last().parent().find(".think-block").css({
|
|
8351
|
+
display: "none"
|
|
8352
|
+
});
|
|
8353
|
+
$(".think-block").last().parent().parent().find("i").css({
|
|
8354
|
+
transform: "rotate(180deg)"
|
|
8355
|
+
});
|
|
8356
|
+
}
|
|
8357
|
+
}, 1000);
|
|
8358
|
+
}
|
|
8359
|
+
});
|
|
8360
|
+
if (waitMesssageListRef.current.length === 0) {
|
|
8361
|
+
// 暂停 requestAnimationFrame
|
|
8362
|
+
cancelAnimationFrame(handleRenderMsgTimer.current);
|
|
8363
|
+
handleRenderMsgTimer.current = null;
|
|
8364
|
+
} else {
|
|
8365
|
+
handleRenderMsgTimer.current = requestAnimationFrame(processMessages);
|
|
8366
|
+
}
|
|
8367
|
+
};
|
|
8368
|
+
handleRenderMsgTimer.current = requestAnimationFrame(processMessages);
|
|
8369
|
+
};
|
|
8308
8370
|
var remarkable = new Remarkable({
|
|
8309
8371
|
html: true,
|
|
8310
8372
|
highlight: function highlight(str, lang) {
|
|
@@ -9581,6 +9643,7 @@ var CustomerService = function(props) {
|
|
|
9581
9643
|
onopen: function(res) {
|
|
9582
9644
|
return _async_to_generator(function() {
|
|
9583
9645
|
return __generator(this, function(_state) {
|
|
9646
|
+
waitMesssageListRef.current = [];
|
|
9584
9647
|
console.info("eventSource open: ", res);
|
|
9585
9648
|
tempMessageId = guidGenerator();
|
|
9586
9649
|
clearTimeout(receiveMessageTimer.current);
|
|
@@ -9667,48 +9730,17 @@ var CustomerService = function(props) {
|
|
|
9667
9730
|
});
|
|
9668
9731
|
},
|
|
9669
9732
|
onmessage: function(event) {
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
finishedRef.current = false;
|
|
9682
|
-
setFinished(false);
|
|
9683
|
-
msgStreamingCountRef.current = msgStreamingCountRef.current + 1;
|
|
9684
|
-
console.log("返回中", msg);
|
|
9685
|
-
content = content + msg.message;
|
|
9686
|
-
renderAiAnswerTimer.current = setTimeout(function() {
|
|
9687
|
-
if (!finishedRef.current) {
|
|
9688
|
-
renderAiAnswer(msg, id, type);
|
|
9689
|
-
}
|
|
9690
|
-
}, 1 * msgStreamingCountRef.current);
|
|
9691
|
-
if (msg.finished) {
|
|
9692
|
-
// console.log('返回完成',msg)
|
|
9693
|
-
if (!flagKeyWord) {
|
|
9694
|
-
videoPageQuestiionsList(2);
|
|
9695
|
-
}
|
|
9696
|
-
testLabQuestion(JSON.parse(data).message, content, "");
|
|
9697
|
-
if (shouqiTimer.current) {
|
|
9698
|
-
clearTimeout(shouqiTimer.current);
|
|
9699
|
-
}
|
|
9700
|
-
shouqiTimer.current = setTimeout(function() {
|
|
9701
|
-
if ($(".think-block").last().css("display") === "block") {
|
|
9702
|
-
clearTimeout(shouqiTimer.current);
|
|
9703
|
-
$(".think-block").last().parent().find(".think-block").css({
|
|
9704
|
-
display: "none"
|
|
9705
|
-
});
|
|
9706
|
-
$(".think-block").last().parent().parent().find("i").css({
|
|
9707
|
-
transform: "rotate(180deg)"
|
|
9708
|
-
});
|
|
9709
|
-
}
|
|
9710
|
-
}, 1000);
|
|
9711
|
-
}
|
|
9733
|
+
var _$obj = {
|
|
9734
|
+
data: event.data,
|
|
9735
|
+
tempMessageId: tempMessageId,
|
|
9736
|
+
id: id,
|
|
9737
|
+
type: type,
|
|
9738
|
+
flagKeyWord: flagKeyWord
|
|
9739
|
+
};
|
|
9740
|
+
waitMesssageListRef.current = _to_consumable_array(waitMesssageListRef.current).concat([
|
|
9741
|
+
_$obj
|
|
9742
|
+
]);
|
|
9743
|
+
handleRenderMsg();
|
|
9712
9744
|
},
|
|
9713
9745
|
onclose: function() {
|
|
9714
9746
|
console.log("eventSource close");
|
|
@@ -9793,7 +9825,7 @@ var CustomerService = function(props) {
|
|
|
9793
9825
|
return newHistoryMessageList2;
|
|
9794
9826
|
}
|
|
9795
9827
|
});
|
|
9796
|
-
console.log("isPosition", isPosition.current);
|
|
9828
|
+
// console.log("isPosition", isPosition.current);
|
|
9797
9829
|
scrollToBottom();
|
|
9798
9830
|
if (msg.finished) {
|
|
9799
9831
|
console.log("返回完成", msg, msgStreamingCountRef.current);
|