bhd-components 0.6.6 → 0.6.8
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/{869a16fb.esm.es5.development.js → 12224038.esm.es5.development.js} +1 -1
- package/dist/{c220442c.esm.es5.production.js → 600075bb.esm.es5.production.js} +1 -1
- package/dist/index.esm.es5.development.css +730 -722
- package/dist/index.esm.es5.development.js +227 -152
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/customerService/function.js +19 -12
- package/es2017/customerService/historyFun.js +26 -17
- package/es2017/customerService/index.js +176 -121
- package/es2017/customerService/index.module.less +6 -20
- package/es2017/customerService/index2.module.less +6 -20
- package/esm/customerService/function.js +19 -12
- package/esm/customerService/historyFun.js +26 -17
- package/esm/customerService/index.js +180 -121
- package/esm/customerService/index.module.less +6 -20
- package/esm/customerService/index2.module.less +6 -20
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as zhCN, C as ConfigProvider, _ as _extends, a as _object_destructuring_empty, j as jsx, b as _object_spread_props, S as StyleProvider, t as transform, c as _object_spread, d as _sliced_to_array, T as Tooltip, e as Table$2, I as Icon, f as jsxs, m as message, E as ExclamationCircleFilled, P as Pagination, g as Select, h as CaretDownOutlined, M as Modal, i as _inherits, k as _create_super, l as _create_class, n as _class_call_check, o as _define_property, p as _assert_this_initialized, q as _async_to_generator, L as LeftOutlined, R as RightOutlined, r as MinusOutlined, s as PlusOutlined, u as __generator, v as Input, w as SearchOutlined, x as CloseOutlined, y as Remarkable, D as Drawer, H as HighlightJS } from './
|
|
2
|
-
export { A as Affix, B as Alert, F as Anchor, aA as App, G as AutoComplete, J as Avatar, N as BackTop, O as Badge, Q as Breadcrumb, U as Button, V as Calendar, W as Card, X as Carousel, Y as Cascader, Z as Checkbox, $ as Col, a0 as Collapse, a1 as DatePicker, a2 as Descriptions, a3 as Divider, D as Drawer, a4 as Dropdown, a5 as Empty, K as FloatButton, a6 as Form, a7 as Grid, a8 as Image, v as Input, a9 as InputNumber, aa as Layout, ab as List, ac as Mentions, ad as Menu, M as Modal, af as Popconfirm, ag as Popover, ah as Progress, aH as QRCode, ai as Radio, aj as Rate, ak as Result, al as Row, am as Segmented, g as Select, an as Skeleton, ao as Slider, ap as Space, aq as Spin, ar as Statistic, as as Steps, at as Switch, au as Tabs, av as Tag, ax as TimePicker, ay as Timeline, T as Tooltip, az as Tour, aB as Transfer, aC as Tree, aD as TreeSelect, aE as Typography, aF as Upload, aG as Watermark, aJ as en_US, ae as notification, aw as theme, aI as version, z as zh_CN } from './
|
|
1
|
+
import { z as zhCN, C as ConfigProvider, _ as _extends, a as _object_destructuring_empty, j as jsx, b as _object_spread_props, S as StyleProvider, t as transform, c as _object_spread, d as _sliced_to_array, T as Tooltip, e as Table$2, I as Icon, f as jsxs, m as message, E as ExclamationCircleFilled, P as Pagination, g as Select, h as CaretDownOutlined, M as Modal, i as _inherits, k as _create_super, l as _create_class, n as _class_call_check, o as _define_property, p as _assert_this_initialized, q as _async_to_generator, L as LeftOutlined, R as RightOutlined, r as MinusOutlined, s as PlusOutlined, u as __generator, v as Input, w as SearchOutlined, x as CloseOutlined, y as Remarkable, D as Drawer, H as HighlightJS } from './12224038.esm.es5.development.js';
|
|
2
|
+
export { A as Affix, B as Alert, F as Anchor, aA as App, G as AutoComplete, J as Avatar, N as BackTop, O as Badge, Q as Breadcrumb, U as Button, V as Calendar, W as Card, X as Carousel, Y as Cascader, Z as Checkbox, $ as Col, a0 as Collapse, a1 as DatePicker, a2 as Descriptions, a3 as Divider, D as Drawer, a4 as Dropdown, a5 as Empty, K as FloatButton, a6 as Form, a7 as Grid, a8 as Image, v as Input, a9 as InputNumber, aa as Layout, ab as List, ac as Mentions, ad as Menu, M as Modal, af as Popconfirm, ag as Popover, ah as Progress, aH as QRCode, ai as Radio, aj as Rate, ak as Result, al as Row, am as Segmented, g as Select, an as Skeleton, ao as Slider, ap as Space, aq as Spin, ar as Statistic, as as Steps, at as Switch, au as Tabs, av as Tag, ax as TimePicker, ay as Timeline, T as Tooltip, az as Tour, aB as Transfer, aC as Tree, aD as TreeSelect, aE as Typography, aF as Upload, aG as Watermark, aJ as en_US, ae as notification, aw as theme, aI as version, z as zh_CN } from './12224038.esm.es5.development.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useState, useRef, useEffect, useLayoutEffect, forwardRef, useImperativeHandle } from 'react';
|
|
5
5
|
import { Fragment } from 'react/jsx-runtime';
|
|
@@ -2332,7 +2332,7 @@ function BhdAppLayout(props) {
|
|
|
2332
2332
|
});
|
|
2333
2333
|
}
|
|
2334
2334
|
|
|
2335
|
-
var modules_63b47c51 = {"service_ChatWindow_Drawer":"
|
|
2335
|
+
var modules_63b47c51 = {"service_ChatWindow_Drawer":"index_module_service_ChatWindow_Drawer__1d39865c","ChatWindow_Modal":"index_module_ChatWindow_Modal__1d39865c","ChatWindow_Drawer":"index_module_ChatWindow_Drawer__1d39865c","header_wrap":"index_module_header_wrap__1d39865c","top":"index_module_top__1d39865c","user":"index_module_user__1d39865c","count":"index_module_count__1d39865c","operate":"index_module_operate__1d39865c","line":"index_module_line__1d39865c","header_wrap_newlabo":"index_module_header_wrap_newlabo__1d39865c","Drawer_main":"index_module_Drawer_main__1d39865c","loading":"index_module_loading__1d39865c","message_con":"index_module_message_con__1d39865c","left":"index_module_left__1d39865c","head_sculpture":"index_module_head_sculpture__1d39865c","main_content":"index_module_main_content__1d39865c","right":"index_module_right__1d39865c","main":"index_module_main__1d39865c","main_content_flag":"index_module_main_content_flag__1d39865c","operate_modal":"index_module_operate_modal__1d39865c","content":"index_module_content__1d39865c","content_child":"index_module_content_child__1d39865c","active":"index_module_active__1d39865c","ask_question":"index_module_ask_question__1d39865c","operate_modal_bottom":"index_module_operate_modal_bottom__1d39865c","stop_generate":"index_module_stop_generate__1d39865c","icon":"index_module_icon__1d39865c","find_teacher":"index_module_find_teacher__1d39865c","stop_findTeacher":"index_module_stop_findTeacher__1d39865c","association_problem":"index_module_association_problem__1d39865c","time":"index_module_time__1d39865c","citation_content":"index_module_citation_content__1d39865c","text_exceed":"index_module_text_exceed__1d39865c","popover_content":"index_module_popover_content__1d39865c","Drawer_main_newlabo":"index_module_Drawer_main_newlabo__1d39865c","Drawer_main_newlabo_no_pic":"index_module_Drawer_main_newlabo_no_pic__1d39865c","Drawer_buttom_Issues_List":"index_module_Drawer_buttom_Issues_List__1d39865c","issues_list_teacherList":"index_module_issues_list_teacherList__1d39865c","item":"index_module_item__1d39865c","issues_list":"index_module_issues_list__1d39865c","sign":"index_module_sign__1d39865c","Drawer_buttom":"index_module_Drawer_buttom__1d39865c","input_wrap":"index_module_input_wrap__1d39865c","input":"index_module_input__1d39865c","no_AI":"index_module_no_AI__1d39865c","voice":"index_module_voice__1d39865c","voice_btn":"index_module_voice_btn__1d39865c","disabled":"index_module_disabled__1d39865c","content_main":"index_module_content_main__1d39865c","content_con":"index_module_content_con__1d39865c","delete_quote":"index_module_delete_quote__1d39865c","sending":"index_module_sending__1d39865c","Drawer_buttom_Issues_List_newlabo":"index_module_Drawer_buttom_Issues_List_newlabo__1d39865c","main_list":"index_module_main_list__1d39865c","chat_content":"index_module_chat_content__1d39865c","popover_main_content":"index_module_popover_main_content__1d39865c","popover_main_content_name":"index_module_popover_main_content_name__1d39865c","teacher_layout":"index_module_teacher_layout__1d39865c","bottom":"index_module_bottom__1d39865c","delete":"index_module_delete__1d39865c","num":"index_module_num__1d39865c","shrink":"index_module_shrink__1d39865c","teacher_layout_newlabo":"index_module_teacher_layout_newlabo__1d39865c","teacher_layout_modal":"index_module_teacher_layout_modal__1d39865c","ai":"index_module_ai__1d39865c","user_info":"index_module_user_info__1d39865c","message":"index_module_message__1d39865c","con":"index_module_con__1d39865c","teacher_layout_modal_newlabo":"index_module_teacher_layout_modal_newlabo__1d39865c","history_list":"index_module_history_list__1d39865c","search_layout":"index_module_search_layout__1d39865c","mymove":"index_module_mymove__1d39865c","title":"index_module_title__1d39865c","search_top":"index_module_search_top__1d39865c","list_item":"index_module_list_item__1d39865c","list_summary":"index_module_list_summary__1d39865c","head_img":"index_module_head_img__1d39865c","list_desc":"index_module_list_desc__1d39865c","name":"index_module_name__1d39865c","decs":"index_module_decs__1d39865c","open":"index_module_open__1d39865c","list_detail":"index_module_list_detail__1d39865c","list":"index_module_list__1d39865c","list_more":"index_module_list_more__1d39865c","no_data":"index_module_no_data__1d39865c","history_list_broadside":"index_module_history_list_broadside__1d39865c"};
|
|
2336
2336
|
|
|
2337
2337
|
//消息已读
|
|
2338
2338
|
var readMessage = function(roomId, urllocation, userData, http) {
|
|
@@ -2370,19 +2370,26 @@ var serverUrl = function() {
|
|
|
2370
2370
|
};
|
|
2371
2371
|
//复制内容
|
|
2372
2372
|
var copyText = function(text) {
|
|
2373
|
-
// text是复制文本
|
|
2374
|
-
// 创建input元素
|
|
2375
|
-
|
|
2376
|
-
// 给input元素赋值需要复制的文本
|
|
2377
|
-
el.setAttribute("value", text);
|
|
2378
|
-
// 将input元素插入页面
|
|
2379
|
-
document.body.appendChild(el);
|
|
2380
|
-
// 选中input元素的文本
|
|
2381
|
-
el.select();
|
|
2382
|
-
// 复制内容到剪贴板
|
|
2373
|
+
// // text是复制文本
|
|
2374
|
+
// // 创建input元素
|
|
2375
|
+
// const el = document.createElement("textarea");
|
|
2376
|
+
// // 给input元素赋值需要复制的文本
|
|
2377
|
+
// el.setAttribute("value", text);
|
|
2378
|
+
// // 将input元素插入页面
|
|
2379
|
+
// document.body.appendChild(el);
|
|
2380
|
+
// // 选中input元素的文本
|
|
2381
|
+
// el.select();
|
|
2382
|
+
// // 复制内容到剪贴板
|
|
2383
|
+
// document.execCommand("copy");
|
|
2384
|
+
// // 删除input元素
|
|
2385
|
+
// document.body.removeChild(el);
|
|
2386
|
+
// return true;
|
|
2387
|
+
var tempInput = document.createElement("textarea");
|
|
2388
|
+
document.body.appendChild(tempInput);
|
|
2389
|
+
tempInput.value = text;
|
|
2390
|
+
tempInput.select();
|
|
2383
2391
|
document.execCommand("copy");
|
|
2384
|
-
|
|
2385
|
-
document.body.removeChild(el);
|
|
2392
|
+
document.body.removeChild(tempInput);
|
|
2386
2393
|
return true;
|
|
2387
2394
|
};
|
|
2388
2395
|
//获取当前时间
|
|
@@ -2688,6 +2695,7 @@ var HistoryFun = function(props) {
|
|
|
2688
2695
|
}),
|
|
2689
2696
|
/*#__PURE__*/ jsx("span", {
|
|
2690
2697
|
onClick: function() {
|
|
2698
|
+
loadSpecifiedData();
|
|
2691
2699
|
onClose();
|
|
2692
2700
|
},
|
|
2693
2701
|
children: /*#__PURE__*/ jsx(CustomClose$1, {})
|
|
@@ -2759,13 +2767,18 @@ var HistoryFun = function(props) {
|
|
|
2759
2767
|
var span = "";
|
|
2760
2768
|
var time = "";
|
|
2761
2769
|
if (item.count == 1) {
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
}
|
|
2770
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2771
|
+
//搜索内容是否有特殊字符
|
|
2772
|
+
if (reg.test(keyWordProblem)) {
|
|
2773
|
+
span = item.message.replaceAll(keyWordProblem, function(e) {
|
|
2774
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(e, "</span>");
|
|
2775
|
+
});
|
|
2776
|
+
} else {
|
|
2777
|
+
span = item.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
2778
|
+
// console.log(i,'skdcnsdjk')
|
|
2779
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2769
2782
|
var currentTime = getDataTime(-1, 1); //当前时间
|
|
2770
2783
|
var createdAt = getDataTime(item.createdAt, 1);
|
|
2771
2784
|
if (currentTime == createdAt) {
|
|
@@ -2847,16 +2860,19 @@ var HistoryFun = function(props) {
|
|
|
2847
2860
|
} else {
|
|
2848
2861
|
time = getDataTime(list.updatedAt);
|
|
2849
2862
|
}
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2863
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
2864
|
+
var span = "";
|
|
2865
|
+
//搜索内容是否有特殊字符
|
|
2866
|
+
if (reg.test(keyWordProblem)) {
|
|
2867
|
+
span = list.message.replaceAll(keyWordProblem, function(e) {
|
|
2868
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(e, "</span>");
|
|
2869
|
+
});
|
|
2870
|
+
} else {
|
|
2871
|
+
span = list.message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
2872
|
+
// console.log(i,'skdcnsdjk')
|
|
2873
|
+
return "<span class=".concat(modules_63b47c51.sign, ">").concat(i, "</span>");
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2860
2876
|
return /*#__PURE__*/ jsxs("div", {
|
|
2861
2877
|
className: modules_63b47c51.list,
|
|
2862
2878
|
onClick: function() {
|
|
@@ -3317,34 +3333,32 @@ var CustomerService = function(props) {
|
|
|
3317
3333
|
var clientHeight = container.clientHeight;
|
|
3318
3334
|
var scrollHeight = container.scrollHeight;
|
|
3319
3335
|
// console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
3320
|
-
if (clientHeight + scrollTop + 0.5 >= scrollHeight) {
|
|
3321
|
-
|
|
3322
|
-
// console.log(
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
listTimer.current = setTimeout(function() {
|
|
3336
|
+
if (clientHeight + scrollTop + 0.5 >= scrollHeight && pageNumHistory > 1) {
|
|
3337
|
+
// if (pageNumHistory > 1) {
|
|
3338
|
+
// console.log(pageNumHistory,'pageNumpageNumpageNum')
|
|
3339
|
+
var number = pageNumHistory - 1;
|
|
3340
|
+
setPageNumHistory(number);
|
|
3341
|
+
clearTimeout(listTimer.current);
|
|
3342
|
+
listTimer.current = setTimeout(function() {
|
|
3343
|
+
if (number > 0) {
|
|
3344
|
+
setBottomLoading(true);
|
|
3330
3345
|
getHistoryMessage(number, 4);
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3346
|
+
setLastId("");
|
|
3347
|
+
} else {
|
|
3348
|
+
setPageNumHistory(0);
|
|
3349
|
+
}
|
|
3350
|
+
}, 1000);
|
|
3351
|
+
// } else {
|
|
3352
|
+
// }
|
|
3335
3353
|
}
|
|
3336
3354
|
if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
|
|
3337
3355
|
console.log("到顶了", pageNum);
|
|
3338
|
-
// if(pageNum == 1){
|
|
3339
|
-
// setFirstpage(true);//代表是否存在第一页
|
|
3340
|
-
// }
|
|
3341
3356
|
setLoading(true);
|
|
3342
3357
|
var number1 = pageNum + 1;
|
|
3343
3358
|
setPageNum(function(pageNum) {
|
|
3344
3359
|
return pageNum + 1;
|
|
3345
3360
|
});
|
|
3346
3361
|
listTimer.current = setTimeout(function() {
|
|
3347
|
-
console.log("下拉加载下一页", number1);
|
|
3348
3362
|
getHistoryMessage(number1, 2);
|
|
3349
3363
|
}, 1000);
|
|
3350
3364
|
}
|
|
@@ -3563,17 +3577,19 @@ var CustomerService = function(props) {
|
|
|
3563
3577
|
setCitationContent({});
|
|
3564
3578
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
3565
3579
|
if (res.data.id) {
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3580
|
+
if (pageNumHistory <= 1) {
|
|
3581
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3582
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
3583
|
+
id: res.data.id,
|
|
3584
|
+
upvoted: false,
|
|
3585
|
+
downvoted: false,
|
|
3586
|
+
quotedMessage: "",
|
|
3587
|
+
createdAt: getDataTime(-1),
|
|
3588
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
3589
|
+
}));
|
|
3590
|
+
return newHistoryMessageList;
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3577
3593
|
scrollToBottom();
|
|
3578
3594
|
if (type == 4) {
|
|
3579
3595
|
sendGreetingMessage(6);
|
|
@@ -3686,21 +3702,23 @@ var CustomerService = function(props) {
|
|
|
3686
3702
|
} else if (userData.modules.some(function(item) {
|
|
3687
3703
|
return item.short == "AIservice";
|
|
3688
3704
|
})) {
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3705
|
+
if (pageNumHistory <= 1) {
|
|
3706
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3707
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
3708
|
+
roomId: roomId,
|
|
3709
|
+
sender: mid,
|
|
3710
|
+
recevier: "AI",
|
|
3711
|
+
message: keyWord,
|
|
3712
|
+
quotedMessage: citationContent.content,
|
|
3713
|
+
id: "654321",
|
|
3714
|
+
upvoted: false,
|
|
3715
|
+
downvoted: false,
|
|
3716
|
+
createdAt: getDataTime(-1),
|
|
3717
|
+
extraInfo: JSON.stringify([])
|
|
3718
|
+
});
|
|
3719
|
+
return newHistoryMessageList;
|
|
3701
3720
|
});
|
|
3702
|
-
|
|
3703
|
-
});
|
|
3721
|
+
}
|
|
3704
3722
|
setFinished(false);
|
|
3705
3723
|
aiSendQuestions(3, {
|
|
3706
3724
|
//相关数据
|
|
@@ -3718,32 +3736,36 @@ var CustomerService = function(props) {
|
|
|
3718
3736
|
};
|
|
3719
3737
|
//向知识库发送问题 或答案 type:1 发送问题 2 接受答案
|
|
3720
3738
|
var sendingExistingIssues = function(type, obj, questions) {
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3739
|
+
if (pageNumHistory <= 1) {
|
|
3740
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3741
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
3742
|
+
id: null,
|
|
3743
|
+
upvoted: false,
|
|
3744
|
+
downvoted: false,
|
|
3745
|
+
createdAt: getDataTime(-1),
|
|
3746
|
+
extraInfo: JSON.stringify(obj.extraInfos)
|
|
3747
|
+
}));
|
|
3748
|
+
return newHistoryMessageList;
|
|
3749
|
+
});
|
|
3750
|
+
scrollToBottom();
|
|
3751
|
+
}
|
|
3732
3752
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
3733
3753
|
if (res.data.id) {
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3754
|
+
if (pageNumHistory <= 1) {
|
|
3755
|
+
//更新聊天记录id
|
|
3756
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3757
|
+
var newHistoryMessageList = historyMessageList.map(function(item) {
|
|
3758
|
+
if (item.id == null) {
|
|
3759
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
3760
|
+
id: res.data.id
|
|
3761
|
+
});
|
|
3762
|
+
} else {
|
|
3763
|
+
return item;
|
|
3764
|
+
}
|
|
3765
|
+
});
|
|
3766
|
+
return newHistoryMessageList;
|
|
3744
3767
|
});
|
|
3745
|
-
|
|
3746
|
-
});
|
|
3768
|
+
}
|
|
3747
3769
|
}
|
|
3748
3770
|
if (type == 1) {
|
|
3749
3771
|
//发送答案,调用自动回答
|
|
@@ -3808,39 +3830,42 @@ var CustomerService = function(props) {
|
|
|
3808
3830
|
setTimeout(function() {
|
|
3809
3831
|
setQuestionsList([]);
|
|
3810
3832
|
}, 2000);
|
|
3833
|
+
// console.log(pageNumHistory,44444444444444);
|
|
3811
3834
|
//占位信息
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3835
|
+
if (pageNumHistory <= 1) {
|
|
3836
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
3837
|
+
if (type == 2) {
|
|
3838
|
+
return historyMessageList.map(function(item) {
|
|
3839
|
+
if (item.id == id) {
|
|
3840
|
+
return {
|
|
3841
|
+
roomId: roomId,
|
|
3842
|
+
sender: "AI",
|
|
3843
|
+
recevier: mid,
|
|
3844
|
+
message: "正在输入...",
|
|
3845
|
+
id: "123456",
|
|
3846
|
+
createdAt: getDataTime(-1),
|
|
3847
|
+
extraInfo: null
|
|
3848
|
+
};
|
|
3849
|
+
} else {
|
|
3850
|
+
return item;
|
|
3851
|
+
}
|
|
3852
|
+
});
|
|
3853
|
+
} else {
|
|
3854
|
+
return historyMessageList.concat({
|
|
3855
|
+
roomId: roomId,
|
|
3856
|
+
sender: "AI",
|
|
3857
|
+
recevier: mid,
|
|
3858
|
+
message: "正在输入...",
|
|
3859
|
+
id: "123456",
|
|
3860
|
+
createdAt: getDataTime(-1),
|
|
3861
|
+
extraInfo: null
|
|
3862
|
+
});
|
|
3863
|
+
}
|
|
3864
|
+
});
|
|
3865
|
+
setTimeout(function() {
|
|
3866
|
+
scrollToBottom();
|
|
3867
|
+
}, 10);
|
|
3868
|
+
}
|
|
3844
3869
|
//使用fetchEventSource接收数据
|
|
3845
3870
|
fetchEventSource("".concat(urllocation, "/chat-service/public/v1.0/chat-with-ai/messages"), {
|
|
3846
3871
|
method: "POST",
|
|
@@ -3959,7 +3984,9 @@ var CustomerService = function(props) {
|
|
|
3959
3984
|
};
|
|
3960
3985
|
//渲染AI回答
|
|
3961
3986
|
var renderAiAnswer = function(msg, message_id, type) {
|
|
3987
|
+
// console.log(pageNumHistory,5555555);
|
|
3962
3988
|
// console.log(aiSendQuestions().abort(),'slkdsdsdsd')
|
|
3989
|
+
if (pageNumHistory > 1) return;
|
|
3963
3990
|
var obj = msg;
|
|
3964
3991
|
var id = msg.messageId;
|
|
3965
3992
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -4011,9 +4038,9 @@ var CustomerService = function(props) {
|
|
|
4011
4038
|
return newHistoryMessageList2;
|
|
4012
4039
|
}
|
|
4013
4040
|
});
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4041
|
+
setTimeout(function() {
|
|
4042
|
+
scrollToBottom();
|
|
4043
|
+
}, 10);
|
|
4017
4044
|
};
|
|
4018
4045
|
//问题记录到实验报告中
|
|
4019
4046
|
var testLabQuestion = function(title, content, teachId) {
|
|
@@ -4059,7 +4086,7 @@ var CustomerService = function(props) {
|
|
|
4059
4086
|
};
|
|
4060
4087
|
//获取历史消息 flag:1,历史记录点击定位,2,代表是上拉加载,3,存在新的消息-->老师回答等,4,下拉加载,滚动到底部时,主要用于查看历史记录
|
|
4061
4088
|
var getHistoryMessage = function(pageNum, flag) {
|
|
4062
|
-
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1";
|
|
4089
|
+
var id = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "1", raw_data = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
|
|
4063
4090
|
clearTimeout(roomMessage.current);
|
|
4064
4091
|
// console.log(pageNum,flag,'dkfjvndfjvndfkvdf')
|
|
4065
4092
|
// flag == 1 时已经设置好了位置标记
|
|
@@ -4076,10 +4103,11 @@ var CustomerService = function(props) {
|
|
|
4076
4103
|
}
|
|
4077
4104
|
var rid = flag == 3 ? id : roomId;
|
|
4078
4105
|
if (rid == "") return;
|
|
4106
|
+
var page = pageNum ? pageNum : 1;
|
|
4079
4107
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), {
|
|
4080
4108
|
params: {
|
|
4081
4109
|
roomId: rid,
|
|
4082
|
-
page:
|
|
4110
|
+
page: page,
|
|
4083
4111
|
maxPageSize: 30,
|
|
4084
4112
|
direction: "desc"
|
|
4085
4113
|
}
|
|
@@ -4091,6 +4119,13 @@ var CustomerService = function(props) {
|
|
|
4091
4119
|
var total = res.data.total;
|
|
4092
4120
|
var maxPageSize = 30;
|
|
4093
4121
|
var dataList = res.data.messages.reverse();
|
|
4122
|
+
//历史记录点击进来的,多加载一页,防止定位不准
|
|
4123
|
+
if (flag == 1 && page > 1) {
|
|
4124
|
+
var markPage = page - 1;
|
|
4125
|
+
setPageNumHistory(markPage);
|
|
4126
|
+
getHistoryMessage(page - 1, 5, "1", dataList);
|
|
4127
|
+
return;
|
|
4128
|
+
}
|
|
4094
4129
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
4095
4130
|
var newHistoryMessageList = [];
|
|
4096
4131
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -4099,6 +4134,9 @@ var CustomerService = function(props) {
|
|
|
4099
4134
|
if (flag == 1) {
|
|
4100
4135
|
newHistoryMessageList = dataList;
|
|
4101
4136
|
}
|
|
4137
|
+
if (flag == 5) {
|
|
4138
|
+
newHistoryMessageList = raw_data.concat(dataList);
|
|
4139
|
+
}
|
|
4102
4140
|
if (flag == 4) {
|
|
4103
4141
|
newHistoryMessageList = historyMessageList.concat(dataList); //下拉加载,向后追加内容
|
|
4104
4142
|
}
|
|
@@ -4120,6 +4158,7 @@ var CustomerService = function(props) {
|
|
|
4120
4158
|
totalNumber = newHistoryMessageList.length;
|
|
4121
4159
|
return newHistoryMessageList;
|
|
4122
4160
|
});
|
|
4161
|
+
// console.log(lastId,'lastIdlastId-------')
|
|
4123
4162
|
//如果在跟老师的聊天窗口,用于找到与老师的最新的聊天,并不在与老师对话的窗口中,并聊天窗口相同
|
|
4124
4163
|
try {
|
|
4125
4164
|
if (stepIds != undefined && stepIds != "" && (showType == 3 || showType == 4)) {
|
|
@@ -4201,6 +4240,7 @@ var CustomerService = function(props) {
|
|
|
4201
4240
|
if (!lastId && originList != newList) {
|
|
4202
4241
|
setTimeout(function() {
|
|
4203
4242
|
scrollToBottom();
|
|
4243
|
+
readMessage(roomId, urllocation, userData, http);
|
|
4204
4244
|
}, 100);
|
|
4205
4245
|
}
|
|
4206
4246
|
}
|
|
@@ -4452,13 +4492,12 @@ var CustomerService = function(props) {
|
|
|
4452
4492
|
container.scrollTop = 60;
|
|
4453
4493
|
try {
|
|
4454
4494
|
setTimeout(function() {
|
|
4455
|
-
|
|
4495
|
+
var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top - 20 : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top + 24;
|
|
4496
|
+
// let top =
|
|
4456
4497
|
// showType == 1 || showType == 3
|
|
4457
|
-
// ? $("#li_flag").offset().top
|
|
4498
|
+
// ? $("#li_flag").offset().top
|
|
4458
4499
|
// : $("#chat_content_modal #li_flag").offset().top -
|
|
4459
|
-
// $("#chat_content_modal").offset().top
|
|
4460
|
-
// 24;
|
|
4461
|
-
var top = showType == 1 || showType == 3 ? $("#li_flag").offset().top : $("#chat_content_modal #li_flag").offset().top - $("#chat_content_modal").offset().top;
|
|
4500
|
+
// $("#chat_content_modal").offset().top;
|
|
4462
4501
|
// console.log(top2,top,444444444444)
|
|
4463
4502
|
$("#".concat(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal")).animate({
|
|
4464
4503
|
scrollTop: top
|
|
@@ -5339,7 +5378,7 @@ var CustomerService = function(props) {
|
|
|
5339
5378
|
var placeholder = "";
|
|
5340
5379
|
var disabled = false;
|
|
5341
5380
|
if (voiceRecordingStatus == 2) {
|
|
5342
|
-
placeholder = "
|
|
5381
|
+
placeholder = "正在录制语音,再次点击麦克风结束录制。";
|
|
5343
5382
|
} else if (voiceRecordingStatus == 1) {
|
|
5344
5383
|
placeholder = "正在语音识别文字,请稍后...";
|
|
5345
5384
|
} else if (!finished) {
|
|
@@ -5413,9 +5452,15 @@ var CustomerService = function(props) {
|
|
|
5413
5452
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
5414
5453
|
sendToTeacher(2);
|
|
5415
5454
|
} else {
|
|
5416
|
-
|
|
5455
|
+
clearTimeout(timer.current);
|
|
5417
5456
|
setQuestionsList([]);
|
|
5457
|
+
setAnswerMode(-1);
|
|
5418
5458
|
setTeacherList([]);
|
|
5459
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
5460
|
+
return historyMessageList.filter(function(item) {
|
|
5461
|
+
return item.id != "-1";
|
|
5462
|
+
});
|
|
5463
|
+
});
|
|
5419
5464
|
sendMessage("", 0);
|
|
5420
5465
|
}
|
|
5421
5466
|
setButtomHei(45);
|
|
@@ -5516,6 +5561,15 @@ var CustomerService = function(props) {
|
|
|
5516
5561
|
if (roomList.length > 0 && roomList[0].roomId != roomId) {
|
|
5517
5562
|
sendToTeacher(2);
|
|
5518
5563
|
} else {
|
|
5564
|
+
clearTimeout(timer.current);
|
|
5565
|
+
setQuestionsList([]);
|
|
5566
|
+
setAnswerMode(-1);
|
|
5567
|
+
setTeacherList([]);
|
|
5568
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
5569
|
+
return historyMessageList.filter(function(item) {
|
|
5570
|
+
return item.id != "-1";
|
|
5571
|
+
});
|
|
5572
|
+
});
|
|
5519
5573
|
sendMessage("", 0);
|
|
5520
5574
|
}
|
|
5521
5575
|
onEvent(serverName + serverUrl(), "click_智能问答_ Enter", "提交");
|
|
@@ -5564,9 +5618,19 @@ var CustomerService = function(props) {
|
|
|
5564
5618
|
bottom: "".concat(buttomHei + 14, "px")
|
|
5565
5619
|
},
|
|
5566
5620
|
children: teacherList.map(function(item) {
|
|
5567
|
-
var
|
|
5568
|
-
|
|
5569
|
-
|
|
5621
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
5622
|
+
var span = "";
|
|
5623
|
+
//搜索内容是否有特殊字符
|
|
5624
|
+
if (reg.test(keyWord)) {
|
|
5625
|
+
span = item.name.replaceAll(keyWord, function(e) {
|
|
5626
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
5627
|
+
});
|
|
5628
|
+
} else {
|
|
5629
|
+
span = item.name.replaceAll(new RegExp(keyWord, "ig"), function(i) {
|
|
5630
|
+
// console.log(i,'skdcnsdjk')
|
|
5631
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
5632
|
+
});
|
|
5633
|
+
}
|
|
5570
5634
|
return /*#__PURE__*/ jsx("p", {
|
|
5571
5635
|
className: styles.item,
|
|
5572
5636
|
children: /*#__PURE__*/ jsx("span", {
|
|
@@ -5587,9 +5651,19 @@ var CustomerService = function(props) {
|
|
|
5587
5651
|
bottom: "".concat(buttomHei + 6, "px")
|
|
5588
5652
|
},
|
|
5589
5653
|
children: questionsList.map(function(item) {
|
|
5590
|
-
var
|
|
5591
|
-
|
|
5592
|
-
|
|
5654
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
5655
|
+
var span = "";
|
|
5656
|
+
//搜索内容是否有特殊字符
|
|
5657
|
+
if (reg.test(keyWord)) {
|
|
5658
|
+
span = item.question.replaceAll(keyWord, function(e) {
|
|
5659
|
+
return "<span class=".concat(styles.sign, ">").concat(e, "</span>");
|
|
5660
|
+
});
|
|
5661
|
+
} else {
|
|
5662
|
+
span = item.question.replaceAll(new RegExp(keyWord, "ig"), function(i) {
|
|
5663
|
+
// console.log(i,'skdcnsdjk')
|
|
5664
|
+
return "<span class=".concat(styles.sign, ">").concat(i, "</span>");
|
|
5665
|
+
});
|
|
5666
|
+
}
|
|
5593
5667
|
return /*#__PURE__*/ jsx("p", {
|
|
5594
5668
|
className: styles.item,
|
|
5595
5669
|
children: /*#__PURE__*/ jsx("span", {
|
|
@@ -5609,25 +5683,26 @@ var CustomerService = function(props) {
|
|
|
5609
5683
|
};
|
|
5610
5684
|
//加载指定数据,点击历史记录
|
|
5611
5685
|
var loadSpecifiedData = function(renewRoomId, page, id, receiver) {
|
|
5686
|
+
// let renewRoomId = '4a615d7126b343f78d10dcb06dbc29b0';
|
|
5687
|
+
// let page = 1;
|
|
5688
|
+
// let id = '0e459f0a3a62438698f170b42b94d150';
|
|
5689
|
+
// let receiver = mid;
|
|
5612
5690
|
if (page != 1) {
|
|
5613
5691
|
setPageNumHistory(page);
|
|
5614
5692
|
}
|
|
5615
|
-
setPageNum(page);
|
|
5616
5693
|
setLastId(id); //用于定位
|
|
5694
|
+
setPageNum(page);
|
|
5617
5695
|
//如果是当前聊天室
|
|
5618
5696
|
if (renewRoomId == roomId) {
|
|
5619
5697
|
getHistoryMessage(page, 1);
|
|
5620
5698
|
} else {
|
|
5621
5699
|
setRoomId(renewRoomId);
|
|
5622
|
-
// if (childRef.current) {
|
|
5623
5700
|
if (receiver != mid) {
|
|
5624
5701
|
createRooms(receiver);
|
|
5625
5702
|
}
|
|
5626
5703
|
setTimeout(function() {
|
|
5627
|
-
// childRef.current.roomsListTimer();
|
|
5628
5704
|
roomsListTimer();
|
|
5629
5705
|
}, 500);
|
|
5630
|
-
// }
|
|
5631
5706
|
}
|
|
5632
5707
|
setShowContacts(true);
|
|
5633
5708
|
};
|