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
|
@@ -35,6 +35,7 @@ import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, re
|
|
|
35
35
|
// import html2canvas from "html2canvas";
|
|
36
36
|
// const screenShot = require('./screenShotPlugin.esm')
|
|
37
37
|
import ScreenShot from "./js-screen-shot/main";
|
|
38
|
+
import { guidGenerator } from "../utils/number";
|
|
38
39
|
/*
|
|
39
40
|
自定义remarkable的text解析规则
|
|
40
41
|
*/ const HTML_ESCAPE_TEST_RE = /[&<>"]/;
|
|
@@ -58,7 +59,7 @@ const pattern = /!\[.*?\]\((.*?)\)/;
|
|
|
58
59
|
const exactRegex = /class\s*=\s*["']think-block["']/;
|
|
59
60
|
// 去掉think
|
|
60
61
|
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
|
+
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, '');
|
|
62
63
|
};
|
|
63
64
|
mermaid.initialize({
|
|
64
65
|
startOnLoad: false,
|
|
@@ -1270,6 +1271,7 @@ const CustomerService = (props)=>{
|
|
|
1270
1271
|
videoPageQuestiionsList(3);
|
|
1271
1272
|
}
|
|
1272
1273
|
let hasYamlStarted = false;
|
|
1274
|
+
const tempMessageId = guidGenerator();
|
|
1273
1275
|
//使用fetchEventSource接收数据
|
|
1274
1276
|
const eventSource = fetchEventSource(`${urllocation}/chat-service/public/v1.0/chat-with-ai/messages`, {
|
|
1275
1277
|
method: "POST",
|
|
@@ -1366,10 +1368,11 @@ const CustomerService = (props)=>{
|
|
|
1366
1368
|
//识别的内容
|
|
1367
1369
|
// console.log("eventSource msg: ", event.data);
|
|
1368
1370
|
let msg = JSON.parse(event.data);
|
|
1371
|
+
msg.tempMessageId = tempMessageId;
|
|
1369
1372
|
if (msg.message) {
|
|
1370
|
-
if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1373
|
+
// if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
1374
|
+
// hasYamlStarted = true;
|
|
1375
|
+
// }
|
|
1373
1376
|
msg.message = msg.message.replace(/<thinking>/g, '<div class="think-block">').replace(/<\/thinking>/g, '</div>\n');
|
|
1374
1377
|
}
|
|
1375
1378
|
finishedRef.current = false;
|
|
@@ -1419,8 +1422,7 @@ const CustomerService = (props)=>{
|
|
|
1419
1422
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
1420
1423
|
if (pageNumHistory > 1) return;
|
|
1421
1424
|
let obj = msg;
|
|
1422
|
-
let
|
|
1423
|
-
let id = tempId; // 原:let id = msg.messageId; 备注:解决思考过程返回的messageId和下边回复的内容值不同问题,新:改成临时固定相同id,finished完成时替换为实际返回的messageId值
|
|
1425
|
+
let id = msg.tempMessageId;
|
|
1424
1426
|
setHistoryMessageList((prevHistoryMessageList)=>{
|
|
1425
1427
|
let list1 = prevHistoryMessageList;
|
|
1426
1428
|
//删除临时数据
|
|
@@ -1445,6 +1447,7 @@ const CustomerService = (props)=>{
|
|
|
1445
1447
|
recevier: mid,
|
|
1446
1448
|
message: message,
|
|
1447
1449
|
id: id,
|
|
1450
|
+
messageId: msg.messageId,
|
|
1448
1451
|
upvoted: false,
|
|
1449
1452
|
downvoted: false,
|
|
1450
1453
|
createdAt: getDataTime(-1),
|
|
@@ -1475,6 +1478,7 @@ const CustomerService = (props)=>{
|
|
|
1475
1478
|
if (item.id == id) {
|
|
1476
1479
|
return _object_spread_props(_object_spread({}, item), {
|
|
1477
1480
|
message: message,
|
|
1481
|
+
messageId: msg.messageId,
|
|
1478
1482
|
extraInfo: extraInfo == null ? item.extraInfo : JSON.stringify(extraInfo)
|
|
1479
1483
|
});
|
|
1480
1484
|
} else {
|
|
@@ -1487,17 +1491,6 @@ const CustomerService = (props)=>{
|
|
|
1487
1491
|
console.log("isPosition", isPosition.current);
|
|
1488
1492
|
scrollToBottom();
|
|
1489
1493
|
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
|
-
});
|
|
1501
1494
|
console.log('返回完成', msg, msgStreamingCountRef.current);
|
|
1502
1495
|
//发送结束
|
|
1503
1496
|
finishedRef.current = true;
|
|
@@ -1606,7 +1599,9 @@ const CustomerService = (props)=>{
|
|
|
1606
1599
|
if (ele.message.includes("<thinking>") && !ele.message.includes("</thinking>")) {
|
|
1607
1600
|
ele.message = ele.message + "</thinking>";
|
|
1608
1601
|
}
|
|
1609
|
-
return ele
|
|
1602
|
+
return _object_spread_props(_object_spread({}, ele), {
|
|
1603
|
+
messageId: ele.id
|
|
1604
|
+
});
|
|
1610
1605
|
});
|
|
1611
1606
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
1612
1607
|
setFirstItemIndex(total - maxPageSize * (page - 1));
|
|
@@ -1791,7 +1786,7 @@ const CustomerService = (props)=>{
|
|
|
1791
1786
|
} catch (error) {}
|
|
1792
1787
|
};
|
|
1793
1788
|
//点赞消息
|
|
1794
|
-
const likeMessage = (
|
|
1789
|
+
const likeMessage = (messageId, state, id)=>{
|
|
1795
1790
|
let url = "";
|
|
1796
1791
|
//点赞状态
|
|
1797
1792
|
if (!state) {
|
|
@@ -1800,7 +1795,7 @@ const CustomerService = (props)=>{
|
|
|
1800
1795
|
url = `${urllocation}/chat-service/public/v1.0/history-messages:cancelUpvote`;
|
|
1801
1796
|
}
|
|
1802
1797
|
http.post(url, {
|
|
1803
|
-
messageId:
|
|
1798
|
+
messageId: messageId
|
|
1804
1799
|
}).then((res)=>{
|
|
1805
1800
|
setHistoryMessageList((historyMessageList)=>{
|
|
1806
1801
|
let list = historyMessageList;
|
|
@@ -1815,7 +1810,7 @@ const CustomerService = (props)=>{
|
|
|
1815
1810
|
});
|
|
1816
1811
|
};
|
|
1817
1812
|
//踩
|
|
1818
|
-
const disagreeMessage = (
|
|
1813
|
+
const disagreeMessage = (messageId, state, id)=>{
|
|
1819
1814
|
let url = "";
|
|
1820
1815
|
//点赞状态
|
|
1821
1816
|
if (!state) {
|
|
@@ -1824,7 +1819,7 @@ const CustomerService = (props)=>{
|
|
|
1824
1819
|
url = `${urllocation}/chat-service/public/v1.0/history-messages:cancelDownvote`;
|
|
1825
1820
|
}
|
|
1826
1821
|
http.post(url, {
|
|
1827
|
-
messageId:
|
|
1822
|
+
messageId: messageId
|
|
1828
1823
|
}).then((res)=>{
|
|
1829
1824
|
setHistoryMessageList((historyMessageList)=>{
|
|
1830
1825
|
let list = historyMessageList;
|
|
@@ -2497,9 +2492,8 @@ const CustomerService = (props)=>{
|
|
|
2497
2492
|
className: "yinyong_quote1",
|
|
2498
2493
|
onClick: ()=>{
|
|
2499
2494
|
// 问题的引用
|
|
2500
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
2501
2495
|
setCitationContent({
|
|
2502
|
-
content: item.message,
|
|
2496
|
+
content: replaceThinkAndYaml(item.message),
|
|
2503
2497
|
id: item.id,
|
|
2504
2498
|
imageUrl: !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" ? JSON.parse(item.extraInfo)[0].value : ""
|
|
2505
2499
|
});
|
|
@@ -2514,7 +2508,7 @@ const CustomerService = (props)=>{
|
|
|
2514
2508
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
2515
2509
|
className: "fuzhi21",
|
|
2516
2510
|
onClick: ()=>{
|
|
2517
|
-
let bol = copyText(item.message);
|
|
2511
|
+
let bol = copyText(replaceThinkAndYaml(item.message));
|
|
2518
2512
|
if (bol) {
|
|
2519
2513
|
let obj = copyTextOBJ;
|
|
2520
2514
|
obj = obj.filter((list)=>list != item.id);
|
|
@@ -2911,11 +2905,7 @@ const CustomerService = (props)=>{
|
|
|
2911
2905
|
style: {
|
|
2912
2906
|
height: '100%'
|
|
2913
2907
|
},
|
|
2914
|
-
initialTopMostItemIndex
|
|
2915
|
-
index: "LAST",
|
|
2916
|
-
align: "end",
|
|
2917
|
-
offset: showType === 3 ? 58 : showType === 4 ? 144 : 58
|
|
2918
|
-
},
|
|
2908
|
+
// initialTopMostItemIndex={!finished&&isPositionState?undefined:{ index: "LAST", align: "end",offset:showType===3?58:showType===4?144:58 }}
|
|
2919
2909
|
initialItemCount: 10,
|
|
2920
2910
|
itemsRendered: ()=>{
|
|
2921
2911
|
renderMermaid();
|
|
@@ -3069,9 +3059,8 @@ const CustomerService = (props)=>{
|
|
|
3069
3059
|
className: "yinyong_quote1",
|
|
3070
3060
|
onClick: ()=>{
|
|
3071
3061
|
// 答案的引用
|
|
3072
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
3073
3062
|
setCitationContent({
|
|
3074
|
-
content: item.message,
|
|
3063
|
+
content: replaceThinkAndYaml(item.message),
|
|
3075
3064
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
3076
3065
|
id: item.id
|
|
3077
3066
|
});
|
|
@@ -3086,7 +3075,7 @@ const CustomerService = (props)=>{
|
|
|
3086
3075
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
3087
3076
|
className: "fuzhi21",
|
|
3088
3077
|
onClick: ()=>{
|
|
3089
|
-
let bol = copyText(item.message);
|
|
3078
|
+
let bol = copyText(replaceThinkAndYaml(item.message));
|
|
3090
3079
|
if (bol) {
|
|
3091
3080
|
let obj = copyTextOBJ;
|
|
3092
3081
|
obj = obj.filter((list)=>list != item.id);
|
|
@@ -3108,7 +3097,7 @@ const CustomerService = (props)=>{
|
|
|
3108
3097
|
/*#__PURE__*/ _jsx("i", {
|
|
3109
3098
|
className: `Frame427319094 ${item.upvoted ? styles.active : ""}`,
|
|
3110
3099
|
onClick: ()=>{
|
|
3111
|
-
likeMessage(item.id, item.upvoted);
|
|
3100
|
+
likeMessage(item.id, item.upvoted, item.id);
|
|
3112
3101
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3113
3102
|
if (!isAiChatWindow) return;
|
|
3114
3103
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3116,7 +3105,7 @@ const CustomerService = (props)=>{
|
|
|
3116
3105
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3117
3106
|
aiSendQuestions(1, {
|
|
3118
3107
|
roomId: roomId,
|
|
3119
|
-
message: "
|
|
3108
|
+
message: "\u0003\u0003\u0003你给出的答案我非常满意,赞!\u0003\u0003\u0003",
|
|
3120
3109
|
quotedMessage: "",
|
|
3121
3110
|
regenerate: false,
|
|
3122
3111
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3131,7 +3120,7 @@ const CustomerService = (props)=>{
|
|
|
3131
3120
|
/*#__PURE__*/ _jsx("i", {
|
|
3132
3121
|
className: `Frame427319095 ${item.downvoted ? styles.active : ""}`,
|
|
3133
3122
|
onClick: ()=>{
|
|
3134
|
-
disagreeMessage(item.id, item.downvoted);
|
|
3123
|
+
disagreeMessage(item.id, item.downvoted, item.id);
|
|
3135
3124
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3136
3125
|
if (!isAiChatWindow) return;
|
|
3137
3126
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3139,7 +3128,7 @@ const CustomerService = (props)=>{
|
|
|
3139
3128
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3140
3129
|
aiSendQuestions(1, {
|
|
3141
3130
|
roomId: roomId,
|
|
3142
|
-
message: "
|
|
3131
|
+
message: "\u0003\u0003\u0003你给出的答案很糟糕,我不满意,踩!\u0003\u0003\u0003",
|
|
3143
3132
|
quotedMessage: "",
|
|
3144
3133
|
regenerate: false,
|
|
3145
3134
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3266,11 +3255,10 @@ const CustomerService = (props)=>{
|
|
|
3266
3255
|
/*#__PURE__*/ _jsx("i", {
|
|
3267
3256
|
className: "yinyong_quote1",
|
|
3268
3257
|
onClick: ()=>{
|
|
3269
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
3270
3258
|
setCitationContent({
|
|
3271
|
-
content: item.message,
|
|
3259
|
+
content: replaceThinkAndYaml(item.message),
|
|
3272
3260
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
3273
|
-
id: item.
|
|
3261
|
+
id: item.messageId
|
|
3274
3262
|
});
|
|
3275
3263
|
resettingBottomHei();
|
|
3276
3264
|
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
@@ -3283,7 +3271,7 @@ const CustomerService = (props)=>{
|
|
|
3283
3271
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
3284
3272
|
className: "fuzhi21",
|
|
3285
3273
|
onClick: ()=>{
|
|
3286
|
-
let bol = copyText(item.message);
|
|
3274
|
+
let bol = copyText(replaceThinkAndYaml(item.message));
|
|
3287
3275
|
if (bol) {
|
|
3288
3276
|
let obj = copyTextOBJ;
|
|
3289
3277
|
obj = obj.filter((list)=>list != item.id);
|
|
@@ -3305,7 +3293,7 @@ const CustomerService = (props)=>{
|
|
|
3305
3293
|
/*#__PURE__*/ _jsx("i", {
|
|
3306
3294
|
className: `Frame427319094 ${item.upvoted ? styles.active : ""}`,
|
|
3307
3295
|
onClick: ()=>{
|
|
3308
|
-
likeMessage(item.
|
|
3296
|
+
likeMessage(item.messageId, item.upvoted, item.id);
|
|
3309
3297
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3310
3298
|
if (!isAiChatWindow) return;
|
|
3311
3299
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3314,7 +3302,7 @@ const CustomerService = (props)=>{
|
|
|
3314
3302
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3315
3303
|
aiSendQuestions(1, {
|
|
3316
3304
|
roomId: roomId,
|
|
3317
|
-
message: "
|
|
3305
|
+
message: "\u0003\u0003\u0003你给出的答案我非常满意,赞!\u0003\u0003\u0003",
|
|
3318
3306
|
quotedMessage: "",
|
|
3319
3307
|
regenerate: false,
|
|
3320
3308
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3330,7 +3318,7 @@ const CustomerService = (props)=>{
|
|
|
3330
3318
|
/*#__PURE__*/ _jsx("i", {
|
|
3331
3319
|
className: `Frame427319095 ${item.downvoted ? styles.active : ""}`,
|
|
3332
3320
|
onClick: ()=>{
|
|
3333
|
-
disagreeMessage(item.
|
|
3321
|
+
disagreeMessage(item.messageId, item.downvoted, item.id);
|
|
3334
3322
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3335
3323
|
if (!isAiChatWindow) return;
|
|
3336
3324
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3341,7 +3329,7 @@ const CustomerService = (props)=>{
|
|
|
3341
3329
|
//AI回答
|
|
3342
3330
|
aiSendQuestions(1, {
|
|
3343
3331
|
roomId: roomId,
|
|
3344
|
-
message: "
|
|
3332
|
+
message: "\u0003\u0003\u0003你给出的答案很糟糕,我不满意,踩!\u0003\u0003\u0003",
|
|
3345
3333
|
quotedMessage: "",
|
|
3346
3334
|
regenerate: false,
|
|
3347
3335
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -39,6 +39,7 @@ import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, re
|
|
|
39
39
|
// import html2canvas from "html2canvas";
|
|
40
40
|
// const screenShot = require('./screenShotPlugin.esm')
|
|
41
41
|
import ScreenShot from "./js-screen-shot/main";
|
|
42
|
+
import { guidGenerator } from "../utils/number";
|
|
42
43
|
/*
|
|
43
44
|
自定义remarkable的text解析规则
|
|
44
45
|
*/ var HTML_ESCAPE_TEST_RE = /[&<>"]/;
|
|
@@ -63,7 +64,7 @@ var exactRegex = /class\s*=\s*["']think-block["']/;
|
|
|
63
64
|
// 去掉think
|
|
64
65
|
var replaceThinkAndYaml = function() {
|
|
65
66
|
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
|
+
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, "");
|
|
67
68
|
};
|
|
68
69
|
mermaid.initialize({
|
|
69
70
|
startOnLoad: false,
|
|
@@ -1405,6 +1406,7 @@ var CustomerService = function(props) {
|
|
|
1405
1406
|
videoPageQuestiionsList(3);
|
|
1406
1407
|
}
|
|
1407
1408
|
var hasYamlStarted = false;
|
|
1409
|
+
var tempMessageId = guidGenerator();
|
|
1408
1410
|
//使用fetchEventSource接收数据
|
|
1409
1411
|
var eventSource = fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
1410
1412
|
method: "POST",
|
|
@@ -1514,10 +1516,11 @@ var CustomerService = function(props) {
|
|
|
1514
1516
|
//识别的内容
|
|
1515
1517
|
// console.log("eventSource msg: ", event.data);
|
|
1516
1518
|
var msg = JSON.parse(event.data);
|
|
1519
|
+
msg.tempMessageId = tempMessageId;
|
|
1517
1520
|
if (msg.message) {
|
|
1518
|
-
if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
1519
|
-
|
|
1520
|
-
}
|
|
1521
|
+
// if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
1522
|
+
// hasYamlStarted = true;
|
|
1523
|
+
// }
|
|
1521
1524
|
msg.message = msg.message.replace(/<thinking>/g, '<div class="think-block">').replace(/<\/thinking>/g, "</div>\n");
|
|
1522
1525
|
}
|
|
1523
1526
|
finishedRef.current = false;
|
|
@@ -1569,8 +1572,7 @@ var CustomerService = function(props) {
|
|
|
1569
1572
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
1570
1573
|
if (pageNumHistory > 1) return;
|
|
1571
1574
|
var obj = msg;
|
|
1572
|
-
var
|
|
1573
|
-
var id = tempId; // 原:let id = msg.messageId; 备注:解决思考过程返回的messageId和下边回复的内容值不同问题,新:改成临时固定相同id,finished完成时替换为实际返回的messageId值
|
|
1575
|
+
var id = msg.tempMessageId;
|
|
1574
1576
|
setHistoryMessageList(function(prevHistoryMessageList) {
|
|
1575
1577
|
var list1 = prevHistoryMessageList;
|
|
1576
1578
|
//删除临时数据
|
|
@@ -1595,6 +1597,7 @@ var CustomerService = function(props) {
|
|
|
1595
1597
|
recevier: mid,
|
|
1596
1598
|
message: message,
|
|
1597
1599
|
id: id,
|
|
1600
|
+
messageId: msg.messageId,
|
|
1598
1601
|
upvoted: false,
|
|
1599
1602
|
downvoted: false,
|
|
1600
1603
|
createdAt: getDataTime(-1),
|
|
@@ -1625,6 +1628,7 @@ var CustomerService = function(props) {
|
|
|
1625
1628
|
if (item.id == id) {
|
|
1626
1629
|
return _object_spread_props(_object_spread({}, item), {
|
|
1627
1630
|
message: message,
|
|
1631
|
+
messageId: msg.messageId,
|
|
1628
1632
|
extraInfo: extraInfo == null ? item.extraInfo : JSON.stringify(extraInfo)
|
|
1629
1633
|
});
|
|
1630
1634
|
} else {
|
|
@@ -1637,17 +1641,6 @@ var CustomerService = function(props) {
|
|
|
1637
1641
|
console.log("isPosition", isPosition.current);
|
|
1638
1642
|
scrollToBottom();
|
|
1639
1643
|
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
|
-
});
|
|
1651
1644
|
console.log("返回完成", msg, msgStreamingCountRef.current);
|
|
1652
1645
|
//发送结束
|
|
1653
1646
|
finishedRef.current = true;
|
|
@@ -1759,7 +1752,9 @@ var CustomerService = function(props) {
|
|
|
1759
1752
|
if (ele.message.includes("<thinking>") && !ele.message.includes("</thinking>")) {
|
|
1760
1753
|
ele.message = ele.message + "</thinking>";
|
|
1761
1754
|
}
|
|
1762
|
-
return ele
|
|
1755
|
+
return _object_spread_props(_object_spread({}, ele), {
|
|
1756
|
+
messageId: ele.id
|
|
1757
|
+
});
|
|
1763
1758
|
});
|
|
1764
1759
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
1765
1760
|
setFirstItemIndex(total - maxPageSize * (page - 1));
|
|
@@ -1952,7 +1947,7 @@ var CustomerService = function(props) {
|
|
|
1952
1947
|
} catch (error) {}
|
|
1953
1948
|
};
|
|
1954
1949
|
//点赞消息
|
|
1955
|
-
var likeMessage = function(
|
|
1950
|
+
var likeMessage = function(messageId, state, id) {
|
|
1956
1951
|
var url = "";
|
|
1957
1952
|
//点赞状态
|
|
1958
1953
|
if (!state) {
|
|
@@ -1961,7 +1956,7 @@ var CustomerService = function(props) {
|
|
|
1961
1956
|
url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:cancelUpvote");
|
|
1962
1957
|
}
|
|
1963
1958
|
http.post(url, {
|
|
1964
|
-
messageId:
|
|
1959
|
+
messageId: messageId
|
|
1965
1960
|
}).then(function(res) {
|
|
1966
1961
|
setHistoryMessageList(function(historyMessageList) {
|
|
1967
1962
|
var list = historyMessageList;
|
|
@@ -1976,7 +1971,7 @@ var CustomerService = function(props) {
|
|
|
1976
1971
|
});
|
|
1977
1972
|
};
|
|
1978
1973
|
//踩
|
|
1979
|
-
var disagreeMessage = function(
|
|
1974
|
+
var disagreeMessage = function(messageId, state, id) {
|
|
1980
1975
|
var url = "";
|
|
1981
1976
|
//点赞状态
|
|
1982
1977
|
if (!state) {
|
|
@@ -1985,7 +1980,7 @@ var CustomerService = function(props) {
|
|
|
1985
1980
|
url = "".concat(urllocation, "/chat-service/public/v1.0/history-messages:cancelDownvote");
|
|
1986
1981
|
}
|
|
1987
1982
|
http.post(url, {
|
|
1988
|
-
messageId:
|
|
1983
|
+
messageId: messageId
|
|
1989
1984
|
}).then(function(res) {
|
|
1990
1985
|
setHistoryMessageList(function(historyMessageList) {
|
|
1991
1986
|
var list = historyMessageList;
|
|
@@ -2645,9 +2640,8 @@ var CustomerService = function(props) {
|
|
|
2645
2640
|
className: "yinyong_quote1",
|
|
2646
2641
|
onClick: function() {
|
|
2647
2642
|
// 问题的引用
|
|
2648
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
2649
2643
|
setCitationContent({
|
|
2650
|
-
content: item.message,
|
|
2644
|
+
content: replaceThinkAndYaml(item.message),
|
|
2651
2645
|
id: item.id,
|
|
2652
2646
|
imageUrl: !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" ? JSON.parse(item.extraInfo)[0].value : ""
|
|
2653
2647
|
});
|
|
@@ -2664,7 +2658,7 @@ var CustomerService = function(props) {
|
|
|
2664
2658
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
2665
2659
|
className: "fuzhi21",
|
|
2666
2660
|
onClick: function() {
|
|
2667
|
-
var bol = copyText(item.message);
|
|
2661
|
+
var bol = copyText(replaceThinkAndYaml(item.message));
|
|
2668
2662
|
if (bol) {
|
|
2669
2663
|
var obj = copyTextOBJ;
|
|
2670
2664
|
obj = obj.filter(function(list) {
|
|
@@ -3081,11 +3075,7 @@ var CustomerService = function(props) {
|
|
|
3081
3075
|
style: {
|
|
3082
3076
|
height: "100%"
|
|
3083
3077
|
},
|
|
3084
|
-
initialTopMostItemIndex
|
|
3085
|
-
index: "LAST",
|
|
3086
|
-
align: "end",
|
|
3087
|
-
offset: showType === 3 ? 58 : showType === 4 ? 144 : 58
|
|
3088
|
-
},
|
|
3078
|
+
// initialTopMostItemIndex={!finished&&isPositionState?undefined:{ index: "LAST", align: "end",offset:showType===3?58:showType===4?144:58 }}
|
|
3089
3079
|
initialItemCount: 10,
|
|
3090
3080
|
itemsRendered: function() {
|
|
3091
3081
|
renderMermaid();
|
|
@@ -3241,9 +3231,8 @@ var CustomerService = function(props) {
|
|
|
3241
3231
|
className: "yinyong_quote1",
|
|
3242
3232
|
onClick: function() {
|
|
3243
3233
|
// 答案的引用
|
|
3244
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
3245
3234
|
setCitationContent({
|
|
3246
|
-
content: item.message,
|
|
3235
|
+
content: replaceThinkAndYaml(item.message),
|
|
3247
3236
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
3248
3237
|
id: item.id
|
|
3249
3238
|
});
|
|
@@ -3260,7 +3249,7 @@ var CustomerService = function(props) {
|
|
|
3260
3249
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
3261
3250
|
className: "fuzhi21",
|
|
3262
3251
|
onClick: function() {
|
|
3263
|
-
var bol = copyText(item.message);
|
|
3252
|
+
var bol = copyText(replaceThinkAndYaml(item.message));
|
|
3264
3253
|
if (bol) {
|
|
3265
3254
|
var obj = copyTextOBJ;
|
|
3266
3255
|
obj = obj.filter(function(list) {
|
|
@@ -3286,7 +3275,7 @@ var CustomerService = function(props) {
|
|
|
3286
3275
|
/*#__PURE__*/ _jsx("i", {
|
|
3287
3276
|
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
3288
3277
|
onClick: function() {
|
|
3289
|
-
likeMessage(item.id, item.upvoted);
|
|
3278
|
+
likeMessage(item.id, item.upvoted, item.id);
|
|
3290
3279
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3291
3280
|
if (!isAiChatWindow) return;
|
|
3292
3281
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3294,7 +3283,7 @@ var CustomerService = function(props) {
|
|
|
3294
3283
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3295
3284
|
aiSendQuestions(1, {
|
|
3296
3285
|
roomId: roomId,
|
|
3297
|
-
message: "
|
|
3286
|
+
message: "\x03\x03\x03你给出的答案我非常满意,赞!\x03\x03\x03",
|
|
3298
3287
|
quotedMessage: "",
|
|
3299
3288
|
regenerate: false,
|
|
3300
3289
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3309,7 +3298,7 @@ var CustomerService = function(props) {
|
|
|
3309
3298
|
/*#__PURE__*/ _jsx("i", {
|
|
3310
3299
|
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
3311
3300
|
onClick: function() {
|
|
3312
|
-
disagreeMessage(item.id, item.downvoted);
|
|
3301
|
+
disagreeMessage(item.id, item.downvoted, item.id);
|
|
3313
3302
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3314
3303
|
if (!isAiChatWindow) return;
|
|
3315
3304
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3317,7 +3306,7 @@ var CustomerService = function(props) {
|
|
|
3317
3306
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3318
3307
|
aiSendQuestions(1, {
|
|
3319
3308
|
roomId: roomId,
|
|
3320
|
-
message: "
|
|
3309
|
+
message: "\x03\x03\x03你给出的答案很糟糕,我不满意,踩!\x03\x03\x03",
|
|
3321
3310
|
quotedMessage: "",
|
|
3322
3311
|
regenerate: false,
|
|
3323
3312
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3450,11 +3439,10 @@ var CustomerService = function(props) {
|
|
|
3450
3439
|
/*#__PURE__*/ _jsx("i", {
|
|
3451
3440
|
className: "yinyong_quote1",
|
|
3452
3441
|
onClick: function() {
|
|
3453
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
3454
3442
|
setCitationContent({
|
|
3455
|
-
content: item.message,
|
|
3443
|
+
content: replaceThinkAndYaml(item.message),
|
|
3456
3444
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
3457
|
-
id: item.
|
|
3445
|
+
id: item.messageId
|
|
3458
3446
|
});
|
|
3459
3447
|
resettingBottomHei();
|
|
3460
3448
|
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
@@ -3469,7 +3457,7 @@ var CustomerService = function(props) {
|
|
|
3469
3457
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
3470
3458
|
className: "fuzhi21",
|
|
3471
3459
|
onClick: function() {
|
|
3472
|
-
var bol = copyText(item.message);
|
|
3460
|
+
var bol = copyText(replaceThinkAndYaml(item.message));
|
|
3473
3461
|
if (bol) {
|
|
3474
3462
|
var obj = copyTextOBJ;
|
|
3475
3463
|
obj = obj.filter(function(list) {
|
|
@@ -3495,7 +3483,7 @@ var CustomerService = function(props) {
|
|
|
3495
3483
|
/*#__PURE__*/ _jsx("i", {
|
|
3496
3484
|
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
3497
3485
|
onClick: function() {
|
|
3498
|
-
likeMessage(item.
|
|
3486
|
+
likeMessage(item.messageId, item.upvoted, item.id);
|
|
3499
3487
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3500
3488
|
if (!isAiChatWindow) return;
|
|
3501
3489
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3504,7 +3492,7 @@ var CustomerService = function(props) {
|
|
|
3504
3492
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3505
3493
|
aiSendQuestions(1, {
|
|
3506
3494
|
roomId: roomId,
|
|
3507
|
-
message: "
|
|
3495
|
+
message: "\x03\x03\x03你给出的答案我非常满意,赞!\x03\x03\x03",
|
|
3508
3496
|
quotedMessage: "",
|
|
3509
3497
|
regenerate: false,
|
|
3510
3498
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3520,7 +3508,7 @@ var CustomerService = function(props) {
|
|
|
3520
3508
|
/*#__PURE__*/ _jsx("i", {
|
|
3521
3509
|
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
3522
3510
|
onClick: function() {
|
|
3523
|
-
disagreeMessage(item.
|
|
3511
|
+
disagreeMessage(item.messageId, item.downvoted, item.id);
|
|
3524
3512
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3525
3513
|
if (!isAiChatWindow) return;
|
|
3526
3514
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3531,7 +3519,7 @@ var CustomerService = function(props) {
|
|
|
3531
3519
|
//AI回答
|
|
3532
3520
|
aiSendQuestions(1, {
|
|
3533
3521
|
roomId: roomId,
|
|
3534
|
-
message: "
|
|
3522
|
+
message: "\x03\x03\x03你给出的答案很糟糕,我不满意,踩!\x03\x03\x03",
|
|
3535
3523
|
quotedMessage: "",
|
|
3536
3524
|
regenerate: false,
|
|
3537
3525
|
generateUpvoteOrDownvoteMessage: true
|