bhd-components 0.10.39 → 0.10.41
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 +19 -14
- 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 +11 -12
- 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 +13 -13
- 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,7 +31,7 @@ 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";
|
|
@@ -57,10 +57,6 @@ function escapeHtml(str) {
|
|
|
57
57
|
}
|
|
58
58
|
const pattern = /!\[.*?\]\((.*?)\)/;
|
|
59
59
|
const exactRegex = /class\s*=\s*["']think-block["']/;
|
|
60
|
-
// 去掉think
|
|
61
|
-
const replaceThinkAndYaml = (text = "")=>{
|
|
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, '');
|
|
63
|
-
};
|
|
64
60
|
mermaid.initialize({
|
|
65
61
|
startOnLoad: false,
|
|
66
62
|
theme: 'default',
|
|
@@ -1368,6 +1364,7 @@ const CustomerService = (props)=>{
|
|
|
1368
1364
|
//识别的内容
|
|
1369
1365
|
// console.log("eventSource msg: ", event.data);
|
|
1370
1366
|
let msg = JSON.parse(event.data);
|
|
1367
|
+
console.log('tempMessageId', tempMessageId);
|
|
1371
1368
|
msg.tempMessageId = tempMessageId;
|
|
1372
1369
|
if (msg.message) {
|
|
1373
1370
|
// if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
@@ -1707,7 +1704,9 @@ const CustomerService = (props)=>{
|
|
|
1707
1704
|
}).then((res)=>{
|
|
1708
1705
|
let newHistoryMessageList = [];
|
|
1709
1706
|
if (res.data.messages.length > 0) {
|
|
1710
|
-
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
|
+
}));
|
|
1711
1710
|
let originList = 0;
|
|
1712
1711
|
let newList = 0;
|
|
1713
1712
|
setHistoryMessageList((historyMessageList)=>{
|
|
@@ -3097,7 +3096,7 @@ const CustomerService = (props)=>{
|
|
|
3097
3096
|
/*#__PURE__*/ _jsx("i", {
|
|
3098
3097
|
className: `Frame427319094 ${item.upvoted ? styles.active : ""}`,
|
|
3099
3098
|
onClick: ()=>{
|
|
3100
|
-
likeMessage(item.
|
|
3099
|
+
likeMessage(item.messageId, item.upvoted, item.id);
|
|
3101
3100
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3102
3101
|
if (!isAiChatWindow) return;
|
|
3103
3102
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3105,7 +3104,7 @@ const CustomerService = (props)=>{
|
|
|
3105
3104
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3106
3105
|
aiSendQuestions(1, {
|
|
3107
3106
|
roomId: roomId,
|
|
3108
|
-
message: "
|
|
3107
|
+
message: " 你给出的答案我非常满意,赞! \\",
|
|
3109
3108
|
quotedMessage: "",
|
|
3110
3109
|
regenerate: false,
|
|
3111
3110
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3120,7 +3119,7 @@ const CustomerService = (props)=>{
|
|
|
3120
3119
|
/*#__PURE__*/ _jsx("i", {
|
|
3121
3120
|
className: `Frame427319095 ${item.downvoted ? styles.active : ""}`,
|
|
3122
3121
|
onClick: ()=>{
|
|
3123
|
-
disagreeMessage(item.
|
|
3122
|
+
disagreeMessage(item.messageId, item.downvoted, item.id);
|
|
3124
3123
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3125
3124
|
if (!isAiChatWindow) return;
|
|
3126
3125
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3128,7 +3127,7 @@ const CustomerService = (props)=>{
|
|
|
3128
3127
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3129
3128
|
aiSendQuestions(1, {
|
|
3130
3129
|
roomId: roomId,
|
|
3131
|
-
message: "
|
|
3130
|
+
message: " 你给出的答案很糟糕,我不满意,踩! \\",
|
|
3132
3131
|
quotedMessage: "",
|
|
3133
3132
|
regenerate: false,
|
|
3134
3133
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3302,7 +3301,7 @@ const CustomerService = (props)=>{
|
|
|
3302
3301
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3303
3302
|
aiSendQuestions(1, {
|
|
3304
3303
|
roomId: roomId,
|
|
3305
|
-
message: "
|
|
3304
|
+
message: " 你给出的答案我非常满意,赞! \\",
|
|
3306
3305
|
quotedMessage: "",
|
|
3307
3306
|
regenerate: false,
|
|
3308
3307
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3329,7 +3328,7 @@ const CustomerService = (props)=>{
|
|
|
3329
3328
|
//AI回答
|
|
3330
3329
|
aiSendQuestions(1, {
|
|
3331
3330
|
roomId: roomId,
|
|
3332
|
-
message: "
|
|
3331
|
+
message: " 你给出的答案很糟糕,我不满意,踩! \\",
|
|
3333
3332
|
quotedMessage: "",
|
|
3334
3333
|
regenerate: false,
|
|
3335
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 };
|
|
@@ -35,7 +35,7 @@ var TextArea = Input.TextArea;
|
|
|
35
35
|
// import './html2canvas.test.js';
|
|
36
36
|
import knowledge_icon from "./images/knowledge_icon.png";
|
|
37
37
|
// import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
|
|
38
|
-
import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock } from "./function"; //一些方法
|
|
38
|
+
import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate, urlToBase64, toHashString, removeMermaidBlockComments, handleRenderSyntaxBlock, replaceThinkAndYaml } from "./function"; //一些方法
|
|
39
39
|
// import html2canvas from "html2canvas";
|
|
40
40
|
// const screenShot = require('./screenShotPlugin.esm')
|
|
41
41
|
import ScreenShot from "./js-screen-shot/main";
|
|
@@ -61,11 +61,6 @@ function escapeHtml(str) {
|
|
|
61
61
|
}
|
|
62
62
|
var pattern = /!\[.*?\]\((.*?)\)/;
|
|
63
63
|
var exactRegex = /class\s*=\s*["']think-block["']/;
|
|
64
|
-
// 去掉think
|
|
65
|
-
var replaceThinkAndYaml = function() {
|
|
66
|
-
var text = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
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, "");
|
|
68
|
-
};
|
|
69
64
|
mermaid.initialize({
|
|
70
65
|
startOnLoad: false,
|
|
71
66
|
theme: "default",
|
|
@@ -1516,6 +1511,7 @@ var CustomerService = function(props) {
|
|
|
1516
1511
|
//识别的内容
|
|
1517
1512
|
// console.log("eventSource msg: ", event.data);
|
|
1518
1513
|
var msg = JSON.parse(event.data);
|
|
1514
|
+
console.log("tempMessageId", tempMessageId);
|
|
1519
1515
|
msg.tempMessageId = tempMessageId;
|
|
1520
1516
|
if (msg.message) {
|
|
1521
1517
|
// if (!hasYamlStarted && msg.message && /```\s*yaml/.test(content)) {
|
|
@@ -1864,7 +1860,11 @@ var CustomerService = function(props) {
|
|
|
1864
1860
|
}).then(function(res) {
|
|
1865
1861
|
var newHistoryMessageList = [];
|
|
1866
1862
|
if (res.data.messages.length > 0) {
|
|
1867
|
-
var dataList = res.data.messages.reverse()
|
|
1863
|
+
var dataList = res.data.messages.reverse().map(function(x) {
|
|
1864
|
+
return _object_spread_props(_object_spread({}, x), {
|
|
1865
|
+
messageId: x.id
|
|
1866
|
+
});
|
|
1867
|
+
});
|
|
1868
1868
|
var originList = 0;
|
|
1869
1869
|
var newList = 0;
|
|
1870
1870
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -3275,7 +3275,7 @@ var CustomerService = function(props) {
|
|
|
3275
3275
|
/*#__PURE__*/ _jsx("i", {
|
|
3276
3276
|
className: "Frame427319094 ".concat(item.upvoted ? styles.active : ""),
|
|
3277
3277
|
onClick: function() {
|
|
3278
|
-
likeMessage(item.
|
|
3278
|
+
likeMessage(item.messageId, item.upvoted, item.id);
|
|
3279
3279
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3280
3280
|
if (!isAiChatWindow) return;
|
|
3281
3281
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3283,7 +3283,7 @@ var CustomerService = function(props) {
|
|
|
3283
3283
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3284
3284
|
aiSendQuestions(1, {
|
|
3285
3285
|
roomId: roomId,
|
|
3286
|
-
message: "
|
|
3286
|
+
message: " 你给出的答案我非常满意,赞! \\",
|
|
3287
3287
|
quotedMessage: "",
|
|
3288
3288
|
regenerate: false,
|
|
3289
3289
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3298,7 +3298,7 @@ var CustomerService = function(props) {
|
|
|
3298
3298
|
/*#__PURE__*/ _jsx("i", {
|
|
3299
3299
|
className: "Frame427319095 ".concat(item.downvoted ? styles.active : ""),
|
|
3300
3300
|
onClick: function() {
|
|
3301
|
-
disagreeMessage(item.
|
|
3301
|
+
disagreeMessage(item.messageId, item.downvoted, item.id);
|
|
3302
3302
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
3303
3303
|
if (!isAiChatWindow) return;
|
|
3304
3304
|
//只有最后一条回答,支持发送点赞或踩
|
|
@@ -3306,7 +3306,7 @@ var CustomerService = function(props) {
|
|
|
3306
3306
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3307
3307
|
aiSendQuestions(1, {
|
|
3308
3308
|
roomId: roomId,
|
|
3309
|
-
message: "
|
|
3309
|
+
message: " 你给出的答案很糟糕,我不满意,踩! \\",
|
|
3310
3310
|
quotedMessage: "",
|
|
3311
3311
|
regenerate: false,
|
|
3312
3312
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3492,7 +3492,7 @@ var CustomerService = function(props) {
|
|
|
3492
3492
|
if (!item.extraInfo && item.sender == "AI") {
|
|
3493
3493
|
aiSendQuestions(1, {
|
|
3494
3494
|
roomId: roomId,
|
|
3495
|
-
message: "
|
|
3495
|
+
message: " 你给出的答案我非常满意,赞! \\",
|
|
3496
3496
|
quotedMessage: "",
|
|
3497
3497
|
regenerate: false,
|
|
3498
3498
|
generateUpvoteOrDownvoteMessage: true
|
|
@@ -3519,7 +3519,7 @@ var CustomerService = function(props) {
|
|
|
3519
3519
|
//AI回答
|
|
3520
3520
|
aiSendQuestions(1, {
|
|
3521
3521
|
roomId: roomId,
|
|
3522
|
-
message: "
|
|
3522
|
+
message: " 你给出的答案很糟糕,我不满意,踩! \\",
|
|
3523
3523
|
quotedMessage: "",
|
|
3524
3524
|
regenerate: false,
|
|
3525
3525
|
generateUpvoteOrDownvoteMessage: true
|