bhd-components 0.10.38 → 0.10.40
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 +55 -64
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +316 -316
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/customerService/contactsList.js +3 -3
- package/es2017/customerService/function.d.ts +2 -1
- package/es2017/customerService/function.js +5 -1
- package/es2017/customerService/index.js +37 -50
- package/esm/customerService/contactsList.js +3 -3
- package/esm/customerService/function.d.ts +2 -1
- package/esm/customerService/function.js +6 -1
- package/esm/customerService/index.js +39 -51
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import styles from "./index.module.less";
|
|
|
4
4
|
import { Tooltip } from "antd";
|
|
5
5
|
import { CustomAiIcon, CustomRetract } from "../icons";
|
|
6
6
|
import { CloseOutlined } from "@ant-design/icons";
|
|
7
|
-
import { getByteLen, formatDate } from "./function"; //录音使用文件
|
|
7
|
+
import { getByteLen, formatDate, replaceThinkAndYaml } from "./function"; //录音使用文件
|
|
8
8
|
const ContactsList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
9
9
|
let { type, roomId, userData, http, urllocation, onClose, switchChatRoom, contactsList } = props;
|
|
10
10
|
//删除聊天室
|
|
@@ -40,7 +40,7 @@ const ContactsList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
40
40
|
}),
|
|
41
41
|
/*#__PURE__*/ _jsx("p", {
|
|
42
42
|
className: styles.con,
|
|
43
|
-
children: contactsList.length > 0 && contactsList[0].lastMsg
|
|
43
|
+
children: contactsList.length > 0 && replaceThinkAndYaml(contactsList[0].lastMsg)
|
|
44
44
|
})
|
|
45
45
|
]
|
|
46
46
|
})
|
|
@@ -84,7 +84,7 @@ const ContactsList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
84
84
|
}),
|
|
85
85
|
/*#__PURE__*/ _jsx("p", {
|
|
86
86
|
className: styles.con,
|
|
87
|
-
children: item.lastMsg
|
|
87
|
+
children: replaceThinkAndYaml(item.lastMsg)
|
|
88
88
|
})
|
|
89
89
|
]
|
|
90
90
|
})
|
|
@@ -24,4 +24,5 @@ declare const urlToBase64: (url: string) => Promise<unknown>;
|
|
|
24
24
|
declare const toHashString: (str: string) => string;
|
|
25
25
|
declare const removeMermaidBlockComments: (markdownContent: any) => any;
|
|
26
26
|
declare const handleRenderSyntaxBlock: (markdownContent: any, flag: boolean) => any;
|
|
27
|
-
|
|
27
|
+
declare const replaceThinkAndYaml: (text?: string) => string;
|
|
28
|
+
export { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, getBase64Image, formatDate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock, replaceThinkAndYaml };
|
|
@@ -227,4 +227,8 @@ const handleRenderSyntaxBlock = (markdownContent, flag)=>{
|
|
|
227
227
|
return markdownContent;
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
-
|
|
230
|
+
// 去掉think
|
|
231
|
+
const replaceThinkAndYaml = (text = "")=>{
|
|
232
|
+
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, '');
|
|
233
|
+
};
|
|
234
|
+
export { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, getBase64Image, formatDate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock, replaceThinkAndYaml };
|
|
@@ -31,10 +31,11 @@ const { TextArea } = Input;
|
|
|
31
31
|
// import './html2canvas.test.js';
|
|
32
32
|
import knowledge_icon from "./images/knowledge_icon.png";
|
|
33
33
|
// import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
34
|
-
import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock } from "./function"; //一些方法
|
|
34
|
+
import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock, replaceThinkAndYaml } from "./function"; //一些方法
|
|
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 = /[&<>"]/;
|
|
@@ -56,10 +57,6 @@ function escapeHtml(str) {
|
|
|
56
57
|
}
|
|
57
58
|
const pattern = /!\[.*?\]\((.*?)\)/;
|
|
58
59
|
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
|
-
};
|
|
63
60
|
mermaid.initialize({
|
|
64
61
|
startOnLoad: false,
|
|
65
62
|
theme: 'default',
|
|
@@ -1270,6 +1267,7 @@ const CustomerService = (props)=>{
|
|
|
1270
1267
|
videoPageQuestiionsList(3);
|
|
1271
1268
|
}
|
|
1272
1269
|
let hasYamlStarted = false;
|
|
1270
|
+
const tempMessageId = guidGenerator();
|
|
1273
1271
|
//使用fetchEventSource接收数据
|
|
1274
1272
|
const eventSource = fetchEventSource(`${urllocation}/chat-service/public/v1.0/chat-with-ai/messages`, {
|
|
1275
1273
|
method: "POST",
|
|
@@ -1366,10 +1364,12 @@ const CustomerService = (props)=>{
|
|
|
1366
1364
|
//识别的内容
|
|
1367
1365
|
// console.log("eventSource msg: ", event.data);
|
|
1368
1366
|
let msg = JSON.parse(event.data);
|
|
1367
|
+
console.log('tempMessageId', tempMessageId);
|
|
1368
|
+
msg.tempMessageId = tempMessageId;
|
|
1369
1369
|
if (msg.message) {
|
|
1370
|
-
if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1370
|
+
// if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
1371
|
+
// hasYamlStarted = true;
|
|
1372
|
+
// }
|
|
1373
1373
|
msg.message = msg.message.replace(/<thinking>/g, '<div class="think-block">').replace(/<\/thinking>/g, '</div>\n');
|
|
1374
1374
|
}
|
|
1375
1375
|
finishedRef.current = false;
|
|
@@ -1419,8 +1419,7 @@ const CustomerService = (props)=>{
|
|
|
1419
1419
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
1420
1420
|
if (pageNumHistory > 1) return;
|
|
1421
1421
|
let obj = msg;
|
|
1422
|
-
let
|
|
1423
|
-
let id = tempId; // 原:let id = msg.messageId; 备注:解决思考过程返回的messageId和下边回复的内容值不同问题,新:改成临时固定相同id,finished完成时替换为实际返回的messageId值
|
|
1422
|
+
let id = msg.tempMessageId;
|
|
1424
1423
|
setHistoryMessageList((prevHistoryMessageList)=>{
|
|
1425
1424
|
let list1 = prevHistoryMessageList;
|
|
1426
1425
|
//删除临时数据
|
|
@@ -1445,6 +1444,7 @@ const CustomerService = (props)=>{
|
|
|
1445
1444
|
recevier: mid,
|
|
1446
1445
|
message: message,
|
|
1447
1446
|
id: id,
|
|
1447
|
+
messageId: msg.messageId,
|
|
1448
1448
|
upvoted: false,
|
|
1449
1449
|
downvoted: false,
|
|
1450
1450
|
createdAt: getDataTime(-1),
|
|
@@ -1475,6 +1475,7 @@ const CustomerService = (props)=>{
|
|
|
1475
1475
|
if (item.id == id) {
|
|
1476
1476
|
return _object_spread_props(_object_spread({}, item), {
|
|
1477
1477
|
message: message,
|
|
1478
|
+
messageId: msg.messageId,
|
|
1478
1479
|
extraInfo: extraInfo == null ? item.extraInfo : JSON.stringify(extraInfo)
|
|
1479
1480
|
});
|
|
1480
1481
|
} else {
|
|
@@ -1487,17 +1488,6 @@ const CustomerService = (props)=>{
|
|
|
1487
1488
|
console.log("isPosition", isPosition.current);
|
|
1488
1489
|
scrollToBottom();
|
|
1489
1490
|
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
1491
|
console.log('返回完成', msg, msgStreamingCountRef.current);
|
|
1502
1492
|
//发送结束
|
|
1503
1493
|
finishedRef.current = true;
|
|
@@ -1606,7 +1596,9 @@ const CustomerService = (props)=>{
|
|
|
1606
1596
|
if (ele.message.includes("<thinking>") && !ele.message.includes("</thinking>")) {
|
|
1607
1597
|
ele.message = ele.message + "</thinking>";
|
|
1608
1598
|
}
|
|
1609
|
-
return ele
|
|
1599
|
+
return _object_spread_props(_object_spread({}, ele), {
|
|
1600
|
+
messageId: ele.id
|
|
1601
|
+
});
|
|
1610
1602
|
});
|
|
1611
1603
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
1612
1604
|
setFirstItemIndex(total - maxPageSize * (page - 1));
|
|
@@ -1712,7 +1704,9 @@ const CustomerService = (props)=>{
|
|
|
1712
1704
|
}).then((res)=>{
|
|
1713
1705
|
let newHistoryMessageList = [];
|
|
1714
1706
|
if (res.data.messages.length > 0) {
|
|
1715
|
-
let dataList = res.data.messages.reverse()
|
|
1707
|
+
let dataList = res.data.messages.reverse().map((x)=>_object_spread_props(_object_spread({}, x), {
|
|
1708
|
+
messageId: x.id
|
|
1709
|
+
}));
|
|
1716
1710
|
let originList = 0;
|
|
1717
1711
|
let newList = 0;
|
|
1718
1712
|
setHistoryMessageList((historyMessageList)=>{
|
|
@@ -1791,7 +1785,7 @@ const CustomerService = (props)=>{
|
|
|
1791
1785
|
} catch (error) {}
|
|
1792
1786
|
};
|
|
1793
1787
|
//点赞消息
|
|
1794
|
-
const likeMessage = (
|
|
1788
|
+
const likeMessage = (messageId, state, id)=>{
|
|
1795
1789
|
let url = "";
|
|
1796
1790
|
//点赞状态
|
|
1797
1791
|
if (!state) {
|
|
@@ -1800,7 +1794,7 @@ const CustomerService = (props)=>{
|
|
|
1800
1794
|
url = `${urllocation}/chat-service/public/v1.0/history-messages:cancelUpvote`;
|
|
1801
1795
|
}
|
|
1802
1796
|
http.post(url, {
|
|
1803
|
-
messageId:
|
|
1797
|
+
messageId: messageId
|
|
1804
1798
|
}).then((res)=>{
|
|
1805
1799
|
setHistoryMessageList((historyMessageList)=>{
|
|
1806
1800
|
let list = historyMessageList;
|
|
@@ -1815,7 +1809,7 @@ const CustomerService = (props)=>{
|
|
|
1815
1809
|
});
|
|
1816
1810
|
};
|
|
1817
1811
|
//踩
|
|
1818
|
-
const disagreeMessage = (
|
|
1812
|
+
const disagreeMessage = (messageId, state, id)=>{
|
|
1819
1813
|
let url = "";
|
|
1820
1814
|
//点赞状态
|
|
1821
1815
|
if (!state) {
|
|
@@ -1824,7 +1818,7 @@ const CustomerService = (props)=>{
|
|
|
1824
1818
|
url = `${urllocation}/chat-service/public/v1.0/history-messages:cancelDownvote`;
|
|
1825
1819
|
}
|
|
1826
1820
|
http.post(url, {
|
|
1827
|
-
messageId:
|
|
1821
|
+
messageId: messageId
|
|
1828
1822
|
}).then((res)=>{
|
|
1829
1823
|
setHistoryMessageList((historyMessageList)=>{
|
|
1830
1824
|
let list = historyMessageList;
|
|
@@ -2497,9 +2491,8 @@ const CustomerService = (props)=>{
|
|
|
2497
2491
|
className: "yinyong_quote1",
|
|
2498
2492
|
onClick: ()=>{
|
|
2499
2493
|
// 问题的引用
|
|
2500
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
2501
2494
|
setCitationContent({
|
|
2502
|
-
content: item.message,
|
|
2495
|
+
content: replaceThinkAndYaml(item.message),
|
|
2503
2496
|
id: item.id,
|
|
2504
2497
|
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
2498
|
});
|
|
@@ -2514,7 +2507,7 @@ const CustomerService = (props)=>{
|
|
|
2514
2507
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
2515
2508
|
className: "fuzhi21",
|
|
2516
2509
|
onClick: ()=>{
|
|
2517
|
-
let bol = copyText(item.message);
|
|
2510
|
+
let bol = copyText(replaceThinkAndYaml(item.message));
|
|
2518
2511
|
if (bol) {
|
|
2519
2512
|
let obj = copyTextOBJ;
|
|
2520
2513
|
obj = obj.filter((list)=>list != item.id);
|
|
@@ -2911,11 +2904,7 @@ const CustomerService = (props)=>{
|
|
|
2911
2904
|
style: {
|
|
2912
2905
|
height: '100%'
|
|
2913
2906
|
},
|
|
2914
|
-
initialTopMostItemIndex
|
|
2915
|
-
index: "LAST",
|
|
2916
|
-
align: "end",
|
|
2917
|
-
offset: showType === 3 ? 58 : showType === 4 ? 144 : 58
|
|
2918
|
-
},
|
|
2907
|
+
// initialTopMostItemIndex={!finished&&isPositionState?undefined:{ index: "LAST", align: "end",offset:showType===3?58:showType===4?144:58 }}
|
|
2919
2908
|
initialItemCount: 10,
|
|
2920
2909
|
itemsRendered: ()=>{
|
|
2921
2910
|
renderMermaid();
|
|
@@ -3069,9 +3058,8 @@ const CustomerService = (props)=>{
|
|
|
3069
3058
|
className: "yinyong_quote1",
|
|
3070
3059
|
onClick: ()=>{
|
|
3071
3060
|
// 答案的引用
|
|
3072
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
3073
3061
|
setCitationContent({
|
|
3074
|
-
content: item.message,
|
|
3062
|
+
content: replaceThinkAndYaml(item.message),
|
|
3075
3063
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
3076
3064
|
id: item.id
|
|
3077
3065
|
});
|
|
@@ -3086,7 +3074,7 @@ const CustomerService = (props)=>{
|
|
|
3086
3074
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
3087
3075
|
className: "fuzhi21",
|
|
3088
3076
|
onClick: ()=>{
|
|
3089
|
-
let bol = copyText(item.message);
|
|
3077
|
+
let bol = copyText(replaceThinkAndYaml(item.message));
|
|
3090
3078
|
if (bol) {
|
|
3091
3079
|
let obj = copyTextOBJ;
|
|
3092
3080
|
obj = obj.filter((list)=>list != item.id);
|
|
@@ -3108,7 +3096,7 @@ const CustomerService = (props)=>{
|
|
|
3108
3096
|
/*#__PURE__*/ _jsx("i", {
|
|
3109
3097
|
className: `Frame427319094 ${item.upvoted ? styles.active : ""}`,
|
|
3110
3098
|
onClick: ()=>{
|
|
3111
|
-
likeMessage(item.
|
|
3099
|
+
likeMessage(item.messageId, item.upvoted, item.id);
|
|
3112
3100
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3113
3101
|
if (!isAiChatWindow) return;
|
|
3114
3102
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3116,7 +3104,7 @@ const CustomerService = (props)=>{
|
|
|
3116
3104
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3117
3105
|
aiSendQuestions(1, {
|
|
3118
3106
|
roomId: roomId,
|
|
3119
|
-
message: "
|
|
3107
|
+
message: "\u0003\u0003\u0003你给出的答案我非常满意,赞!\u0003\u0003\u0003",
|
|
3120
3108
|
quotedMessage: "",
|
|
3121
3109
|
regenerate: false,
|
|
3122
3110
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3131,7 +3119,7 @@ const CustomerService = (props)=>{
|
|
|
3131
3119
|
/*#__PURE__*/ _jsx("i", {
|
|
3132
3120
|
className: `Frame427319095 ${item.downvoted ? styles.active : ""}`,
|
|
3133
3121
|
onClick: ()=>{
|
|
3134
|
-
disagreeMessage(item.
|
|
3122
|
+
disagreeMessage(item.messageId, item.downvoted, item.id);
|
|
3135
3123
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3136
3124
|
if (!isAiChatWindow) return;
|
|
3137
3125
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3139,7 +3127,7 @@ const CustomerService = (props)=>{
|
|
|
3139
3127
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3140
3128
|
aiSendQuestions(1, {
|
|
3141
3129
|
roomId: roomId,
|
|
3142
|
-
message: "
|
|
3130
|
+
message: "\u0003\u0003\u0003你给出的答案很糟糕,我不满意,踩!\u0003\u0003\u0003",
|
|
3143
3131
|
quotedMessage: "",
|
|
3144
3132
|
regenerate: false,
|
|
3145
3133
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3266,11 +3254,10 @@ const CustomerService = (props)=>{
|
|
|
3266
3254
|
/*#__PURE__*/ _jsx("i", {
|
|
3267
3255
|
className: "yinyong_quote1",
|
|
3268
3256
|
onClick: ()=>{
|
|
3269
|
-
item.message = replaceThinkAndYaml(item.message);
|
|
3270
3257
|
setCitationContent({
|
|
3271
|
-
content: item.message,
|
|
3258
|
+
content: replaceThinkAndYaml(item.message),
|
|
3272
3259
|
imageUrl: item.extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value,
|
|
3273
|
-
id: item.
|
|
3260
|
+
id: item.messageId
|
|
3274
3261
|
});
|
|
3275
3262
|
resettingBottomHei();
|
|
3276
3263
|
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
@@ -3283,7 +3270,7 @@ const CustomerService = (props)=>{
|
|
|
3283
3270
|
}) : /*#__PURE__*/ _jsx("i", {
|
|
3284
3271
|
className: "fuzhi21",
|
|
3285
3272
|
onClick: ()=>{
|
|
3286
|
-
let bol = copyText(item.message);
|
|
3273
|
+
let bol = copyText(replaceThinkAndYaml(item.message));
|
|
3287
3274
|
if (bol) {
|
|
3288
3275
|
let obj = copyTextOBJ;
|
|
3289
3276
|
obj = obj.filter((list)=>list != item.id);
|
|
@@ -3305,7 +3292,7 @@ const CustomerService = (props)=>{
|
|
|
3305
3292
|
/*#__PURE__*/ _jsx("i", {
|
|
3306
3293
|
className: `Frame427319094 ${item.upvoted ? styles.active : ""}`,
|
|
3307
3294
|
onClick: ()=>{
|
|
3308
|
-
likeMessage(item.
|
|
3295
|
+
likeMessage(item.messageId, item.upvoted, item.id);
|
|
3309
3296
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3310
3297
|
if (!isAiChatWindow) return;
|
|
3311
3298
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3314,7 +3301,7 @@ const CustomerService = (props)=>{
|
|
|
3314
3301
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3315
3302
|
aiSendQuestions(1, {
|
|
3316
3303
|
roomId: roomId,
|
|
3317
|
-
message: "
|
|
3304
|
+
message: "\u0003\u0003\u0003你给出的答案我非常满意,赞!\u0003\u0003\u0003",
|
|
3318
3305
|
quotedMessage: "",
|
|
3319
3306
|
regenerate: false,
|
|
3320
3307
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3330,7 +3317,7 @@ const CustomerService = (props)=>{
|
|
|
3330
3317
|
/*#__PURE__*/ _jsx("i", {
|
|
3331
3318
|
className: `Frame427319095 ${item.downvoted ? styles.active : ""}`,
|
|
3332
3319
|
onClick: ()=>{
|
|
3333
|
-
disagreeMessage(item.
|
|
3320
|
+
disagreeMessage(item.messageId, item.downvoted, item.id);
|
|
3334
3321
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3335
3322
|
if (!isAiChatWindow) return;
|
|
3336
3323
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3341,7 +3328,7 @@ const CustomerService = (props)=>{
|
|
|
3341
3328
|
//AI回答
|
|
3342
3329
|
aiSendQuestions(1, {
|
|
3343
3330
|
roomId: roomId,
|
|
3344
|
-
message: "
|
|
3331
|
+
message: "\u0003\u0003\u0003你给出的答案很糟糕,我不满意,踩!\u0003\u0003\u0003",
|
|
3345
3332
|
quotedMessage: "",
|
|
3346
3333
|
regenerate: false,
|
|
3347
3334
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -4,7 +4,7 @@ import styles from "./index.module.less";
|
|
|
4
4
|
import { Tooltip } from "antd";
|
|
5
5
|
import { CustomAiIcon, CustomRetract } from "../icons";
|
|
6
6
|
import { CloseOutlined } from "@ant-design/icons";
|
|
7
|
-
import { getByteLen, formatDate } from "./function"; //录音使用文件
|
|
7
|
+
import { getByteLen, formatDate, replaceThinkAndYaml } from "./function"; //录音使用文件
|
|
8
8
|
var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
9
9
|
var type = props.type, roomId = props.roomId, userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, switchChatRoom = props.switchChatRoom, contactsList = props.contactsList;
|
|
10
10
|
//删除聊天室
|
|
@@ -44,7 +44,7 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
44
44
|
}),
|
|
45
45
|
/*#__PURE__*/ _jsx("p", {
|
|
46
46
|
className: styles.con,
|
|
47
|
-
children: contactsList.length > 0 && contactsList[0].lastMsg
|
|
47
|
+
children: contactsList.length > 0 && replaceThinkAndYaml(contactsList[0].lastMsg)
|
|
48
48
|
})
|
|
49
49
|
]
|
|
50
50
|
})
|
|
@@ -90,7 +90,7 @@ var ContactsList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
90
90
|
}),
|
|
91
91
|
/*#__PURE__*/ _jsx("p", {
|
|
92
92
|
className: styles.con,
|
|
93
|
-
children: item.lastMsg
|
|
93
|
+
children: replaceThinkAndYaml(item.lastMsg)
|
|
94
94
|
})
|
|
95
95
|
]
|
|
96
96
|
})
|
|
@@ -24,4 +24,5 @@ declare const urlToBase64: (url: string) => Promise<unknown>;
|
|
|
24
24
|
declare const toHashString: (str: string) => string;
|
|
25
25
|
declare const removeMermaidBlockComments: (markdownContent: any) => any;
|
|
26
26
|
declare const handleRenderSyntaxBlock: (markdownContent: any, flag: boolean) => any;
|
|
27
|
-
|
|
27
|
+
declare const replaceThinkAndYaml: (text?: string) => string;
|
|
28
|
+
export { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, getBase64Image, formatDate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock, replaceThinkAndYaml };
|
|
@@ -233,4 +233,9 @@ var handleRenderSyntaxBlock = function(markdownContent, flag) {
|
|
|
233
233
|
return markdownContent;
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
-
|
|
236
|
+
// 去掉think
|
|
237
|
+
var replaceThinkAndYaml = function() {
|
|
238
|
+
var text = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
239
|
+
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, "");
|
|
240
|
+
};
|
|
241
|
+
export { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, getBase64Image, formatDate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock, replaceThinkAndYaml };
|