bhd-components 0.9.9 → 0.9.11
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.css +1113 -1106
- package/dist/index.esm.es5.development.js +93 -33
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +415 -415
- package/dist/vendor.esm.es5.production.js +2 -2
- package/es2017/bhdAppLayout/components/BhdTableSimple/index.js +10 -5
- package/es2017/bhdAppLayout/index.module.less +2 -1
- package/es2017/bhdSelect/index.js +1 -1
- package/es2017/customerService/index.js +82 -28
- package/es2017/customerService/index.module.less +5 -1
- package/es2017/customerService/index2.module.less +4 -1
- package/esm/bhdAppLayout/components/BhdTableSimple/index.js +7 -2
- package/esm/bhdAppLayout/index.module.less +2 -1
- package/esm/bhdSelect/index.js +1 -1
- package/esm/customerService/index.js +82 -28
- package/esm/customerService/index.module.less +5 -1
- package/esm/customerService/index2.module.less +4 -1
- package/package.json +1 -1
|
@@ -20,15 +20,20 @@ import i18Conversion from "../../../i18n";
|
|
|
20
20
|
let { className, locale, borderBottom = false, rowSelection, ajaxErr, dataSource, kind = "simple", loading, notDataText = i18Conversion("noData") } = props;
|
|
21
21
|
const tableRef = useRef(null);
|
|
22
22
|
const renderTableText = ()=>{
|
|
23
|
-
let minHeight =
|
|
24
|
-
|
|
23
|
+
let minHeight = tableRef.current ? tableRef.current.offsetHeight - 42 - 32 : 0;
|
|
24
|
+
if (props.scroll && props.scroll.y) {
|
|
25
|
+
if (String(props.scroll.y).includes("calc")) {
|
|
26
|
+
minHeight = props.scroll.y.replace(/\)/, "");
|
|
27
|
+
minHeight = minHeight + " - 42px)";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
25
30
|
let width = tableRef.current ? tableRef.current.offsetWidth - 42 : 0;
|
|
26
31
|
if (ajaxErr) {
|
|
27
32
|
return /*#__PURE__*/ _jsxs("div", {
|
|
28
33
|
className: "app_BhdTableSimple_errorTable",
|
|
29
34
|
style: {
|
|
30
35
|
minHeight: minHeight,
|
|
31
|
-
width: width +
|
|
36
|
+
width: width + "px"
|
|
32
37
|
},
|
|
33
38
|
children: [
|
|
34
39
|
/*#__PURE__*/ _jsx("img", {
|
|
@@ -46,7 +51,7 @@ import i18Conversion from "../../../i18n";
|
|
|
46
51
|
className: "app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable",
|
|
47
52
|
style: {
|
|
48
53
|
minHeight: minHeight,
|
|
49
|
-
width: width +
|
|
54
|
+
width: width + "px"
|
|
50
55
|
},
|
|
51
56
|
children: [
|
|
52
57
|
/*#__PURE__*/ _jsx("img", {
|
|
@@ -66,7 +71,7 @@ import i18Conversion from "../../../i18n";
|
|
|
66
71
|
return /*#__PURE__*/ _jsxs("div", {
|
|
67
72
|
className: "app_BhdTableSimple_noTable",
|
|
68
73
|
style: {
|
|
69
|
-
width: width +
|
|
74
|
+
width: width + "px",
|
|
70
75
|
minHeight: minHeight
|
|
71
76
|
},
|
|
72
77
|
children: [
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
height: calc(100vh - 60px);
|
|
6
6
|
background-color: #fff;
|
|
7
|
+
position: relative;
|
|
7
8
|
:global {
|
|
8
9
|
}
|
|
9
10
|
.bhd_app_layout_header {
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
.bhd_app_layout_footer {
|
|
83
84
|
width: calc(100% - 60px);
|
|
84
85
|
height: 56px;
|
|
85
|
-
position:
|
|
86
|
+
position: absolute;
|
|
86
87
|
z-index: 10;
|
|
87
88
|
bottom: 0;
|
|
88
89
|
display: flex;
|
|
@@ -31,6 +31,25 @@ import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, re
|
|
|
31
31
|
// import html2canvas from "html2canvas";
|
|
32
32
|
// const screenShot = require('./screenShotPlugin.esm')
|
|
33
33
|
import ScreenShot from "./js-screen-shot/main";
|
|
34
|
+
/*
|
|
35
|
+
自定义remarkable的text解析规则
|
|
36
|
+
*/ const HTML_ESCAPE_TEST_RE = /[&<>"]/;
|
|
37
|
+
const HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
|
|
38
|
+
const HTML_REPLACEMENTS = {
|
|
39
|
+
'&': '&',
|
|
40
|
+
'<': '<',
|
|
41
|
+
'>': '>',
|
|
42
|
+
'"': '"'
|
|
43
|
+
};
|
|
44
|
+
function replaceUnsafeChar(ch) {
|
|
45
|
+
return HTML_REPLACEMENTS[ch];
|
|
46
|
+
}
|
|
47
|
+
function escapeHtml(str) {
|
|
48
|
+
if (HTML_ESCAPE_TEST_RE.test(str)) {
|
|
49
|
+
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
|
|
50
|
+
}
|
|
51
|
+
return str;
|
|
52
|
+
}
|
|
34
53
|
const CustomerService = (props)=>{
|
|
35
54
|
let { userData, http, urllocation, onCancel, serverName, fetchEventSource, initShowType, onEvent, stepIds, stepId, screenshotAreaId, config } = props;
|
|
36
55
|
// const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
|
|
@@ -86,6 +105,7 @@ const CustomerService = (props)=>{
|
|
|
86
105
|
let newHotQuestionsList = useRef([]); //视频热门问题
|
|
87
106
|
let newShowType = useRef(false);
|
|
88
107
|
const mid = props.userData.mid;
|
|
108
|
+
const renderAiAnswerTimer = useRef(null);
|
|
89
109
|
const remarkable = new Remarkable({
|
|
90
110
|
highlight: function(str, lang) {
|
|
91
111
|
if (lang && hljs.getLanguage(lang)) {
|
|
@@ -99,6 +119,26 @@ const CustomerService = (props)=>{
|
|
|
99
119
|
return ""; // use external default escaping
|
|
100
120
|
}
|
|
101
121
|
});
|
|
122
|
+
const remarkReplaceKey = (message, keyWordProblem)=>{
|
|
123
|
+
let newRemarkable = new Remarkable({
|
|
124
|
+
highlight: function(str, lang) {
|
|
125
|
+
if (lang && hljs.getLanguage(lang)) {
|
|
126
|
+
try {
|
|
127
|
+
return hljs.highlight(lang, str).value;
|
|
128
|
+
} catch (err) {}
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
return hljs.highlightAuto(str).value;
|
|
132
|
+
} catch (err) {}
|
|
133
|
+
return ""; // use external default escaping
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
newRemarkable.renderer.rules.text = (tokens, idx)=>{
|
|
137
|
+
let text = escapeHtml(tokens[idx].content);
|
|
138
|
+
return text.replace(keyWordProblem, `<span class="${styles.sign}">${keyWordProblem}</span>`);
|
|
139
|
+
};
|
|
140
|
+
return newRemarkable.render(message);
|
|
141
|
+
};
|
|
102
142
|
const [screenShotType, setScreenShotType] = useState(0) //1是 screenShotPlugin 2是html2canvas
|
|
103
143
|
;
|
|
104
144
|
const screenShotPlugin = useRef();
|
|
@@ -345,6 +385,7 @@ const CustomerService = (props)=>{
|
|
|
345
385
|
clearTimeout(timer.current);
|
|
346
386
|
clearTimeout(roomMessage.current);
|
|
347
387
|
clearTimeout(chatRoomList.current);
|
|
388
|
+
clearTimeout(renderAiAnswerTimer.current);
|
|
348
389
|
};
|
|
349
390
|
}, []);
|
|
350
391
|
useEffect(()=>{
|
|
@@ -1101,11 +1142,14 @@ const CustomerService = (props)=>{
|
|
|
1101
1142
|
},
|
|
1102
1143
|
onmessage (event) {
|
|
1103
1144
|
//识别的内容
|
|
1104
|
-
console.log("eventSource msg: ", event.data);
|
|
1145
|
+
// console.log("eventSource msg: ", event.data);
|
|
1105
1146
|
let msg = JSON.parse(event.data);
|
|
1106
1147
|
if (msg.message) {
|
|
1107
1148
|
content = content + msg.message;
|
|
1108
|
-
|
|
1149
|
+
// isPosition.current = true;
|
|
1150
|
+
renderAiAnswerTimer.current = setTimeout(()=>{
|
|
1151
|
+
renderAiAnswer(msg, id, type);
|
|
1152
|
+
}, 100);
|
|
1109
1153
|
}
|
|
1110
1154
|
if (msg.finished) {
|
|
1111
1155
|
setFinished(true); //发送结束
|
|
@@ -1133,11 +1177,7 @@ const CustomerService = (props)=>{
|
|
|
1133
1177
|
};
|
|
1134
1178
|
//渲染AI回答
|
|
1135
1179
|
const renderAiAnswer = (msg, message_id, type)=>{
|
|
1136
|
-
console.log('renderAiAnswer',
|
|
1137
|
-
msg,
|
|
1138
|
-
message_id,
|
|
1139
|
-
type
|
|
1140
|
-
});
|
|
1180
|
+
// console.log('renderAiAnswer',{msg,message_id,type})
|
|
1141
1181
|
// console.log(pageNumHistory,5555555);
|
|
1142
1182
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
1143
1183
|
if (pageNumHistory > 1) return;
|
|
@@ -1158,10 +1198,7 @@ const CustomerService = (props)=>{
|
|
|
1158
1198
|
let list = prevHistoryMessageList.filter((item)=>{
|
|
1159
1199
|
return item.id == id;
|
|
1160
1200
|
});
|
|
1161
|
-
console.log('renderAiAnswer',
|
|
1162
|
-
list1,
|
|
1163
|
-
list
|
|
1164
|
-
});
|
|
1201
|
+
// console.log('renderAiAnswer',{list1,list})
|
|
1165
1202
|
let message = "";
|
|
1166
1203
|
if (list.length == 0) {
|
|
1167
1204
|
message = obj.message;
|
|
@@ -1210,10 +1247,15 @@ const CustomerService = (props)=>{
|
|
|
1210
1247
|
return newHistoryMessageList2;
|
|
1211
1248
|
}
|
|
1212
1249
|
});
|
|
1213
|
-
|
|
1214
|
-
if (
|
|
1215
|
-
|
|
1250
|
+
const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1251
|
+
if (container) {
|
|
1252
|
+
container.scrollTop = container.scrollHeight;
|
|
1216
1253
|
}
|
|
1254
|
+
// console.log('historyMessageList',historyMessageList)
|
|
1255
|
+
// if(isPosition.current){
|
|
1256
|
+
// console.log('mmmmmmmmmmmmm打印一下',)
|
|
1257
|
+
// scrollToBottom();
|
|
1258
|
+
// }
|
|
1217
1259
|
};
|
|
1218
1260
|
//问题记录到实验报告中
|
|
1219
1261
|
const testLabQuestion = (title, content, teachId)=>{
|
|
@@ -1712,8 +1754,11 @@ const CustomerService = (props)=>{
|
|
|
1712
1754
|
const scrollToBottom = ()=>{
|
|
1713
1755
|
setTimeout(()=>{
|
|
1714
1756
|
const container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1757
|
+
console.log('滚到底部', container, showType);
|
|
1715
1758
|
if (container) {
|
|
1759
|
+
console.log('最好的最好的最好的', container.scrollHeight);
|
|
1716
1760
|
container.scrollTop = container.scrollHeight;
|
|
1761
|
+
//container.scrollTop = new Date().getTime()
|
|
1717
1762
|
}
|
|
1718
1763
|
}, 100);
|
|
1719
1764
|
};
|
|
@@ -2016,15 +2061,15 @@ const CustomerService = (props)=>{
|
|
|
2016
2061
|
// console.log(code,888888888);
|
|
2017
2062
|
if (lastId == item.id && keyWordProblem != '') {
|
|
2018
2063
|
//点击历史记录时,找到关键字,防止关键字和标签名重复
|
|
2019
|
-
let key_sign = 'sign_'
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
message =
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2064
|
+
// let key_sign = 'sign_'+new Date().getTime();+'sign';
|
|
2065
|
+
// message = message.replaceAll(keyWordProblem, (e:any) => {
|
|
2066
|
+
// return key_sign;
|
|
2067
|
+
// });
|
|
2068
|
+
// message = remarkable.render(message);
|
|
2069
|
+
// message = message.replaceAll(key_sign, (e:any) => {
|
|
2070
|
+
// return `<span class=${styles.sign}>${keyWordProblem}</span>`;
|
|
2071
|
+
// });
|
|
2072
|
+
message = remarkReplaceKey(message, keyWordProblem);
|
|
2028
2073
|
} else {
|
|
2029
2074
|
message = remarkable.render(message);
|
|
2030
2075
|
}
|
|
@@ -2263,11 +2308,11 @@ const CustomerService = (props)=>{
|
|
|
2263
2308
|
if (dom) {
|
|
2264
2309
|
const con_h = document.getElementById('chat_content').clientHeight - 24; //滚动区域的高度
|
|
2265
2310
|
const rectY = dom.getBoundingClientRect().y - 48;
|
|
2266
|
-
const h = dom.clientHeight; //当前元素高度
|
|
2311
|
+
const h = dom.clientHeight + 24; //当前元素高度
|
|
2267
2312
|
const topDom = dom.getElementsByClassName('operate_modal_showtop')[0];
|
|
2268
2313
|
const bottomDom = dom.getElementsByClassName('operate_modal_showbottom')[0];
|
|
2269
2314
|
if (topDom && bottomDom) {
|
|
2270
|
-
|
|
2315
|
+
console.log(h, con_h, rectY);
|
|
2271
2316
|
if (rectY > 0) {
|
|
2272
2317
|
topDom.style.cssText = "";
|
|
2273
2318
|
bottomDom.style.cssText = "visibility: hidden;";
|
|
@@ -2277,8 +2322,15 @@ const CustomerService = (props)=>{
|
|
|
2277
2322
|
bottomDom.style.cssText = "";
|
|
2278
2323
|
}
|
|
2279
2324
|
} else {
|
|
2280
|
-
|
|
2281
|
-
|
|
2325
|
+
// 上下都不显示
|
|
2326
|
+
if (h > con_h && h - con_h > Math.abs(rectY)) {
|
|
2327
|
+
console.log('rerererererer');
|
|
2328
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
2329
|
+
bottomDom.style.cssText = `top:${-(h + rectY - 51)}px`;
|
|
2330
|
+
} else {
|
|
2331
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
2332
|
+
bottomDom.style.cssText = "";
|
|
2333
|
+
}
|
|
2282
2334
|
}
|
|
2283
2335
|
}
|
|
2284
2336
|
}
|
|
@@ -2418,7 +2470,9 @@ const CustomerService = (props)=>{
|
|
|
2418
2470
|
]
|
|
2419
2471
|
});
|
|
2420
2472
|
}
|
|
2421
|
-
return
|
|
2473
|
+
return /*#__PURE__*/ _jsx(React.Fragment, {
|
|
2474
|
+
children: li
|
|
2475
|
+
}, item.id);
|
|
2422
2476
|
})
|
|
2423
2477
|
});
|
|
2424
2478
|
// } else {
|
|
@@ -652,7 +652,7 @@
|
|
|
652
652
|
&.bottom{
|
|
653
653
|
top:3px;
|
|
654
654
|
.operate{
|
|
655
|
-
box-shadow: 0px -4px 10px
|
|
655
|
+
box-shadow: 0px -4px 10px 4px rgba(0, 0, 0, 0.1);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
}
|
|
@@ -2103,4 +2103,8 @@
|
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
strong {
|
|
2109
|
+
font-weight: bold !important;
|
|
2106
2110
|
}
|
|
@@ -647,7 +647,7 @@
|
|
|
647
647
|
&.bottom{
|
|
648
648
|
top:3px;
|
|
649
649
|
.operate{
|
|
650
|
-
box-shadow: 0px -4px 10px
|
|
650
|
+
box-shadow: 0px -4px 10px 4px rgba(0, 0, 0, 0.1);
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
653
|
}
|
|
@@ -2085,4 +2085,7 @@
|
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
|
+
}
|
|
2089
|
+
strong {
|
|
2090
|
+
font-weight: bold !important;
|
|
2088
2091
|
}
|
|
@@ -20,8 +20,13 @@ import i18Conversion from "../../../i18n";
|
|
|
20
20
|
var className = props.className, locale = props.locale, _props_borderBottom = props.borderBottom, borderBottom = _props_borderBottom === void 0 ? false : _props_borderBottom, rowSelection = props.rowSelection, ajaxErr = props.ajaxErr, dataSource = props.dataSource, _props_kind = props.kind, kind = _props_kind === void 0 ? "simple" : _props_kind, loading = props.loading, _props_notDataText = props.notDataText, notDataText = _props_notDataText === void 0 ? i18Conversion("noData") : _props_notDataText;
|
|
21
21
|
var tableRef = useRef(null);
|
|
22
22
|
var renderTableText = function() {
|
|
23
|
-
var minHeight =
|
|
24
|
-
|
|
23
|
+
var minHeight = tableRef.current ? tableRef.current.offsetHeight - 42 - 32 : 0;
|
|
24
|
+
if (props.scroll && props.scroll.y) {
|
|
25
|
+
if (String(props.scroll.y).includes("calc")) {
|
|
26
|
+
minHeight = props.scroll.y.replace(/\)/, "");
|
|
27
|
+
minHeight = minHeight + " - 42px)";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
25
30
|
var width = tableRef.current ? tableRef.current.offsetWidth - 42 : 0;
|
|
26
31
|
if (ajaxErr) {
|
|
27
32
|
return /*#__PURE__*/ _jsxs("div", {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
height: calc(100vh - 60px);
|
|
6
6
|
background-color: #fff;
|
|
7
|
+
position: relative;
|
|
7
8
|
:global {
|
|
8
9
|
}
|
|
9
10
|
.bhd_app_layout_header {
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
.bhd_app_layout_footer {
|
|
83
84
|
width: calc(100% - 60px);
|
|
84
85
|
height: 56px;
|
|
85
|
-
position:
|
|
86
|
+
position: absolute;
|
|
86
87
|
z-index: 10;
|
|
87
88
|
bottom: 0;
|
|
88
89
|
display: flex;
|
package/esm/bhdSelect/index.js
CHANGED
|
@@ -35,6 +35,25 @@ 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
|
+
/*
|
|
39
|
+
自定义remarkable的text解析规则
|
|
40
|
+
*/ var HTML_ESCAPE_TEST_RE = /[&<>"]/;
|
|
41
|
+
var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
|
|
42
|
+
var HTML_REPLACEMENTS = {
|
|
43
|
+
"&": "&",
|
|
44
|
+
"<": "<",
|
|
45
|
+
">": ">",
|
|
46
|
+
'"': """
|
|
47
|
+
};
|
|
48
|
+
function replaceUnsafeChar(ch) {
|
|
49
|
+
return HTML_REPLACEMENTS[ch];
|
|
50
|
+
}
|
|
51
|
+
function escapeHtml(str) {
|
|
52
|
+
if (HTML_ESCAPE_TEST_RE.test(str)) {
|
|
53
|
+
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
|
|
54
|
+
}
|
|
55
|
+
return str;
|
|
56
|
+
}
|
|
38
57
|
var CustomerService = function(props) {
|
|
39
58
|
var userData = props.userData, http = props.http, urllocation = props.urllocation, onCancel = props.onCancel, serverName = props.serverName, fetchEventSource = props.fetchEventSource, initShowType = props.initShowType, onEvent = props.onEvent, stepIds = props.stepIds, stepId = props.stepId, screenshotAreaId = props.screenshotAreaId, config = props.config;
|
|
40
59
|
// const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
|
|
@@ -90,6 +109,7 @@ var CustomerService = function(props) {
|
|
|
90
109
|
var newHotQuestionsList = useRef([]); //视频热门问题
|
|
91
110
|
var newShowType = useRef(false);
|
|
92
111
|
var mid = props.userData.mid;
|
|
112
|
+
var renderAiAnswerTimer = useRef(null);
|
|
93
113
|
var remarkable = new Remarkable({
|
|
94
114
|
highlight: function highlight(str, lang) {
|
|
95
115
|
if (lang && hljs.getLanguage(lang)) {
|
|
@@ -103,6 +123,26 @@ var CustomerService = function(props) {
|
|
|
103
123
|
return ""; // use external default escaping
|
|
104
124
|
}
|
|
105
125
|
});
|
|
126
|
+
var remarkReplaceKey = function(message, keyWordProblem) {
|
|
127
|
+
var newRemarkable = new Remarkable({
|
|
128
|
+
highlight: function highlight(str, lang) {
|
|
129
|
+
if (lang && hljs.getLanguage(lang)) {
|
|
130
|
+
try {
|
|
131
|
+
return hljs.highlight(lang, str).value;
|
|
132
|
+
} catch (err) {}
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
return hljs.highlightAuto(str).value;
|
|
136
|
+
} catch (err) {}
|
|
137
|
+
return ""; // use external default escaping
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
newRemarkable.renderer.rules.text = function(tokens, idx) {
|
|
141
|
+
var text = escapeHtml(tokens[idx].content);
|
|
142
|
+
return text.replace(keyWordProblem, '<span class="'.concat(styles.sign, '">').concat(keyWordProblem, "</span>"));
|
|
143
|
+
};
|
|
144
|
+
return newRemarkable.render(message);
|
|
145
|
+
};
|
|
106
146
|
var _useState33 //1是 screenShotPlugin 2是html2canvas
|
|
107
147
|
= _sliced_to_array(useState(0), 2), screenShotType = _useState33[0], setScreenShotType = _useState33[1];
|
|
108
148
|
var screenShotPlugin = useRef();
|
|
@@ -350,6 +390,7 @@ var CustomerService = function(props) {
|
|
|
350
390
|
clearTimeout(timer.current);
|
|
351
391
|
clearTimeout(roomMessage.current);
|
|
352
392
|
clearTimeout(chatRoomList.current);
|
|
393
|
+
clearTimeout(renderAiAnswerTimer.current);
|
|
353
394
|
};
|
|
354
395
|
}, []);
|
|
355
396
|
useEffect(function() {
|
|
@@ -1147,11 +1188,14 @@ var CustomerService = function(props) {
|
|
|
1147
1188
|
},
|
|
1148
1189
|
onmessage: function onmessage(event) {
|
|
1149
1190
|
//识别的内容
|
|
1150
|
-
console.log("eventSource msg: ", event.data);
|
|
1191
|
+
// console.log("eventSource msg: ", event.data);
|
|
1151
1192
|
var msg = JSON.parse(event.data);
|
|
1152
1193
|
if (msg.message) {
|
|
1153
1194
|
content = content + msg.message;
|
|
1154
|
-
|
|
1195
|
+
// isPosition.current = true;
|
|
1196
|
+
renderAiAnswerTimer.current = setTimeout(function() {
|
|
1197
|
+
renderAiAnswer(msg, id, type);
|
|
1198
|
+
}, 100);
|
|
1155
1199
|
}
|
|
1156
1200
|
if (msg.finished) {
|
|
1157
1201
|
setFinished(true); //发送结束
|
|
@@ -1181,11 +1225,7 @@ var CustomerService = function(props) {
|
|
|
1181
1225
|
};
|
|
1182
1226
|
//渲染AI回答
|
|
1183
1227
|
var renderAiAnswer = function(msg, message_id, type) {
|
|
1184
|
-
console.log(
|
|
1185
|
-
msg: msg,
|
|
1186
|
-
message_id: message_id,
|
|
1187
|
-
type: type
|
|
1188
|
-
});
|
|
1228
|
+
// console.log('renderAiAnswer',{msg,message_id,type})
|
|
1189
1229
|
// console.log(pageNumHistory,5555555);
|
|
1190
1230
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
1191
1231
|
if (pageNumHistory > 1) return;
|
|
@@ -1206,10 +1246,7 @@ var CustomerService = function(props) {
|
|
|
1206
1246
|
var list = prevHistoryMessageList.filter(function(item) {
|
|
1207
1247
|
return item.id == id;
|
|
1208
1248
|
});
|
|
1209
|
-
console.log(
|
|
1210
|
-
list1: list1,
|
|
1211
|
-
list: list
|
|
1212
|
-
});
|
|
1249
|
+
// console.log('renderAiAnswer',{list1,list})
|
|
1213
1250
|
var message = "";
|
|
1214
1251
|
if (list.length == 0) {
|
|
1215
1252
|
message = obj.message;
|
|
@@ -1258,10 +1295,15 @@ var CustomerService = function(props) {
|
|
|
1258
1295
|
return newHistoryMessageList2;
|
|
1259
1296
|
}
|
|
1260
1297
|
});
|
|
1261
|
-
|
|
1262
|
-
if (
|
|
1263
|
-
|
|
1298
|
+
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1299
|
+
if (container) {
|
|
1300
|
+
container.scrollTop = container.scrollHeight;
|
|
1264
1301
|
}
|
|
1302
|
+
// console.log('historyMessageList',historyMessageList)
|
|
1303
|
+
// if(isPosition.current){
|
|
1304
|
+
// console.log('mmmmmmmmmmmmm打印一下',)
|
|
1305
|
+
// scrollToBottom();
|
|
1306
|
+
// }
|
|
1265
1307
|
};
|
|
1266
1308
|
//问题记录到实验报告中
|
|
1267
1309
|
var testLabQuestion = function(title, content, teachId) {
|
|
@@ -1778,8 +1820,11 @@ var CustomerService = function(props) {
|
|
|
1778
1820
|
var scrollToBottom = function() {
|
|
1779
1821
|
setTimeout(function() {
|
|
1780
1822
|
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
1823
|
+
console.log("滚到底部", container, showType);
|
|
1781
1824
|
if (container) {
|
|
1825
|
+
console.log("最好的最好的最好的", container.scrollHeight);
|
|
1782
1826
|
container.scrollTop = container.scrollHeight;
|
|
1827
|
+
//container.scrollTop = new Date().getTime()
|
|
1783
1828
|
}
|
|
1784
1829
|
}, 100);
|
|
1785
1830
|
};
|
|
@@ -2090,15 +2135,15 @@ var CustomerService = function(props) {
|
|
|
2090
2135
|
// console.log(code,888888888);
|
|
2091
2136
|
if (lastId == item.id && keyWordProblem != "") {
|
|
2092
2137
|
//点击历史记录时,找到关键字,防止关键字和标签名重复
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
message =
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2138
|
+
// let key_sign = 'sign_'+new Date().getTime();+'sign';
|
|
2139
|
+
// message = message.replaceAll(keyWordProblem, (e:any) => {
|
|
2140
|
+
// return key_sign;
|
|
2141
|
+
// });
|
|
2142
|
+
// message = remarkable.render(message);
|
|
2143
|
+
// message = message.replaceAll(key_sign, (e:any) => {
|
|
2144
|
+
// return `<span class=${styles.sign}>${keyWordProblem}</span>`;
|
|
2145
|
+
// });
|
|
2146
|
+
message = remarkReplaceKey(message, keyWordProblem);
|
|
2102
2147
|
} else {
|
|
2103
2148
|
message = remarkable.render(message);
|
|
2104
2149
|
}
|
|
@@ -2312,11 +2357,11 @@ var CustomerService = function(props) {
|
|
|
2312
2357
|
if (dom) {
|
|
2313
2358
|
var con_h = document.getElementById("chat_content").clientHeight - 24; //滚动区域的高度
|
|
2314
2359
|
var rectY = dom.getBoundingClientRect().y - 48;
|
|
2315
|
-
var h = dom.clientHeight; //当前元素高度
|
|
2360
|
+
var h = dom.clientHeight + 24; //当前元素高度
|
|
2316
2361
|
var topDom = dom.getElementsByClassName("operate_modal_showtop")[0];
|
|
2317
2362
|
var bottomDom = dom.getElementsByClassName("operate_modal_showbottom")[0];
|
|
2318
2363
|
if (topDom && bottomDom) {
|
|
2319
|
-
|
|
2364
|
+
console.log(h, con_h, rectY);
|
|
2320
2365
|
if (rectY > 0) {
|
|
2321
2366
|
topDom.style.cssText = "";
|
|
2322
2367
|
bottomDom.style.cssText = "visibility: hidden;";
|
|
@@ -2326,8 +2371,15 @@ var CustomerService = function(props) {
|
|
|
2326
2371
|
bottomDom.style.cssText = "";
|
|
2327
2372
|
}
|
|
2328
2373
|
} else {
|
|
2329
|
-
|
|
2330
|
-
|
|
2374
|
+
// 上下都不显示
|
|
2375
|
+
if (h > con_h && h - con_h > Math.abs(rectY)) {
|
|
2376
|
+
console.log("rerererererer");
|
|
2377
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
2378
|
+
bottomDom.style.cssText = "top:".concat(-(h + rectY - 51), "px");
|
|
2379
|
+
} else {
|
|
2380
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
2381
|
+
bottomDom.style.cssText = "";
|
|
2382
|
+
}
|
|
2331
2383
|
}
|
|
2332
2384
|
}
|
|
2333
2385
|
}
|
|
@@ -2467,7 +2519,9 @@ var CustomerService = function(props) {
|
|
|
2467
2519
|
]
|
|
2468
2520
|
});
|
|
2469
2521
|
}
|
|
2470
|
-
return
|
|
2522
|
+
return /*#__PURE__*/ _jsx(React.Fragment, {
|
|
2523
|
+
children: li
|
|
2524
|
+
}, item.id);
|
|
2471
2525
|
})
|
|
2472
2526
|
});
|
|
2473
2527
|
// } else {
|
|
@@ -652,7 +652,7 @@
|
|
|
652
652
|
&.bottom{
|
|
653
653
|
top:3px;
|
|
654
654
|
.operate{
|
|
655
|
-
box-shadow: 0px -4px 10px
|
|
655
|
+
box-shadow: 0px -4px 10px 4px rgba(0, 0, 0, 0.1);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
}
|
|
@@ -2103,4 +2103,8 @@
|
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
strong {
|
|
2109
|
+
font-weight: bold !important;
|
|
2106
2110
|
}
|
|
@@ -647,7 +647,7 @@
|
|
|
647
647
|
&.bottom{
|
|
648
648
|
top:3px;
|
|
649
649
|
.operate{
|
|
650
|
-
box-shadow: 0px -4px 10px
|
|
650
|
+
box-shadow: 0px -4px 10px 4px rgba(0, 0, 0, 0.1);
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
653
|
}
|
|
@@ -2085,4 +2085,7 @@
|
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
2087
|
}
|
|
2088
|
+
}
|
|
2089
|
+
strong {
|
|
2090
|
+
font-weight: bold !important;
|
|
2088
2091
|
}
|