bhd-components 0.10.23 → 0.10.25
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.css +1429 -1127
- package/dist/index.esm.es5.development.js +699 -567
- 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 +2177 -2177
- package/dist/vendor.esm.es5.production.js +98 -98
- package/es2017/customerService/historyFun.js +2 -2
- package/es2017/customerService/index.js +714 -582
- package/es2017/customerService/index.module.less +30 -8
- package/es2017/customerService/index2.module.less +25 -6
- package/esm/customerService/historyFun.js +2 -2
- package/esm/customerService/index.js +692 -559
- package/esm/customerService/index.module.less +30 -8
- package/esm/customerService/index2.module.less +25 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as zhCN, A as App, _ as _object_spread, a as AntdMessage, M as Modal$1, b as AntdNotification, C as ConfigProvider, c as _extends, d as _object_destructuring_empty, j as jsx, e as _object_spread_props, f as jsxs, t as transform, S as StyleProvider, g as _sliced_to_array, T as Tooltip, h as Table$2, i as _to_consumable_array, P as Pagination$1, I as Icon, k as Select, l as CaretDownOutlined, m as _inherits, n as _create_super, o as _create_class, p as _class_call_check, q as _define_property, r as _assert_this_initialized, s as _async_to_generator, u as MinusOutlined, v as PlusOutlined, L as LeftOutlined, R as RightOutlined, w as __generator, x as Input, y as SearchOutlined, B as Spin, D as CloseOutlined, X, E as I, H, F as html2canvas$1, G as Remarkable, J as Drawer, K as HighlightJS,
|
|
2
|
-
export { a2 as Affix, a3 as Alert, a4 as Anchor, a as AntdMessage, A as App, a5 as AutoComplete, a6 as Avatar, a8 as BackTop, a9 as Badge, aa as Breadcrumb,
|
|
1
|
+
import { z as zhCN, A as App, _ as _object_spread, a as AntdMessage, M as Modal$1, b as AntdNotification, C as ConfigProvider, c as _extends, d as _object_destructuring_empty, j as jsx, e as _object_spread_props, f as jsxs, t as transform, S as StyleProvider, g as _sliced_to_array, T as Tooltip, h as Table$2, i as _to_consumable_array, P as Pagination$1, I as Icon, k as Select, l as CaretDownOutlined, m as _inherits, n as _create_super, o as _create_class, p as _class_call_check, q as _define_property, r as _assert_this_initialized, s as _async_to_generator, u as MinusOutlined, v as PlusOutlined, L as LeftOutlined, R as RightOutlined, w as __generator, x as Input, y as SearchOutlined, B as Spin, D as CloseOutlined, X, E as I, H, F as html2canvas$1, G as Remarkable, J as Drawer, K as HighlightJS, N as cn, Z as ZoomInOutlined, O as DatePicker, Q as Button, U as l, V as Upload, W as Popover, Y as DoubleRightOutlined, $ as CloseCircleFilled, a0 as Divider, a1 as fetchEventSource } from './vendor.esm.es5.development.js';
|
|
2
|
+
export { a2 as Affix, a3 as Alert, a4 as Anchor, a as AntdMessage, A as App, a5 as AutoComplete, a6 as Avatar, a8 as BackTop, a9 as Badge, aa as Breadcrumb, Q as Button, ab as Calendar, ac as Card, ad as Carousel, ae as Cascader, af as Checkbox, ag as Col, ah as Collapse, O as DatePicker, ai as Descriptions, a0 as Divider, J as Drawer, aj as Dropdown, ak as Empty, a7 as FloatButton, al as Form, am as Grid, an as Image, x as Input, ao as InputNumber, ap as Layout, aq as List, ar as Mentions, as as Menu, M as Modal, at as Popconfirm, W as Popover, au as Progress, aR as QRCode, av as Radio, aw as Rate, ax as Result, ay as Row, az as Segmented, k as Select, aA as Skeleton, aB as Slider, aC as Space, B as Spin, aD as Statistic, aE as Steps, aF as Switch, aG as Tabs, aH as Tag, aJ as TimePicker, aK as Timeline, T as Tooltip, aL as Tour, aM as Transfer, aN as Tree, aO as TreeSelect, aP as Typography, V as Upload, aQ as Watermark, aT as en_US, b as notification, aI as theme, aS as version, z as zh_CN } from './vendor.esm.es5.development.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useState, useRef, useEffect, useLayoutEffect, forwardRef, useImperativeHandle, useCallback, useMemo } from 'react';
|
|
5
5
|
import { Fragment } from 'react/jsx-runtime';
|
|
@@ -2678,7 +2678,7 @@ function BhdAppLayout(props) {
|
|
|
2678
2678
|
});
|
|
2679
2679
|
}
|
|
2680
2680
|
|
|
2681
|
-
var modules_63b47c51$f = {"service_ChatWindow_Drawer":"
|
|
2681
|
+
var modules_63b47c51$f = {"service_ChatWindow_Drawer":"index_module_service_ChatWindow_Drawer__8fd6b5bd","ChatWindow_Modal":"index_module_ChatWindow_Modal__8fd6b5bd","ChatWindow_Drawer":"index_module_ChatWindow_Drawer__8fd6b5bd","header_wrap":"index_module_header_wrap__8fd6b5bd","top":"index_module_top__8fd6b5bd","user":"index_module_user__8fd6b5bd","count":"index_module_count__8fd6b5bd","operate":"index_module_operate__8fd6b5bd","line":"index_module_line__8fd6b5bd","popover_main":"index_module_popover_main__8fd6b5bd","popover":"index_module_popover__8fd6b5bd","header_wrap_newlabo":"index_module_header_wrap_newlabo__8fd6b5bd","Drawer_main":"index_module_Drawer_main__8fd6b5bd","loading":"index_module_loading__8fd6b5bd","message_con":"index_module_message_con__8fd6b5bd","left":"index_module_left__8fd6b5bd","head_sculpture":"index_module_head_sculpture__8fd6b5bd","main_content":"index_module_main_content__8fd6b5bd","right":"index_module_right__8fd6b5bd","itemcontent":"index_module_itemcontent__8fd6b5bd","main":"index_module_main__8fd6b5bd","main_content_flag":"index_module_main_content_flag__8fd6b5bd","operate_modal":"index_module_operate_modal__8fd6b5bd","operate_modal_showtop":"index_module_operate_modal_showtop__8fd6b5bd","operate_modal_bottom":"index_module_operate_modal_bottom__8fd6b5bd","active":"index_module_active__8fd6b5bd","stop_generate":"index_module_stop_generate__8fd6b5bd","icon":"index_module_icon__8fd6b5bd","find_teacher":"index_module_find_teacher__8fd6b5bd","stop_findTeacher":"index_module_stop_findTeacher__8fd6b5bd","content":"index_module_content__8fd6b5bd","content_child":"index_module_content_child__8fd6b5bd","find_teacher_con":"index_module_find_teacher_con__8fd6b5bd","sign":"index_module_sign__8fd6b5bd","ask_question":"index_module_ask_question__8fd6b5bd","bottom":"index_module_bottom__8fd6b5bd","association_problem":"index_module_association_problem__8fd6b5bd","association_problem_flag":"index_module_association_problem_flag__8fd6b5bd","related_issues_flag":"index_module_related_issues_flag__8fd6b5bd","img_con":"index_module_img_con__8fd6b5bd","mask_zoom":"index_module_mask_zoom__8fd6b5bd","img_con2":"index_module_img_con2__8fd6b5bd","copyCode":"index_module_copyCode__8fd6b5bd","time":"index_module_time__8fd6b5bd","citation_content":"index_module_citation_content__8fd6b5bd","text_exceed":"index_module_text_exceed__8fd6b5bd","popover_content":"index_module_popover_content__8fd6b5bd","Drawer_main_newlabo":"index_module_Drawer_main_newlabo__8fd6b5bd","Drawer_main_newlabo_no_pic":"index_module_Drawer_main_newlabo_no_pic__8fd6b5bd","Drawer_buttom_Issues_List":"index_module_Drawer_buttom_Issues_List__8fd6b5bd","issues_list_teacherList":"index_module_issues_list_teacherList__8fd6b5bd","item":"index_module_item__8fd6b5bd","issues_list":"index_module_issues_list__8fd6b5bd","issues_list_flag":"index_module_issues_list_flag__8fd6b5bd","Drawer_buttom":"index_module_Drawer_buttom__8fd6b5bd","input_wrap":"index_module_input_wrap__8fd6b5bd","input":"index_module_input__8fd6b5bd","picture_layout":"index_module_picture_layout__8fd6b5bd","icon_close":"index_module_icon_close__8fd6b5bd","icon_zoom":"index_module_icon_zoom__8fd6b5bd","anticon":"index_module_anticon__8fd6b5bd","no_AI":"index_module_no_AI__8fd6b5bd","screenshot":"index_module_screenshot__8fd6b5bd","disabled":"index_module_disabled__8fd6b5bd","content_main":"index_module_content_main__8fd6b5bd","content_con":"index_module_content_con__8fd6b5bd","delete_quote":"index_module_delete_quote__8fd6b5bd","sending":"index_module_sending__8fd6b5bd","Drawer_buttom_Issues_List_newlabo":"index_module_Drawer_buttom_Issues_List_newlabo__8fd6b5bd","main_list":"index_module_main_list__8fd6b5bd","chat_content":"index_module_chat_content__8fd6b5bd","popover_main_content":"index_module_popover_main_content__8fd6b5bd","popover_main_content_name":"index_module_popover_main_content_name__8fd6b5bd","teacher_layout":"index_module_teacher_layout__8fd6b5bd","delete":"index_module_delete__8fd6b5bd","num":"index_module_num__8fd6b5bd","shrink":"index_module_shrink__8fd6b5bd","teacher_layout_newlabo":"index_module_teacher_layout_newlabo__8fd6b5bd","teacher_layout_modal":"index_module_teacher_layout_modal__8fd6b5bd","ai":"index_module_ai__8fd6b5bd","user_info":"index_module_user_info__8fd6b5bd","message":"index_module_message__8fd6b5bd","con":"index_module_con__8fd6b5bd","teacher_layout_modal_newlabo":"index_module_teacher_layout_modal_newlabo__8fd6b5bd","history_list":"index_module_history_list__8fd6b5bd","search_layout":"index_module_search_layout__8fd6b5bd","mymove":"index_module_mymove__8fd6b5bd","title":"index_module_title__8fd6b5bd","search_top":"index_module_search_top__8fd6b5bd","list_item":"index_module_list_item__8fd6b5bd","list_summary":"index_module_list_summary__8fd6b5bd","head_img":"index_module_head_img__8fd6b5bd","list_desc":"index_module_list_desc__8fd6b5bd","name":"index_module_name__8fd6b5bd","decs":"index_module_decs__8fd6b5bd","open":"index_module_open__8fd6b5bd","list_summary_active":"index_module_list_summary_active__8fd6b5bd","list_detail":"index_module_list_detail__8fd6b5bd","list":"index_module_list__8fd6b5bd","list_more":"index_module_list_more__8fd6b5bd","no_data":"index_module_no_data__8fd6b5bd","history_list_broadside":"index_module_history_list_broadside__8fd6b5bd","teacher_list":"index_module_teacher_list__8fd6b5bd","screenshot_Modal":"index_module_screenshot_Modal__8fd6b5bd","ReactCrop":"index_module_ReactCrop__8fd6b5bd","screenshot_Modal_btn":"index_module_screenshot_Modal_btn__8fd6b5bd"};
|
|
2682
2682
|
|
|
2683
2683
|
function BaseHOC(key) {
|
|
2684
2684
|
return function(props) {
|
|
@@ -2925,7 +2925,7 @@ var HistoryFun = function(props) {
|
|
|
2925
2925
|
var _useState2 = _sliced_to_array(useState(1), 2), showLoadingState = _useState2[0], setShowLoadingState = _useState2[1]; //1,初始状态,2、无数据 ,3、不显示图片
|
|
2926
2926
|
var _useState3 = _sliced_to_array(useState(1), 2), pageNum = _useState3[0], setPageNum = _useState3[1];
|
|
2927
2927
|
var _useState4 = _sliced_to_array(useState(0), 2), pageCount = _useState4[0], setPageCount = _useState4[1];
|
|
2928
|
-
var _useState5 = _sliced_to_array(useState(
|
|
2928
|
+
var _useState5 = _sliced_to_array(useState(30), 2), maxPageSize = _useState5[0]; _useState5[1];
|
|
2929
2929
|
var _useState6 = _sliced_to_array(useState([]), 2), totalData = _useState6[0], setTotalData = _useState6[1]; //总数据
|
|
2930
2930
|
var timer = useRef(null); //文本框输入时
|
|
2931
2931
|
useEffect(function() {
|
|
@@ -3018,7 +3018,7 @@ var HistoryFun = function(props) {
|
|
|
3018
3018
|
number = index;
|
|
3019
3019
|
}
|
|
3020
3020
|
});
|
|
3021
|
-
var pageNumber = findPageNumber(
|
|
3021
|
+
var pageNumber = findPageNumber(30, Math.ceil(total / 30), number);
|
|
3022
3022
|
if (number == 0) {
|
|
3023
3023
|
pageNumber = 1;
|
|
3024
3024
|
}
|
|
@@ -8161,6 +8161,7 @@ var CustomerService = function(props) {
|
|
|
8161
8161
|
var _useState1 = _sliced_to_array(useState({}), 2), citationContent = _useState1[0], setCitationContent = _useState1[1]; //引用内容
|
|
8162
8162
|
var _useState2 = _sliced_to_array(useState(""), 2), roomId = _useState2[0], setRoomId = _useState2[1]; //聊天室id
|
|
8163
8163
|
var _useState3 = _sliced_to_array(useState([]), 2), historyMessageList = _useState3[0], setHistoryMessageList = _useState3[1]; //历史消息
|
|
8164
|
+
var historyMessageListRef = useRef([]);
|
|
8164
8165
|
var _useState4 = _sliced_to_array(useState(""), 2), keyWord = _useState4[0], setKeyWord = _useState4[1]; //搜索内容
|
|
8165
8166
|
var _useState5 = _sliced_to_array(useState([]), 2), questionsList = _useState5[0], setQuestionsList = _useState5[1]; //问题列表
|
|
8166
8167
|
var _useState6 = _sliced_to_array(useState([]), 2); _useState6[0]; var setHotQuestionsList = _useState6[1]; //热门问题
|
|
@@ -8174,6 +8175,7 @@ var CustomerService = function(props) {
|
|
|
8174
8175
|
var _useState13 = _sliced_to_array(useState(true), 2), finished = _useState13[0], setFinished = _useState13[1]; //是否结束生成
|
|
8175
8176
|
var finishedRef = useRef(true); //是否结束生成
|
|
8176
8177
|
var _useState14 = _sliced_to_array(useState(""), 2), lastId = _useState14[0], setLastId = _useState14[1]; //最后一条数据的id,可用于定位当前位置
|
|
8178
|
+
var lastIdRef = useRef("");
|
|
8177
8179
|
var _useState15 = _sliced_to_array(useState({}), 2), chatWith = _useState15[0], setChatWith = _useState15[1]; //聊天的老师id或ai
|
|
8178
8180
|
var _useState16 = _sliced_to_array(useState(false), 2), firstLoad = _useState16[0], setFirstLoad = _useState16[1]; //第一次切换全屏时滚动到页面底部
|
|
8179
8181
|
var _useState17 = _sliced_to_array(useState(45), 2), buttomHei = _useState17[0], setButtomHei = _useState17[1]; //底部输入框的高度
|
|
@@ -8184,7 +8186,7 @@ var CustomerService = function(props) {
|
|
|
8184
8186
|
// const [answerMode, setAnswerMode] = useState(-1); //设置回答模式。1,召唤老师回答
|
|
8185
8187
|
// const [teacherList, setTeacherList] = useState([]); //老师列表
|
|
8186
8188
|
var _useState22 = _sliced_to_array(useState({}), 2), problem = _useState22[0], setProblem = _useState22[1]; //召唤老师回答的问题
|
|
8187
|
-
var _useState23 = _sliced_to_array(useState([]), 2)
|
|
8189
|
+
var _useState23 = _sliced_to_array(useState([]), 2); _useState23[0]; var setChatObj = _useState23[1]; //聊天记录id保存,用来在实验报告中记录
|
|
8188
8190
|
var _useState24 = _sliced_to_array(useState(""), 2), keyWordProblem = _useState24[0], setKeyWordProblem = _useState24[1]; //历史记录搜索的内容
|
|
8189
8191
|
var _useState25 = _sliced_to_array(useState(""), 2), imgBese64 = _useState25[0], setImgBese64 = _useState25[1]; //屏幕截图
|
|
8190
8192
|
var _useState26 = _sliced_to_array(useState(""), 2), screenshotBese64 = _useState26[0], setScreenshotBese64 = _useState26[1]; //bese64图片
|
|
@@ -8202,7 +8204,8 @@ var CustomerService = function(props) {
|
|
|
8202
8204
|
var chatRoomList = useRef(null); //获取聊天室列表
|
|
8203
8205
|
var ctrl = useRef(); //停止生成ai回答时使用
|
|
8204
8206
|
var childRef = useRef(null); //获取子组件方法
|
|
8205
|
-
|
|
8207
|
+
useRef(0);
|
|
8208
|
+
var _useState33 = _sliced_to_array(useState(true), 2), isPositionState = _useState33[0], setIsPositionState = _useState33[1];
|
|
8206
8209
|
var isPosition = useRef(true);
|
|
8207
8210
|
var recommendeQuestionID = useRef([]); //推荐问题id
|
|
8208
8211
|
var videoHotQuestionsList = useRef([]); //视频热门问题
|
|
@@ -8210,6 +8213,10 @@ var CustomerService = function(props) {
|
|
|
8210
8213
|
var newShowType = useRef(false);
|
|
8211
8214
|
var mid = props.userData.mid;
|
|
8212
8215
|
var renderAiAnswerTimer = useRef(null);
|
|
8216
|
+
var historyMessageListVirtuosoRef = useRef(null);
|
|
8217
|
+
var _useState34 = _sliced_to_array(useState(0), 2), firstItemIndex = _useState34[0], setFirstItemIndex = _useState34[1];
|
|
8218
|
+
var _useState35 = _sliced_to_array(useState(null), 2), historyMessageListVirtuosoHeight = _useState35[0], setHistoryMessageListVirtuosoHeight = _useState35[1];
|
|
8219
|
+
var msgStreamingCountRef = useRef(0);
|
|
8213
8220
|
var remarkable = new Remarkable({
|
|
8214
8221
|
html: true,
|
|
8215
8222
|
highlight: function highlight(str, lang) {
|
|
@@ -8245,8 +8252,7 @@ var CustomerService = function(props) {
|
|
|
8245
8252
|
};
|
|
8246
8253
|
return newRemarkable.render(message);
|
|
8247
8254
|
};
|
|
8248
|
-
var
|
|
8249
|
-
= _sliced_to_array(useState(0), 2), screenShotType = _useState33[0], setScreenShotType = _useState33[1];
|
|
8255
|
+
var _useState36 = _sliced_to_array(useState(0), 2), screenShotType = _useState36[0], setScreenShotType = _useState36[1]; //1是 screenShotPlugin 2是html2canvas
|
|
8250
8256
|
var screenShotPlugin = useRef();
|
|
8251
8257
|
useEffect(function() {
|
|
8252
8258
|
// if(config && config.type == 'video'){
|
|
@@ -8265,8 +8271,8 @@ var CustomerService = function(props) {
|
|
|
8265
8271
|
setImgBese64("");
|
|
8266
8272
|
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
8267
8273
|
setScreenShotType(1);
|
|
8268
|
-
console.log("看看变了没有1213133");
|
|
8269
|
-
console.log("截图方式:【screenShotPlugin】", ScreenShot);
|
|
8274
|
+
// console.log("看看变了没有1213133");
|
|
8275
|
+
// console.log("截图方式:【screenShotPlugin】", ScreenShot);
|
|
8270
8276
|
screenShotPlugin.current = new ScreenShot({
|
|
8271
8277
|
clickCutFullScreen: true,
|
|
8272
8278
|
enableWebRtc: true,
|
|
@@ -8303,7 +8309,7 @@ var CustomerService = function(props) {
|
|
|
8303
8309
|
},
|
|
8304
8310
|
cancelCallback: function(err) {
|
|
8305
8311
|
if (err.code === -1 || err.code === -2) {
|
|
8306
|
-
console.log(err);
|
|
8312
|
+
// console.log(err);
|
|
8307
8313
|
newShowType.current = false;
|
|
8308
8314
|
if (saveShowType != -1) {
|
|
8309
8315
|
setShowType(saveShowType);
|
|
@@ -8319,8 +8325,9 @@ var CustomerService = function(props) {
|
|
|
8319
8325
|
});
|
|
8320
8326
|
} else {
|
|
8321
8327
|
setScreenShotType(2);
|
|
8322
|
-
console.log("截图方式:【html2canvas】");
|
|
8328
|
+
// console.log("截图方式:【html2canvas】");
|
|
8323
8329
|
html2canvas(screenshotAreaId, {
|
|
8330
|
+
//__docusaurus
|
|
8324
8331
|
useCORS: true,
|
|
8325
8332
|
allowTaint: true,
|
|
8326
8333
|
scale: 1,
|
|
@@ -8372,11 +8379,11 @@ var CustomerService = function(props) {
|
|
|
8372
8379
|
// },
|
|
8373
8380
|
// });
|
|
8374
8381
|
} catch (error) {
|
|
8375
|
-
|
|
8382
|
+
// console.log(error);
|
|
8376
8383
|
}
|
|
8377
8384
|
}
|
|
8378
8385
|
function cancelScreenshot() {
|
|
8379
|
-
console.log("cancelScreenshotcancelScreenshotcancelScreenshot");
|
|
8386
|
+
// console.log("cancelScreenshotcancelScreenshotcancelScreenshot");
|
|
8380
8387
|
newShowType.current = false;
|
|
8381
8388
|
if (saveShowType != -1) {
|
|
8382
8389
|
setShowType(saveShowType);
|
|
@@ -8390,70 +8397,79 @@ var CustomerService = function(props) {
|
|
|
8390
8397
|
}
|
|
8391
8398
|
//|| showScreenshot
|
|
8392
8399
|
if (showType == 5 || showScreenshot) {
|
|
8393
|
-
console.log("bbbbbbbbbbbbbb");
|
|
8400
|
+
// console.log("bbbbbbbbbbbbbb");
|
|
8394
8401
|
handlerHtml2canvas();
|
|
8395
8402
|
// window.addEventListener('resize',handlerHtml2canvas)
|
|
8396
8403
|
}
|
|
8397
8404
|
if (showType != 1 && !firstLoad && pageCount > 0) {
|
|
8398
8405
|
setFirstLoad(true);
|
|
8399
|
-
|
|
8400
|
-
}
|
|
8401
|
-
function handleScroll() {
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8406
|
+
// scrollToBottom();
|
|
8407
|
+
}
|
|
8408
|
+
// function handleScroll() {
|
|
8409
|
+
// const container = document.getElementById(
|
|
8410
|
+
// showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal"
|
|
8411
|
+
// );
|
|
8412
|
+
// const scrollTop = container.scrollTop;
|
|
8413
|
+
// const clientHeight = container.clientHeight;
|
|
8414
|
+
// const scrollHeight = container.scrollHeight;
|
|
8415
|
+
// // console.log(scrollTop,clientHeight,scrollHeight,'333dfkvmdfv')
|
|
8416
|
+
// if (
|
|
8417
|
+
// clientHeight + scrollTop + 0.5 >= scrollHeight &&
|
|
8418
|
+
// pageNumHistory > 1
|
|
8419
|
+
// ) {
|
|
8420
|
+
// // if (pageNumHistory > 1) {
|
|
8421
|
+
// // console.log(pageNumHistory,'pageNumpageNumpageNum')
|
|
8422
|
+
// let number = pageNumHistory - 1;
|
|
8423
|
+
// setPageNumHistory(number);
|
|
8424
|
+
// clearTimeout(listTimer.current);
|
|
8425
|
+
// listTimer.current = setTimeout(() => {
|
|
8426
|
+
// if (number > 0) {
|
|
8427
|
+
// setBottomLoading(true);
|
|
8428
|
+
// getHistoryMessage(number, 4);
|
|
8429
|
+
// setLastId("");
|
|
8430
|
+
// } else {
|
|
8431
|
+
// setPageNumHistory(0);
|
|
8432
|
+
// }
|
|
8433
|
+
// }, 1000);
|
|
8434
|
+
// // } else {
|
|
8435
|
+
// // }
|
|
8436
|
+
// }
|
|
8437
|
+
// if (scrollTop == 0 && pageCount > pageNum && pageCount > 0) {
|
|
8438
|
+
// // console.log("到顶了", pageNum);
|
|
8439
|
+
// setLoading(true);
|
|
8440
|
+
// let number = pageNum + 1;
|
|
8441
|
+
// setPageNum((pageNum) => {
|
|
8442
|
+
// return pageNum + 1;
|
|
8443
|
+
// });
|
|
8444
|
+
// listTimer.current = setTimeout(() => {
|
|
8445
|
+
// getHistoryMessage(number, 2);
|
|
8446
|
+
// }, 1000);
|
|
8447
|
+
// }
|
|
8448
|
+
// //生成答案过程中
|
|
8449
|
+
// if (!finished && scrollHeight > scrollTop) {
|
|
8450
|
+
// // console.log("生成答案过程中", scrollTopHei.current, scrollTop);
|
|
8451
|
+
// // setIsPosition(false);
|
|
8452
|
+
// isPosition.current = false;
|
|
8453
|
+
// }
|
|
8454
|
+
// if (!finished && clientHeight + scrollTop >= scrollHeight) {
|
|
8455
|
+
// // console.log("到顶了111", clientHeight, scrollTop, scrollHeight);
|
|
8456
|
+
// isPosition.current = true;
|
|
8457
|
+
// }
|
|
8458
|
+
// scrollTopHei.current = scrollTop;
|
|
8459
|
+
// }
|
|
8460
|
+
// const content = document.getElementById(
|
|
8461
|
+
// showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal"
|
|
8462
|
+
// );
|
|
8463
|
+
// if (content) {
|
|
8464
|
+
// content.addEventListener("scroll", handleScroll);
|
|
8465
|
+
// }
|
|
8452
8466
|
return function() {
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8467
|
+
// const content = document.getElementById(
|
|
8468
|
+
// showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal"
|
|
8469
|
+
// );
|
|
8470
|
+
// if (content) {
|
|
8471
|
+
// content.removeEventListener("scroll", handleScroll);
|
|
8472
|
+
// }
|
|
8457
8473
|
window.removeEventListener("resize", handlerHtml2canvas);
|
|
8458
8474
|
window.removeEventListener("resize", cancelScreenshot);
|
|
8459
8475
|
};
|
|
@@ -8463,18 +8479,41 @@ var CustomerService = function(props) {
|
|
|
8463
8479
|
pageCount,
|
|
8464
8480
|
showScreenshot
|
|
8465
8481
|
]);
|
|
8482
|
+
useEffect(function() {
|
|
8483
|
+
historyMessageListRef.current = historyMessageList;
|
|
8484
|
+
}, [
|
|
8485
|
+
historyMessageList
|
|
8486
|
+
]);
|
|
8487
|
+
useEffect(function() {
|
|
8488
|
+
lastIdRef.current = lastId;
|
|
8489
|
+
}, [
|
|
8490
|
+
lastId
|
|
8491
|
+
]);
|
|
8492
|
+
useEffect(function() {
|
|
8493
|
+
console.log("isPositionState", isPositionState, isPosition.current);
|
|
8494
|
+
}, [
|
|
8495
|
+
isPositionState
|
|
8496
|
+
]);
|
|
8466
8497
|
useEffect(function() {
|
|
8467
8498
|
resettingBottomHei();
|
|
8468
|
-
|
|
8499
|
+
var timer = setTimeout(function() {
|
|
8500
|
+
scrollToBottom();
|
|
8501
|
+
clearTimeout(timer);
|
|
8502
|
+
}, 80);
|
|
8469
8503
|
var dom = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
8470
8504
|
if (dom) {
|
|
8505
|
+
var hei = null;
|
|
8471
8506
|
if (showType == 1) {
|
|
8472
|
-
|
|
8507
|
+
hei = window.innerHeight - 60 - buttomHei;
|
|
8508
|
+
dom.style.maxHeight = "".concat(hei, "px");
|
|
8473
8509
|
} else if (showType == 3) {
|
|
8474
|
-
|
|
8510
|
+
hei = window.innerHeight - 114 - buttomHei;
|
|
8511
|
+
dom.style.maxHeight = "".concat(hei, "px");
|
|
8475
8512
|
} else {
|
|
8476
|
-
|
|
8513
|
+
hei = window.innerHeight - 160 - 62 - buttomHei;
|
|
8514
|
+
dom.style.maxHeight = "".concat(hei, "px");
|
|
8477
8515
|
}
|
|
8516
|
+
setHistoryMessageListVirtuosoHeight(hei);
|
|
8478
8517
|
}
|
|
8479
8518
|
}, [
|
|
8480
8519
|
buttomHei,
|
|
@@ -8606,17 +8645,17 @@ var CustomerService = function(props) {
|
|
|
8606
8645
|
// watchTime= 753
|
|
8607
8646
|
if (videoId && courseId && sectionId) {
|
|
8608
8647
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
|
|
8609
|
-
|
|
8610
|
-
|
|
8648
|
+
recommendedQuestions: [],
|
|
8649
|
+
contexts: [
|
|
8611
8650
|
{
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8651
|
+
type: "VIDEO",
|
|
8652
|
+
courseId: courseId,
|
|
8653
|
+
sectionId: sectionId,
|
|
8654
|
+
videoId: videoId,
|
|
8655
|
+
watchTime: watchTime
|
|
8617
8656
|
}
|
|
8618
8657
|
],
|
|
8619
|
-
|
|
8658
|
+
maximum: 3
|
|
8620
8659
|
}).then(function(res) {
|
|
8621
8660
|
try {
|
|
8622
8661
|
var data = res.data.questions;
|
|
@@ -8642,18 +8681,18 @@ var CustomerService = function(props) {
|
|
|
8642
8681
|
recommendeQuestionID.current = data.map(function(item) {
|
|
8643
8682
|
return item.id;
|
|
8644
8683
|
});
|
|
8645
|
-
|
|
8684
|
+
// console.log(recommendeQuestionID.current, 4444444);
|
|
8646
8685
|
}
|
|
8647
|
-
console.log("dflkvmdfklvdf欢迎语", data);
|
|
8686
|
+
// console.log("dflkvmdfklvdf欢迎语", data);
|
|
8648
8687
|
var obj = {
|
|
8649
8688
|
roomId: roomId,
|
|
8650
8689
|
sender: "AI",
|
|
8651
8690
|
recevier: mid,
|
|
8652
|
-
message: "Hi,我是智能学习助手,你遇到了什么问题?",
|
|
8691
|
+
message: "Hi,我是智能学习助手,你遇到了什么问题?1",
|
|
8653
8692
|
extraInfos: questionsList == null ? null : questionsList
|
|
8654
8693
|
};
|
|
8655
8694
|
if (pageNumHistory <= 1) {
|
|
8656
|
-
console.log("欢迎语");
|
|
8695
|
+
// console.log("欢迎语");
|
|
8657
8696
|
setHistoryMessageList(function(historyMessageList) {
|
|
8658
8697
|
var newHistoryMessageList = historyMessageList.filter(function(e) {
|
|
8659
8698
|
return e.id != "123456_date";
|
|
@@ -8714,6 +8753,7 @@ var CustomerService = function(props) {
|
|
|
8714
8753
|
maxPageSize: 5
|
|
8715
8754
|
}
|
|
8716
8755
|
}).then(function(res) {
|
|
8756
|
+
finishedRef.current = true;
|
|
8717
8757
|
setFinished(true);
|
|
8718
8758
|
if (res.data.total > 0) {
|
|
8719
8759
|
var questionsList = res.data.questions.map(function(item) {
|
|
@@ -8946,7 +8986,6 @@ var CustomerService = function(props) {
|
|
|
8946
8986
|
switch(_state.label){
|
|
8947
8987
|
case 0:
|
|
8948
8988
|
type = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : "";
|
|
8949
|
-
console.log(item, flag, 888888888);
|
|
8950
8989
|
questions = [];
|
|
8951
8990
|
if (item && flag) {
|
|
8952
8991
|
questions = [
|
|
@@ -8987,13 +9026,13 @@ var CustomerService = function(props) {
|
|
|
8987
9026
|
return newHistoryMessageList;
|
|
8988
9027
|
});
|
|
8989
9028
|
}
|
|
9029
|
+
finishedRef.current = false;
|
|
8990
9030
|
setFinished(false);
|
|
8991
9031
|
aiSendQuestions(3, sendData, 1);
|
|
8992
9032
|
return [
|
|
8993
9033
|
2
|
|
8994
9034
|
];
|
|
8995
9035
|
}
|
|
8996
|
-
console.log(questions, "知识库内容11111");
|
|
8997
9036
|
obj = {
|
|
8998
9037
|
roomId: roomId,
|
|
8999
9038
|
sender: mid,
|
|
@@ -9026,7 +9065,6 @@ var CustomerService = function(props) {
|
|
|
9026
9065
|
3,
|
|
9027
9066
|
4
|
|
9028
9067
|
];
|
|
9029
|
-
console.log("citationContent", citationContent);
|
|
9030
9068
|
sendData1 = {
|
|
9031
9069
|
//相关数据
|
|
9032
9070
|
roomId: roomId,
|
|
@@ -9046,14 +9084,14 @@ var CustomerService = function(props) {
|
|
|
9046
9084
|
];
|
|
9047
9085
|
case 2:
|
|
9048
9086
|
base64 = _state.sent();
|
|
9049
|
-
console.log("base64", base64);
|
|
9050
|
-
console.log("citationContent.imageUrl", citationContent.imageUrl);
|
|
9087
|
+
// console.log("base64", base64);
|
|
9088
|
+
// console.log("citationContent.imageUrl", citationContent.imageUrl);
|
|
9051
9089
|
sendData1.image = base64;
|
|
9052
9090
|
imageUrl = base64;
|
|
9053
9091
|
_state.label = 3;
|
|
9054
9092
|
case 3:
|
|
9055
9093
|
if (screenshotBese64) {
|
|
9056
|
-
console.log("screenshotBese64", screenshotBese64);
|
|
9094
|
+
// console.log("screenshotBese64", screenshotBese64);
|
|
9057
9095
|
sendData1.image = screenshotBese64;
|
|
9058
9096
|
imageUrl = screenshotBese64;
|
|
9059
9097
|
}
|
|
@@ -9079,6 +9117,7 @@ var CustomerService = function(props) {
|
|
|
9079
9117
|
return newHistoryMessageList;
|
|
9080
9118
|
});
|
|
9081
9119
|
}
|
|
9120
|
+
finishedRef.current = false;
|
|
9082
9121
|
setFinished(false);
|
|
9083
9122
|
aiSendQuestions(3, sendData1, 1);
|
|
9084
9123
|
setScreenshotBese64("");
|
|
@@ -9116,7 +9155,7 @@ var CustomerService = function(props) {
|
|
|
9116
9155
|
});
|
|
9117
9156
|
scrollToBottom();
|
|
9118
9157
|
}
|
|
9119
|
-
console.log(type, "接受答案77777");
|
|
9158
|
+
// console.log(type, "接受答案77777");
|
|
9120
9159
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/history-messages"), obj).then(function(res) {
|
|
9121
9160
|
if (res.data.id) {
|
|
9122
9161
|
if (pageNumHistory <= 1) {
|
|
@@ -9170,6 +9209,7 @@ var CustomerService = function(props) {
|
|
|
9170
9209
|
return item.id != "123456";
|
|
9171
9210
|
});
|
|
9172
9211
|
});
|
|
9212
|
+
finishedRef.current = true;
|
|
9173
9213
|
setFinished(true);
|
|
9174
9214
|
ctrl.current.abort();
|
|
9175
9215
|
setHistoryMessageList(function(historyMessageList) {
|
|
@@ -9184,7 +9224,11 @@ var CustomerService = function(props) {
|
|
|
9184
9224
|
});
|
|
9185
9225
|
});
|
|
9186
9226
|
}, 60 * 1000);
|
|
9227
|
+
finishedRef.current = false;
|
|
9187
9228
|
setFinished(false);
|
|
9229
|
+
isPosition.current = true;
|
|
9230
|
+
setIsPositionState(true);
|
|
9231
|
+
msgStreamingCountRef.current = 0;
|
|
9188
9232
|
if (config && config.type == "video" && config.params) {
|
|
9189
9233
|
var params = config.params;
|
|
9190
9234
|
var videoId = params.videoId;
|
|
@@ -9268,7 +9312,8 @@ var CustomerService = function(props) {
|
|
|
9268
9312
|
console.info("eventSource open: ", res);
|
|
9269
9313
|
clearTimeout(receiveMessageTimer.current);
|
|
9270
9314
|
if (res.status >= 300) {
|
|
9271
|
-
console.log("sdckjsdncskdcjsdc", res.status);
|
|
9315
|
+
// console.log("sdckjsdncskdcjsdc", res.status);
|
|
9316
|
+
finishedRef.current = true;
|
|
9272
9317
|
setFinished(true);
|
|
9273
9318
|
setHistoryMessageList(function(historyMessageList) {
|
|
9274
9319
|
return historyMessageList.filter(function(item) {
|
|
@@ -9278,12 +9323,13 @@ var CustomerService = function(props) {
|
|
|
9278
9323
|
ctrl.current.abort();
|
|
9279
9324
|
}
|
|
9280
9325
|
if (res.status == 200) {
|
|
9326
|
+
finishedRef.current = true;
|
|
9281
9327
|
setFinished(false);
|
|
9282
9328
|
}
|
|
9283
9329
|
if (res.status == 401) {
|
|
9284
9330
|
//身份认证未通过,从新请求新的token后再次发送请求
|
|
9285
9331
|
verifyJWT(urllocation).then(function() {
|
|
9286
|
-
console.log("重新请求");
|
|
9332
|
+
// console.log("重新请求");
|
|
9287
9333
|
setHistoryMessageList(function(historyMessageList) {
|
|
9288
9334
|
return historyMessageList.filter(function(item) {
|
|
9289
9335
|
return item.id != "123456" && item.id != "654321";
|
|
@@ -9294,7 +9340,7 @@ var CustomerService = function(props) {
|
|
|
9294
9340
|
}
|
|
9295
9341
|
if (res.status == 403) {
|
|
9296
9342
|
//暂无权限
|
|
9297
|
-
console.log("暂无权限");
|
|
9343
|
+
// console.log("暂无权限");
|
|
9298
9344
|
setHistoryMessageList(function(historyMessageList) {
|
|
9299
9345
|
return historyMessageList.concat({
|
|
9300
9346
|
roomId: roomId,
|
|
@@ -9333,7 +9379,7 @@ var CustomerService = function(props) {
|
|
|
9333
9379
|
})();
|
|
9334
9380
|
},
|
|
9335
9381
|
onerror: function(err) {
|
|
9336
|
-
console.log(err, "dflkvdmfvlkdfv");
|
|
9382
|
+
// console.log(err, "dflkvdmfvlkdfv");
|
|
9337
9383
|
err.response;
|
|
9338
9384
|
setHistoryMessageList(function(historyMessageList) {
|
|
9339
9385
|
return historyMessageList.concat({
|
|
@@ -9352,39 +9398,26 @@ var CustomerService = function(props) {
|
|
|
9352
9398
|
// console.log("eventSource msg: ", event.data);
|
|
9353
9399
|
var msg = JSON.parse(event.data);
|
|
9354
9400
|
if (msg.message) ;
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
});
|
|
9401
|
+
finishedRef.current = false;
|
|
9402
|
+
setFinished(false);
|
|
9403
|
+
msgStreamingCountRef.current = msgStreamingCountRef.current + 1;
|
|
9359
9404
|
console.log("返回中", msg);
|
|
9360
9405
|
content = content + msg.message;
|
|
9361
|
-
// isPosition.current = true;
|
|
9362
|
-
// clearTimeout(renderAiAnswerTimer.current)
|
|
9363
9406
|
renderAiAnswerTimer.current = setTimeout(function() {
|
|
9364
9407
|
if (!finishedRef.current) {
|
|
9365
9408
|
renderAiAnswer(msg, id, type);
|
|
9366
9409
|
}
|
|
9367
|
-
},
|
|
9410
|
+
}, 1 * msgStreamingCountRef.current);
|
|
9368
9411
|
if (msg.finished) {
|
|
9369
9412
|
// console.log('返回完成',msg)
|
|
9370
|
-
// setFinished(true); //发送结束
|
|
9371
9413
|
if (!flagKeyWord) {
|
|
9372
9414
|
videoPageQuestiionsList(2);
|
|
9373
9415
|
}
|
|
9374
|
-
// isPosition.current = true;
|
|
9375
|
-
// setTimeout(()=>{
|
|
9376
|
-
// isPosition.current = true;
|
|
9377
|
-
// },100)
|
|
9378
9416
|
testLabQuestion(JSON.parse(data).message, content, "");
|
|
9379
9417
|
}
|
|
9380
9418
|
},
|
|
9381
9419
|
onclose: function() {
|
|
9382
9420
|
console.log("eventSource close");
|
|
9383
|
-
// setFinished(true); //发送结束
|
|
9384
|
-
// // isPosition.current = true;
|
|
9385
|
-
// setTimeout(()=>{
|
|
9386
|
-
// isPosition.current = true;
|
|
9387
|
-
// },100)
|
|
9388
9421
|
setHistoryMessageList(function(historyMessageList) {
|
|
9389
9422
|
return historyMessageList.filter(function(item) {
|
|
9390
9423
|
return item.id != "123456";
|
|
@@ -9416,7 +9449,6 @@ var CustomerService = function(props) {
|
|
|
9416
9449
|
var list = prevHistoryMessageList.filter(function(item) {
|
|
9417
9450
|
return item.id == id;
|
|
9418
9451
|
});
|
|
9419
|
-
// console.log('renderAiAnswer',{list1,list})
|
|
9420
9452
|
var message = "";
|
|
9421
9453
|
if (list.length == 0) {
|
|
9422
9454
|
message = obj.message;
|
|
@@ -9466,25 +9498,13 @@ var CustomerService = function(props) {
|
|
|
9466
9498
|
}
|
|
9467
9499
|
});
|
|
9468
9500
|
console.log("isPosition", isPosition.current);
|
|
9469
|
-
|
|
9470
|
-
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
9471
|
-
if (container) {
|
|
9472
|
-
container.scrollTop = container.scrollHeight;
|
|
9473
|
-
}
|
|
9474
|
-
}
|
|
9501
|
+
scrollToBottom();
|
|
9475
9502
|
if (msg.finished) {
|
|
9476
|
-
console.log("返回完成", msg);
|
|
9503
|
+
console.log("返回完成", msg, msgStreamingCountRef.current);
|
|
9477
9504
|
//发送结束
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
return finishedRef.current;
|
|
9481
|
-
});
|
|
9505
|
+
finishedRef.current = true;
|
|
9506
|
+
setFinished(true);
|
|
9482
9507
|
}
|
|
9483
|
-
// console.log('historyMessageList',historyMessageList)
|
|
9484
|
-
// if(isPosition.current){
|
|
9485
|
-
// console.log('mmmmmmmmmmmmm打印一下',)
|
|
9486
|
-
// scrollToBottom();
|
|
9487
|
-
// }
|
|
9488
9508
|
};
|
|
9489
9509
|
//问题记录到实验报告中
|
|
9490
9510
|
var testLabQuestion = function(title, content, teachId) {
|
|
@@ -9497,7 +9517,7 @@ var CustomerService = function(props) {
|
|
|
9497
9517
|
stepId: stepId,
|
|
9498
9518
|
stepIds: stepIds
|
|
9499
9519
|
}).then(function() {
|
|
9500
|
-
console.log(roomId, chatObj, "roomIdroomIdroomIdroomId");
|
|
9520
|
+
// console.log(roomId, chatObj, "roomIdroomIdroomIdroomId");
|
|
9501
9521
|
setChatObj(function(list1) {
|
|
9502
9522
|
var list = list1.filter(function(e) {
|
|
9503
9523
|
return e.roomId != roomId;
|
|
@@ -9537,7 +9557,7 @@ var CustomerService = function(props) {
|
|
|
9537
9557
|
params: {
|
|
9538
9558
|
roomId: rid,
|
|
9539
9559
|
page: page,
|
|
9540
|
-
maxPageSize:
|
|
9560
|
+
maxPageSize: 30,
|
|
9541
9561
|
direction: "desc"
|
|
9542
9562
|
}
|
|
9543
9563
|
}).then(function(res) {
|
|
@@ -9546,7 +9566,7 @@ var CustomerService = function(props) {
|
|
|
9546
9566
|
if (res.data.messages.length > 0) {
|
|
9547
9567
|
clearTimeout(listTimer.current);
|
|
9548
9568
|
var total = res.data.total;
|
|
9549
|
-
var maxPageSize =
|
|
9569
|
+
var maxPageSize = 30;
|
|
9550
9570
|
var dataList = res.data.messages.reverse();
|
|
9551
9571
|
//历史记录点击进来的,多加载一页,防止定位不准
|
|
9552
9572
|
if (flag == 1 && page > 1) {
|
|
@@ -9556,6 +9576,7 @@ var CustomerService = function(props) {
|
|
|
9556
9576
|
return;
|
|
9557
9577
|
}
|
|
9558
9578
|
setPageCount(Math.ceil(total / maxPageSize));
|
|
9579
|
+
setFirstItemIndex(total - maxPageSize * (page - 1));
|
|
9559
9580
|
var newHistoryMessageList = [];
|
|
9560
9581
|
setHistoryMessageList(function(historyMessageList) {
|
|
9561
9582
|
//获取历史消息 flag:1,历史记录点击定位,2,代表是下拉加载,3,存在新的消息-->老师回答等
|
|
@@ -9601,7 +9622,7 @@ var CustomerService = function(props) {
|
|
|
9601
9622
|
scrollToBottom();
|
|
9602
9623
|
}, 1000);
|
|
9603
9624
|
} else {
|
|
9604
|
-
scrollTo(
|
|
9625
|
+
scrollTo(lastIdRef.current);
|
|
9605
9626
|
}
|
|
9606
9627
|
}
|
|
9607
9628
|
setBottomLoading(false);
|
|
@@ -9652,7 +9673,7 @@ var CustomerService = function(props) {
|
|
|
9652
9673
|
params: {
|
|
9653
9674
|
roomId: rid,
|
|
9654
9675
|
page: 1,
|
|
9655
|
-
maxPageSize: totalNumber == 0 ?
|
|
9676
|
+
maxPageSize: totalNumber == 0 ? 30 : totalNumber,
|
|
9656
9677
|
direction: "desc"
|
|
9657
9678
|
}
|
|
9658
9679
|
}).then(function(res) {
|
|
@@ -9673,7 +9694,7 @@ var CustomerService = function(props) {
|
|
|
9673
9694
|
return newHistoryMessageList;
|
|
9674
9695
|
});
|
|
9675
9696
|
// console.log(dataList.length , originList,lastId,'dfkvdnfkvdfj44444');
|
|
9676
|
-
if (!
|
|
9697
|
+
if (!lastIdRef.current && originList != newList) {
|
|
9677
9698
|
scrollToBottom();
|
|
9678
9699
|
readMessage(roomId, urllocation, userData, http);
|
|
9679
9700
|
}
|
|
@@ -9704,7 +9725,7 @@ var CustomerService = function(props) {
|
|
|
9704
9725
|
if (room.length > 0) {
|
|
9705
9726
|
// console.log(room,'dfvdfvdfvdfv')
|
|
9706
9727
|
var chatID = room[0].id;
|
|
9707
|
-
console.log(chatID, "chatIDchatIDchatID");
|
|
9728
|
+
// console.log(chatID, "chatIDchatIDchatID");
|
|
9708
9729
|
var index = -1;
|
|
9709
9730
|
newHistoryMessageList.forEach(function(item, i) {
|
|
9710
9731
|
// console.log(item,item.id,'lskdcmsldksdcsdc')
|
|
@@ -9716,7 +9737,7 @@ var CustomerService = function(props) {
|
|
|
9716
9737
|
//有新的消息
|
|
9717
9738
|
if (index != -1) {
|
|
9718
9739
|
var newMessage = newHistoryMessageList.slice(index);
|
|
9719
|
-
console.log(newMessage, "newMessagenewMessage");
|
|
9740
|
+
// console.log(newMessage, "newMessagenewMessage");
|
|
9720
9741
|
var result = [];
|
|
9721
9742
|
newMessage.forEach(function(item, index) {
|
|
9722
9743
|
var isQuestion = item.receiver !== mid; //是否为问题
|
|
@@ -9732,7 +9753,7 @@ var CustomerService = function(props) {
|
|
|
9732
9753
|
}
|
|
9733
9754
|
}
|
|
9734
9755
|
});
|
|
9735
|
-
console.log(result, "存储的消息");
|
|
9756
|
+
// console.log(result, "存储的消息");
|
|
9736
9757
|
result.map(function(item) {
|
|
9737
9758
|
testLabQuestion(item.question, item.answer, String(item.id));
|
|
9738
9759
|
});
|
|
@@ -9832,7 +9853,7 @@ var CustomerService = function(props) {
|
|
|
9832
9853
|
setQuestionsList(questionList);
|
|
9833
9854
|
}
|
|
9834
9855
|
if (questionList.length < 4 && flag == 3) {
|
|
9835
|
-
console.log("视频页面,联想问题小于4个");
|
|
9856
|
+
// console.log("视频页面,联想问题小于4个");
|
|
9836
9857
|
//视频页面,联想问题小于4个
|
|
9837
9858
|
http.get("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions"), {
|
|
9838
9859
|
params: {
|
|
@@ -9861,7 +9882,7 @@ var CustomerService = function(props) {
|
|
|
9861
9882
|
//获取视频页面热门问题 flag == 1,默认推荐问题 == 2,底部渲染问题,flag == 3,ai回答后请求相关问题
|
|
9862
9883
|
var videoPageQuestiionsList = function() {
|
|
9863
9884
|
var flag = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
9864
|
-
console.log(flag, props, 3333333);
|
|
9885
|
+
// console.log(flag, props, 3333333);
|
|
9865
9886
|
if (config && config.type == "video" && config.params) {
|
|
9866
9887
|
var params = config.params;
|
|
9867
9888
|
var videoId = params.videoId;
|
|
@@ -9873,19 +9894,22 @@ var CustomerService = function(props) {
|
|
|
9873
9894
|
// videoId= "71399",
|
|
9874
9895
|
// watchTime= 527
|
|
9875
9896
|
if (videoId && courseId && sectionId) {
|
|
9876
|
-
console.log(
|
|
9897
|
+
// console.log(
|
|
9898
|
+
// recommendeQuestionID.current,
|
|
9899
|
+
// "recommendeQuestionID.current"
|
|
9900
|
+
// );
|
|
9877
9901
|
http.post("".concat(urllocation, "/chat-service/public/v1.0/knowledge-base/questions:recommend"), {
|
|
9878
|
-
|
|
9879
|
-
|
|
9902
|
+
recommendedQuestions: recommendeQuestionID.current,
|
|
9903
|
+
contexts: [
|
|
9880
9904
|
{
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9905
|
+
type: "VIDEO",
|
|
9906
|
+
courseId: courseId,
|
|
9907
|
+
sectionId: sectionId,
|
|
9908
|
+
videoId: videoId,
|
|
9909
|
+
watchTime: watchTime
|
|
9886
9910
|
}
|
|
9887
9911
|
],
|
|
9888
|
-
|
|
9912
|
+
maximum: flag == 1 || flag == 2 ? 3 : 5
|
|
9889
9913
|
}).then(function(res) {
|
|
9890
9914
|
if (res.data.total > 0) {
|
|
9891
9915
|
var data = res.data.questions;
|
|
@@ -9999,32 +10023,33 @@ var CustomerService = function(props) {
|
|
|
9999
10023
|
};
|
|
10000
10024
|
//设置滚动条滚动到底部
|
|
10001
10025
|
var scrollToBottom = function() {
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
}
|
|
10010
|
-
}
|
|
10026
|
+
if (!historyMessageListVirtuosoRef.current || !isPosition.current) {
|
|
10027
|
+
return;
|
|
10028
|
+
} else {
|
|
10029
|
+
historyMessageListVirtuosoRef.current.scrollToIndex({
|
|
10030
|
+
index: "LAST",
|
|
10031
|
+
align: "end",
|
|
10032
|
+
behavior: "auto"
|
|
10033
|
+
});
|
|
10034
|
+
}
|
|
10011
10035
|
};
|
|
10012
10036
|
//滚动到指定位置
|
|
10013
10037
|
var scrollTo = function(id) {
|
|
10014
|
-
var
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
}
|
|
10025
|
-
}
|
|
10038
|
+
var timer = setTimeout(function() {
|
|
10039
|
+
var index = historyMessageListRef.current.findIndex(function(x) {
|
|
10040
|
+
return x.id === id;
|
|
10041
|
+
});
|
|
10042
|
+
// console.log("scrollTo", id, index, historyMessageListRef.current);
|
|
10043
|
+
if (index > -1) {
|
|
10044
|
+
historyMessageListVirtuosoRef.current.scrollToIndex({
|
|
10045
|
+
index: index,
|
|
10046
|
+
align: "start",
|
|
10047
|
+
behavior: "auto"
|
|
10048
|
+
});
|
|
10049
|
+
}
|
|
10026
10050
|
setLoading(false);
|
|
10027
|
-
|
|
10051
|
+
clearTimeout(timer);
|
|
10052
|
+
}, 10);
|
|
10028
10053
|
};
|
|
10029
10054
|
//重置底部输入框高度
|
|
10030
10055
|
var resettingBottomHei = function() {
|
|
@@ -10248,6 +10273,7 @@ var CustomerService = function(props) {
|
|
|
10248
10273
|
if (ctrl && ctrl.current) {
|
|
10249
10274
|
ctrl.current.abort();
|
|
10250
10275
|
}
|
|
10276
|
+
finishedRef.current = true;
|
|
10251
10277
|
setFinished(true);
|
|
10252
10278
|
} catch (error) {}
|
|
10253
10279
|
setTimeout(function() {
|
|
@@ -10276,161 +10302,412 @@ var CustomerService = function(props) {
|
|
|
10276
10302
|
};
|
|
10277
10303
|
//渲染问答
|
|
10278
10304
|
var renderQuestion = function() {
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10305
|
+
function itemContent(index, item) {
|
|
10306
|
+
var _historyMessageList_findIndex;
|
|
10307
|
+
var i = (_historyMessageList_findIndex = historyMessageList.findIndex(function(x) {
|
|
10308
|
+
return x.id == item.id;
|
|
10309
|
+
})) !== null && _historyMessageList_findIndex !== void 0 ? _historyMessageList_findIndex : index;
|
|
10310
|
+
var timeObj = parseDate(item.createdAt);
|
|
10311
|
+
// console.log(item.message);
|
|
10312
|
+
var message = item.message;
|
|
10313
|
+
var li;
|
|
10314
|
+
// 是否需要显示日期
|
|
10315
|
+
var itemIndex = historyMessageList.findIndex(function(ite) {
|
|
10316
|
+
return ite.id === item.id;
|
|
10317
|
+
});
|
|
10318
|
+
var time = "";
|
|
10319
|
+
if (historyMessageList.length > 1) {
|
|
10320
|
+
if (itemIndex <= 0) {
|
|
10321
|
+
//第一项
|
|
10322
|
+
time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
10323
|
+
} else {
|
|
10324
|
+
//非第一项 与上一项进行对比
|
|
10325
|
+
var beforeTime = historyMessageList[itemIndex - 1].createdAt;
|
|
10326
|
+
//判断与上一条数据 是否跨天
|
|
10327
|
+
var beforeTimeObj = parseDate(beforeTime);
|
|
10328
|
+
var beforeTimeStr = "".concat(beforeTimeObj.year, "-").concat(beforeTimeObj.month, "-").concat(beforeTimeObj.day);
|
|
10329
|
+
var curTimeStr = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day);
|
|
10330
|
+
if (beforeTimeStr !== curTimeStr) {
|
|
10295
10331
|
time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
10296
10332
|
} else {
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
var beforeTimeObj = parseDate(beforeTime);
|
|
10301
|
-
var beforeTimeStr = "".concat(beforeTimeObj.year, "-").concat(beforeTimeObj.month, "-").concat(beforeTimeObj.day);
|
|
10302
|
-
var curTimeStr = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day);
|
|
10303
|
-
if (beforeTimeStr !== curTimeStr) {
|
|
10304
|
-
time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
10305
|
-
} else {
|
|
10306
|
-
//没有跨天 判断是否相隔超过10分钟
|
|
10307
|
-
if (new Date(item.createdAt).valueOf() - new Date(beforeTime).valueOf() > 10 * 60 * 1000) {
|
|
10308
|
-
time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
10309
|
-
}
|
|
10333
|
+
//没有跨天 判断是否相隔超过10分钟
|
|
10334
|
+
if (new Date(item.createdAt).valueOf() - new Date(beforeTime).valueOf() > 10 * 60 * 1000) {
|
|
10335
|
+
time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
|
|
10310
10336
|
}
|
|
10311
10337
|
}
|
|
10312
10338
|
}
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10339
|
+
}
|
|
10340
|
+
var dataTime = time;
|
|
10341
|
+
// let code = message.split("```");
|
|
10342
|
+
// code = code[1];
|
|
10343
|
+
// console.log(code,888888888);
|
|
10344
|
+
if (lastId == item.id && keyWordProblem != "") {
|
|
10345
|
+
//点击历史记录时,找到关键字,防止关键字和标签名重复
|
|
10346
|
+
// let key_sign = 'sign_'+new Date().getTime();+'sign';
|
|
10347
|
+
// message = message.replaceAll(keyWordProblem, (e:any) => {
|
|
10348
|
+
// return key_sign;
|
|
10349
|
+
// });
|
|
10350
|
+
// message = remarkable.render(message);
|
|
10351
|
+
// message = message.replaceAll(key_sign, (e:any) => {
|
|
10352
|
+
// return `<span class=${styles.sign}>${keyWordProblem}</span>`;
|
|
10353
|
+
// });
|
|
10354
|
+
message = remarkReplaceKey(message, keyWordProblem);
|
|
10355
|
+
} else {
|
|
10356
|
+
message = remarkable.render(message);
|
|
10357
|
+
}
|
|
10358
|
+
var position = 0;
|
|
10359
|
+
message = message.replaceAll(new RegExp("<pre", "ig"), function(i, index) {
|
|
10360
|
+
position++;
|
|
10361
|
+
var text = "<p class='".concat(styles.copyCode, " copyCodeFun' data-id=").concat(item.id, " data-position=").concat(position, ">\n <span class='").concat(styles.icon, ' copy\' >\n <svg\n width="1em"\n height="1em"\n viewBox="0 0 14 14"\n shape-rendering="geometricPrecision"\n fill="currentColor"\n xmlns="http://www.w3.org/2000/svg"\n >\n <g clip-path="url(#clip0_518_8403)">\n <path\n d="M6.16666 1.66666H13.1667C13.4761 1.66666 13.7728 1.78957 13.9916 2.00837C14.2104 2.22716 14.3333 2.5239 14.3333 2.83332V9.83332C14.3333 10.1427 14.2104 10.4395 13.9916 10.6583C13.7728 10.8771 13.4761 11 13.1667 11H6.16666C5.85724 11 5.5605 10.8771 5.34171 10.6583C5.12291 10.4395 5 10.1427 5 9.83332V2.83332C5 2.5239 5.12291 2.22716 5.34171 2.00837C5.5605 1.78957 5.85724 1.66666 6.16666 1.66666ZM6.16666 2.66666C6.12246 2.66666 6.08007 2.68422 6.04881 2.71547C6.01756 2.74673 6 2.78912 6 2.83332V9.83332C6 9.85521 6.00431 9.87688 6.01268 9.8971C6.02106 9.91732 6.03334 9.9357 6.04881 9.95117C6.06429 9.96665 6.08266 9.97893 6.10288 9.9873C6.1231 9.99568 6.14478 9.99999 6.16666 9.99999H13.1667C13.2109 9.99999 13.2533 9.98243 13.2845 9.95117C13.3158 9.91992 13.3333 9.87753 13.3333 9.83332V2.83332C13.3333 2.78912 13.3158 2.74673 13.2845 2.71547C13.2533 2.68422 13.2109 2.66666 13.1667 2.66666H6.16666ZM10 12C10 11.8674 10.0527 11.7402 10.1464 11.6464C10.2402 11.5527 10.3674 11.5 10.5 11.5C10.6326 11.5 10.7598 11.5527 10.8536 11.6464C10.9473 11.7402 11 11.8674 11 12V13.1667C11 13.4761 10.8771 13.7728 10.6583 13.9916C10.4395 14.2104 10.1427 14.3333 9.83333 14.3333H2.83333C2.52391 14.3333 2.22717 14.2104 2.00837 13.9916C1.78958 13.7728 1.66666 13.4761 1.66666 13.1667V6.16666C1.66666 5.85724 1.78958 5.56049 2.00837 5.3417C2.22717 5.12291 2.52391 4.99999 2.83333 4.99999H4C4.13261 4.99999 4.25978 5.05267 4.35355 5.14644C4.44732 5.2402 4.5 5.36738 4.5 5.49999C4.5 5.6326 4.44732 5.75978 4.35355 5.85354C4.25978 5.94731 4.13261 5.99999 4 5.99999H2.83333C2.78913 5.99999 2.74674 6.01755 2.71548 6.04881C2.68422 6.08006 2.66666 6.12245 2.66666 6.16666V13.1667C2.66666 13.2109 2.68422 13.2533 2.71548 13.2845C2.74674 13.3158 2.78913 13.3333 2.83333 13.3333H9.83333C9.87753 13.3333 9.91993 13.3158 9.95118 13.2845C9.98244 13.2533 10 13.2109 10 13.1667V12Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_518_8403">\n <rect width="16" height="16" />\n </clipPath>\n </defs>\n </svg>\n </span>\n <span class=\'').concat(styles.icon, ' copy_success_flag\'>\n <svg\n width="1em"\n height="1em"\n shape-rendering="geometricPrecision"\n fill="currentColor"\n viewBox="0 0 12 7"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path d="M11.2242 0.375687C11.4586 0.610002 11.4586 0.989901 11.2242 1.22422L4.82424 7.62422C4.58992 7.85853 4.21003 7.85853 3.97571 7.62422L0.775712 4.42422C0.541397 4.1899 0.541397 3.81 0.775712 3.57569C1.01003 3.34137 1.38993 3.34137 1.62424 3.57569L4.39998 6.35142L10.3757 0.375687C10.61 0.141373 10.9899 0.141373 11.2242 0.375687Z" />\n </svg>\n </span><span class="copyCode">复制代码</span></p><pre');
|
|
10362
|
+
return text;
|
|
10363
|
+
});
|
|
10364
|
+
if (item.sender == mid) {
|
|
10365
|
+
//只有引用和复制功能
|
|
10366
|
+
li = /*#__PURE__*/ jsxs(Fragment, {
|
|
10367
|
+
children: [
|
|
10368
|
+
dataTime ? /*#__PURE__*/ jsx("li", {
|
|
10369
|
+
className: "".concat(styles.itemcontent, " ").concat(styles.time),
|
|
10370
|
+
children: dataTime
|
|
10371
|
+
}) : "",
|
|
10372
|
+
/*#__PURE__*/ jsxs("li", {
|
|
10373
|
+
className: "".concat(styles.itemcontent, " ").concat(styles.left),
|
|
10374
|
+
id: lastId == item.id ? "li_flag" : "",
|
|
10375
|
+
children: [
|
|
10376
|
+
/*#__PURE__*/ jsx("div", {
|
|
10377
|
+
className: styles.main,
|
|
10378
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
10379
|
+
className: styles.main_content,
|
|
10380
|
+
children: [
|
|
10381
|
+
/*#__PURE__*/ jsxs("div", {
|
|
10382
|
+
className: styles.main_content_flag,
|
|
10383
|
+
children: [
|
|
10384
|
+
/*#__PURE__*/ jsx("div", {
|
|
10385
|
+
className: styles.operate_modal,
|
|
10386
|
+
children: /*#__PURE__*/ jsxs("p", {
|
|
10387
|
+
className: styles.operate,
|
|
10388
|
+
children: [
|
|
10389
|
+
/*#__PURE__*/ jsx("i", {
|
|
10390
|
+
className: "yinyong_quote1",
|
|
10391
|
+
onClick: function() {
|
|
10392
|
+
setCitationContent({
|
|
10393
|
+
content: item.message,
|
|
10394
|
+
id: item.id,
|
|
10395
|
+
imageUrl: !item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" ? JSON.parse(item.extraInfo)[0].value : ""
|
|
10396
|
+
});
|
|
10397
|
+
resettingBottomHei();
|
|
10398
|
+
onEvent(serverName + serverUrl(), "click_智能问答_引用", "提交");
|
|
10399
|
+
},
|
|
10400
|
+
children: /*#__PURE__*/ jsx(CustomQuote$1, {})
|
|
10401
|
+
}),
|
|
10402
|
+
copyTextOBJ.length > 0 && copyTextOBJ.some(function(list) {
|
|
10403
|
+
return list == item.id;
|
|
10404
|
+
}) ? /*#__PURE__*/ jsx("i", {
|
|
10405
|
+
className: "tongyong-xuanzhongdui",
|
|
10406
|
+
children: /*#__PURE__*/ jsx(CustomDuihao$1, {})
|
|
10407
|
+
}) : /*#__PURE__*/ jsx("i", {
|
|
10408
|
+
className: "fuzhi21",
|
|
10409
|
+
onClick: function() {
|
|
10410
|
+
copyText(item.message);
|
|
10411
|
+
{
|
|
10412
|
+
var obj = copyTextOBJ;
|
|
10413
|
+
obj = obj.filter(function(list) {
|
|
10414
|
+
return list != item.id;
|
|
10369
10415
|
});
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
}
|
|
10373
|
-
|
|
10416
|
+
obj.push(item.id);
|
|
10417
|
+
setCopyTextObj(obj);
|
|
10418
|
+
}
|
|
10419
|
+
setTimeout(function() {
|
|
10420
|
+
var obj = copyTextOBJ;
|
|
10421
|
+
obj = obj.filter(function(list) {
|
|
10422
|
+
return list != item.id;
|
|
10423
|
+
});
|
|
10424
|
+
setCopyTextObj(obj);
|
|
10425
|
+
}, 3000);
|
|
10426
|
+
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
10427
|
+
},
|
|
10428
|
+
children: /*#__PURE__*/ jsx(CustomCopy$1, {})
|
|
10429
|
+
})
|
|
10430
|
+
]
|
|
10431
|
+
})
|
|
10432
|
+
}),
|
|
10433
|
+
/*#__PURE__*/ jsxs("div", {
|
|
10434
|
+
className: styles.content,
|
|
10435
|
+
children: [
|
|
10436
|
+
/*#__PURE__*/ jsx("p", {
|
|
10437
|
+
dangerouslySetInnerHTML: {
|
|
10438
|
+
__html: message
|
|
10439
|
+
},
|
|
10440
|
+
className: styles.content_child
|
|
10441
|
+
}),
|
|
10442
|
+
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ jsxs("p", {
|
|
10443
|
+
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
10444
|
+
children: [
|
|
10445
|
+
/*#__PURE__*/ jsx("img", {
|
|
10446
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
10374
10447
|
}),
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
className: "fuzhi21",
|
|
10382
|
-
onClick: function() {
|
|
10383
|
-
copyText(item.message);
|
|
10384
|
-
{
|
|
10385
|
-
var obj = copyTextOBJ;
|
|
10386
|
-
obj = obj.filter(function(list) {
|
|
10387
|
-
return list != item.id;
|
|
10388
|
-
});
|
|
10389
|
-
obj.push(item.id);
|
|
10390
|
-
setCopyTextObj(obj);
|
|
10448
|
+
/*#__PURE__*/ jsx("div", {
|
|
10449
|
+
className: styles.mask_zoom,
|
|
10450
|
+
children: /*#__PURE__*/ jsx(ZoomInOutlined, {
|
|
10451
|
+
onClick: function() {
|
|
10452
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
10453
|
+
setVisible(true);
|
|
10391
10454
|
}
|
|
10392
|
-
|
|
10393
|
-
var obj = copyTextOBJ;
|
|
10394
|
-
obj = obj.filter(function(list) {
|
|
10395
|
-
return list != item.id;
|
|
10396
|
-
});
|
|
10397
|
-
setCopyTextObj(obj);
|
|
10398
|
-
}, 3000);
|
|
10399
|
-
onEvent(serverName + serverUrl(), "click_智能问答_复制", "提交");
|
|
10400
|
-
},
|
|
10401
|
-
children: /*#__PURE__*/ jsx(CustomCopy$1, {})
|
|
10455
|
+
})
|
|
10402
10456
|
})
|
|
10403
10457
|
]
|
|
10404
10458
|
})
|
|
10459
|
+
]
|
|
10460
|
+
})
|
|
10461
|
+
]
|
|
10462
|
+
}),
|
|
10463
|
+
//引用消息
|
|
10464
|
+
item.quotedMessage && /*#__PURE__*/ jsxs("div", {
|
|
10465
|
+
className: styles.citation_content,
|
|
10466
|
+
children: [
|
|
10467
|
+
getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ jsx(Tooltip, {
|
|
10468
|
+
overlayClassName: styles.popover_main_content,
|
|
10469
|
+
title: item.quotedMessage,
|
|
10470
|
+
placement: "leftTop",
|
|
10471
|
+
children: /*#__PURE__*/ jsxs("p", {
|
|
10472
|
+
className: styles.text_exceed,
|
|
10473
|
+
children: [
|
|
10474
|
+
item.quotedMessage,
|
|
10475
|
+
/*#__PURE__*/ jsx(RightOutlined, {})
|
|
10476
|
+
]
|
|
10477
|
+
})
|
|
10478
|
+
}) : /*#__PURE__*/ jsx("p", {
|
|
10479
|
+
children: item.quotedMessage
|
|
10480
|
+
}),
|
|
10481
|
+
item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ jsxs("p", {
|
|
10482
|
+
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
10483
|
+
children: [
|
|
10484
|
+
/*#__PURE__*/ jsx("img", {
|
|
10485
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
10486
|
+
}),
|
|
10487
|
+
/*#__PURE__*/ jsx("div", {
|
|
10488
|
+
className: styles.mask_zoom,
|
|
10489
|
+
children: /*#__PURE__*/ jsx(ZoomInOutlined, {
|
|
10490
|
+
onClick: function() {
|
|
10491
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
10492
|
+
setVisible(true);
|
|
10493
|
+
}
|
|
10494
|
+
})
|
|
10495
|
+
})
|
|
10496
|
+
]
|
|
10497
|
+
})
|
|
10498
|
+
]
|
|
10499
|
+
})
|
|
10500
|
+
]
|
|
10501
|
+
})
|
|
10502
|
+
}),
|
|
10503
|
+
(showType == 2 || showType == 4) && /*#__PURE__*/ jsx("div", {
|
|
10504
|
+
className: styles.head_sculpture,
|
|
10505
|
+
style: {
|
|
10506
|
+
marginLeft: "12px"
|
|
10507
|
+
},
|
|
10508
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
10509
|
+
src: userData.avatar
|
|
10510
|
+
})
|
|
10511
|
+
})
|
|
10512
|
+
]
|
|
10513
|
+
}, item.id)
|
|
10514
|
+
]
|
|
10515
|
+
});
|
|
10516
|
+
} else {
|
|
10517
|
+
//获取用户头像
|
|
10518
|
+
var headImg = "";
|
|
10519
|
+
var chatWindow = [];
|
|
10520
|
+
var isAiChatWindow;
|
|
10521
|
+
chatWindow = contactsList.filter(function(item) {
|
|
10522
|
+
return item.roomId == roomId;
|
|
10523
|
+
});
|
|
10524
|
+
if (chatWindow.length > 0 && chatWindow[0].headImg != "") {
|
|
10525
|
+
headImg = chatWindow[0].headImg;
|
|
10526
|
+
}
|
|
10527
|
+
// console.log(chatWindow,'chatWindowchatWindow')
|
|
10528
|
+
//是否在智能客服窗口
|
|
10529
|
+
isAiChatWindow = chatWindow.length > 0 && chatWindow[0].sender != undefined && chatWindow[0].sender == "AI" ? true : false;
|
|
10530
|
+
var header = 2; //代表是ai头像
|
|
10531
|
+
if (isAiChatWindow && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "isVoteMessage") {
|
|
10532
|
+
//使用AI头像
|
|
10533
|
+
header = 1;
|
|
10534
|
+
}
|
|
10535
|
+
li = /*#__PURE__*/ jsxs(Fragment, {
|
|
10536
|
+
children: [
|
|
10537
|
+
dataTime ? /*#__PURE__*/ jsx("li", {
|
|
10538
|
+
className: "".concat(styles.itemcontent, " ").concat(styles.time),
|
|
10539
|
+
children: dataTime
|
|
10540
|
+
}) : "",
|
|
10541
|
+
/*#__PURE__*/ jsxs("li", {
|
|
10542
|
+
className: "".concat(styles.itemcontent, " ").concat(styles.right),
|
|
10543
|
+
id: lastId == item.id ? "li_flag" : item.id,
|
|
10544
|
+
children: [
|
|
10545
|
+
(showType == 2 || showType == 4) && /*#__PURE__*/ jsx("div", {
|
|
10546
|
+
className: styles.head_sculpture,
|
|
10547
|
+
style: {
|
|
10548
|
+
marginRight: "12px"
|
|
10549
|
+
},
|
|
10550
|
+
children: isAiChatWindow ? item.extraInfo == null || header == 1 ? /*#__PURE__*/ jsx(CustomAiIcon$1, {}) : /*#__PURE__*/ jsx("img", {
|
|
10551
|
+
src: knowledge_icon
|
|
10552
|
+
}) : /*#__PURE__*/ jsx("img", {
|
|
10553
|
+
src: headImg
|
|
10554
|
+
})
|
|
10555
|
+
}),
|
|
10556
|
+
/*#__PURE__*/ jsx("div", {
|
|
10557
|
+
className: styles.main,
|
|
10558
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
10559
|
+
className: styles.main_content,
|
|
10560
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
10561
|
+
className: styles.main_content_flag,
|
|
10562
|
+
onMouseEnter: function() {
|
|
10563
|
+
// onMouseEnter方法内:判断回答内容的气泡是否在可视区域内,动态判断点赞按钮显示的上下位置
|
|
10564
|
+
var isSmall = showType == 1 || showType == 3;
|
|
10565
|
+
var container = document.getElementById(isSmall ? "chat_content" : "chat_content_modal");
|
|
10566
|
+
console.log("onMouseEnter1", container);
|
|
10567
|
+
if (container) {
|
|
10568
|
+
var dom = container.querySelector('[id="'.concat(item.id, '"]'));
|
|
10569
|
+
console.log("onMouseEnter2", dom);
|
|
10570
|
+
if (dom) {
|
|
10571
|
+
// const con_h=document.getElementById('chat_content').clientHeight-24;//滚动区域的高度
|
|
10572
|
+
var con_h = container.clientHeight - (isSmall ? 24 : 0); //滚动区域的高度;
|
|
10573
|
+
var rectY = dom.getBoundingClientRect().y - 48;
|
|
10574
|
+
var h = dom.clientHeight + (isSmall ? 24 : 0); //当前元素高度
|
|
10575
|
+
var topDom = dom.getElementsByClassName(styles.operate_modal_showtop)[0];
|
|
10576
|
+
var bottomDom = dom.getElementsByClassName(styles.operate_modal_showbottom)[0];
|
|
10577
|
+
console.log("onMouseEnter3", topDom, bottomDom);
|
|
10578
|
+
console.log("onMouseEnter4", {
|
|
10579
|
+
h: h,
|
|
10580
|
+
con_h: con_h,
|
|
10581
|
+
rectY: rectY,
|
|
10582
|
+
topDom: topDom,
|
|
10583
|
+
bottomDom: bottomDom
|
|
10584
|
+
});
|
|
10585
|
+
if (topDom && bottomDom) {
|
|
10586
|
+
if (rectY > 0) {
|
|
10587
|
+
//显示上边
|
|
10588
|
+
topDom.style.cssText = "visibility: visible";
|
|
10589
|
+
bottomDom.style.cssText = "visibility: hidden;";
|
|
10590
|
+
// 上下都能显示时,显示到下边
|
|
10591
|
+
if (h < con_h - rectY) {
|
|
10592
|
+
console.log("上下都能显示时,显示到下边");
|
|
10593
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
10594
|
+
bottomDom.style.cssText = "visibility: visible";
|
|
10595
|
+
}
|
|
10596
|
+
} else {
|
|
10597
|
+
// 上下都不显示,下边的放到页的最上边
|
|
10598
|
+
if (h > con_h && h - con_h > Math.abs(rectY)) {
|
|
10599
|
+
console.log("上下都不显示");
|
|
10600
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
10601
|
+
bottomDom.style.cssText = "top:".concat(-(h + rectY - 51 - (isSmall ? 0 : 58)), "px;visibility: visible;");
|
|
10602
|
+
} else {
|
|
10603
|
+
console.log("12312312");
|
|
10604
|
+
//显示下边
|
|
10605
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
10606
|
+
bottomDom.style.cssText = "visibility: visible";
|
|
10607
|
+
}
|
|
10608
|
+
}
|
|
10609
|
+
}
|
|
10610
|
+
}
|
|
10611
|
+
}
|
|
10612
|
+
},
|
|
10613
|
+
onMouseLeave: function() {
|
|
10614
|
+
var isSmall = showType == 1 || showType == 3;
|
|
10615
|
+
var container = document.getElementById(isSmall ? "chat_content" : "chat_content_modal");
|
|
10616
|
+
if (container) {
|
|
10617
|
+
var dom = container.querySelector('[id="'.concat(item.id, '"]'));
|
|
10618
|
+
if (dom) {
|
|
10619
|
+
var topDom = dom.getElementsByClassName(styles.operate_modal_showtop)[0];
|
|
10620
|
+
var bottomDom = dom.getElementsByClassName(styles.operate_modal_showbottom)[0];
|
|
10621
|
+
if (topDom) {
|
|
10622
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
10623
|
+
}
|
|
10624
|
+
if (bottomDom) {
|
|
10625
|
+
bottomDom.style.cssText = "visibility: hidden;";
|
|
10626
|
+
}
|
|
10627
|
+
}
|
|
10628
|
+
}
|
|
10629
|
+
},
|
|
10630
|
+
children: [
|
|
10631
|
+
/*#__PURE__*/ jsx("div", {
|
|
10632
|
+
className: "".concat(styles.operate_modal, " ").concat(styles.operate_modal_showtop),
|
|
10633
|
+
children: // 不是最后一行,
|
|
10634
|
+
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
10635
|
+
}),
|
|
10636
|
+
/*#__PURE__*/ jsxs("div", {
|
|
10637
|
+
className: styles.content,
|
|
10638
|
+
children: [
|
|
10639
|
+
item.message != "AI助手繁忙,请稍后再提问或" && /*#__PURE__*/ jsx("p", {
|
|
10640
|
+
dangerouslySetInnerHTML: {
|
|
10641
|
+
__html: message
|
|
10642
|
+
},
|
|
10643
|
+
className: styles.content_child
|
|
10405
10644
|
}),
|
|
10406
|
-
/*#__PURE__*/ jsxs("
|
|
10407
|
-
className: styles.content,
|
|
10645
|
+
item.message == "AI助手繁忙,请稍后再提问或" && /*#__PURE__*/ jsxs("p", {
|
|
10408
10646
|
children: [
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10647
|
+
"AI助手繁忙,请稍后再提问或",
|
|
10648
|
+
/*#__PURE__*/ jsx("span", {
|
|
10649
|
+
className: styles.find_teacher_con,
|
|
10650
|
+
onClick: function() {
|
|
10651
|
+
var extraInfo = historyMessageList[i - 1].extraInfo;
|
|
10652
|
+
var url = "";
|
|
10653
|
+
if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
|
|
10654
|
+
url = JSON.parse(extraInfo)[0].value;
|
|
10655
|
+
}
|
|
10656
|
+
setProblem({
|
|
10657
|
+
question: historyMessageList[i - 1].message,
|
|
10658
|
+
url: url
|
|
10659
|
+
});
|
|
10660
|
+
setShowTeacherList(true);
|
|
10412
10661
|
},
|
|
10413
|
-
|
|
10662
|
+
children: "召唤老师回答"
|
|
10663
|
+
})
|
|
10664
|
+
]
|
|
10665
|
+
}),
|
|
10666
|
+
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ jsxs("p", {
|
|
10667
|
+
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
10668
|
+
children: [
|
|
10669
|
+
/*#__PURE__*/ jsx("img", {
|
|
10670
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
10414
10671
|
}),
|
|
10415
|
-
|
|
10416
|
-
className:
|
|
10417
|
-
children:
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10672
|
+
/*#__PURE__*/ jsx("div", {
|
|
10673
|
+
className: styles.mask_zoom,
|
|
10674
|
+
children: /*#__PURE__*/ jsx(ZoomInOutlined, {
|
|
10675
|
+
onClick: function() {
|
|
10676
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
10677
|
+
setVisible(true);
|
|
10678
|
+
}
|
|
10679
|
+
})
|
|
10680
|
+
})
|
|
10681
|
+
]
|
|
10682
|
+
}),
|
|
10683
|
+
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ jsxs("ul", {
|
|
10684
|
+
className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ? styles.association_problem_flag : ""),
|
|
10685
|
+
children: [
|
|
10686
|
+
item.message == "抱歉,我暂时无法回答这样的问题。" && /*#__PURE__*/ jsx("li", {
|
|
10687
|
+
className: styles.related_issues_flag,
|
|
10688
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
10689
|
+
children: "相关问题"
|
|
10690
|
+
})
|
|
10691
|
+
}),
|
|
10692
|
+
JSON.parse(item.extraInfo).map(function(list, index) {
|
|
10693
|
+
return /*#__PURE__*/ jsx("li", {
|
|
10694
|
+
onClick: function() {
|
|
10695
|
+
sendMessage(list, 1);
|
|
10696
|
+
setBottomRecommendationQuestions([]);
|
|
10697
|
+
resettingBottomHei();
|
|
10698
|
+
},
|
|
10699
|
+
children: item.message == "抱歉,我暂时无法回答这样的问题。" ? list.question : /*#__PURE__*/ jsxs(Fragment, {
|
|
10700
|
+
children: [
|
|
10701
|
+
JSON.parse(item.extraInfo).length > 1 ? index + 1 + "." : "",
|
|
10702
|
+
list.question
|
|
10703
|
+
]
|
|
10429
10704
|
})
|
|
10430
|
-
|
|
10705
|
+
}, i + "_" + index + "_" + list.value);
|
|
10431
10706
|
})
|
|
10432
10707
|
]
|
|
10433
|
-
})
|
|
10708
|
+
}),
|
|
10709
|
+
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
10710
|
+
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != "123456_date" && renderLastOperateBtn(item, isAiChatWindow, i)
|
|
10434
10711
|
]
|
|
10435
10712
|
}),
|
|
10436
10713
|
//引用消息
|
|
@@ -10440,7 +10717,7 @@ var CustomerService = function(props) {
|
|
|
10440
10717
|
getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ jsx(Tooltip, {
|
|
10441
10718
|
overlayClassName: styles.popover_main_content,
|
|
10442
10719
|
title: item.quotedMessage,
|
|
10443
|
-
placement: "
|
|
10720
|
+
placement: "rightTop",
|
|
10444
10721
|
children: /*#__PURE__*/ jsxs("p", {
|
|
10445
10722
|
className: styles.text_exceed,
|
|
10446
10723
|
children: [
|
|
@@ -10469,250 +10746,106 @@ var CustomerService = function(props) {
|
|
|
10469
10746
|
]
|
|
10470
10747
|
})
|
|
10471
10748
|
]
|
|
10749
|
+
}),
|
|
10750
|
+
historyMessageList.length - 1 !== i && /*#__PURE__*/ jsx("div", {
|
|
10751
|
+
className: "".concat(styles.operate_modal, " ").concat(styles.bottom, " ").concat(styles.operate_modal_showbottom),
|
|
10752
|
+
children: // 不是最后一行,
|
|
10753
|
+
renderOperateBtn(item, isAiChatWindow, i)
|
|
10472
10754
|
})
|
|
10473
10755
|
]
|
|
10474
10756
|
})
|
|
10475
|
-
}),
|
|
10476
|
-
(showType == 2 || showType == 4) && /*#__PURE__*/ jsx("div", {
|
|
10477
|
-
className: styles.head_sculpture,
|
|
10478
|
-
style: {
|
|
10479
|
-
marginLeft: "12px"
|
|
10480
|
-
},
|
|
10481
|
-
children: /*#__PURE__*/ jsx("img", {
|
|
10482
|
-
src: userData.avatar
|
|
10483
|
-
})
|
|
10484
10757
|
})
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
}
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10758
|
+
})
|
|
10759
|
+
]
|
|
10760
|
+
}, item.id)
|
|
10761
|
+
]
|
|
10762
|
+
});
|
|
10763
|
+
}
|
|
10764
|
+
return /*#__PURE__*/ jsx(React__default.Fragment, {
|
|
10765
|
+
children: li
|
|
10766
|
+
}, item.id);
|
|
10767
|
+
}
|
|
10768
|
+
return /*#__PURE__*/ jsx("ul", {
|
|
10769
|
+
className: styles.message_con,
|
|
10770
|
+
style: {
|
|
10771
|
+
height: historyMessageListVirtuosoHeight
|
|
10772
|
+
},
|
|
10773
|
+
children: /*#__PURE__*/ jsx(cn, {
|
|
10774
|
+
ref: historyMessageListVirtuosoRef,
|
|
10775
|
+
data: historyMessageList,
|
|
10776
|
+
itemContent: itemContent,
|
|
10777
|
+
totalCount: historyMessageList.length,
|
|
10778
|
+
style: {
|
|
10779
|
+
height: "100%"
|
|
10780
|
+
},
|
|
10781
|
+
// initialTopMostItemIndex={isPositionState? { index: "LAST", align: "end" }:undefined}
|
|
10782
|
+
startReached: function() {
|
|
10783
|
+
if (pageCount > pageNum && pageCount > 0) {
|
|
10784
|
+
var number = pageNum + 1;
|
|
10785
|
+
setPageNum(function(pageNum) {
|
|
10786
|
+
return pageNum + 1;
|
|
10787
|
+
});
|
|
10788
|
+
setLoading(true);
|
|
10789
|
+
listTimer.current = setTimeout(function() {
|
|
10790
|
+
getHistoryMessage(number, 2);
|
|
10791
|
+
}, 1000);
|
|
10499
10792
|
}
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10793
|
+
},
|
|
10794
|
+
endReached: function() {
|
|
10795
|
+
if (pageNumHistory > 1) {
|
|
10796
|
+
var number = pageNumHistory - 1;
|
|
10797
|
+
setPageNumHistory(number);
|
|
10798
|
+
clearTimeout(listTimer.current);
|
|
10799
|
+
listTimer.current = setTimeout(function() {
|
|
10800
|
+
if (number > 0) {
|
|
10801
|
+
setBottomLoading(true);
|
|
10802
|
+
getHistoryMessage(number, 4);
|
|
10803
|
+
setLastId("");
|
|
10804
|
+
} else {
|
|
10805
|
+
setPageNumHistory(0);
|
|
10806
|
+
}
|
|
10807
|
+
}, 1000);
|
|
10808
|
+
}
|
|
10809
|
+
},
|
|
10810
|
+
context: {
|
|
10811
|
+
loading: loading
|
|
10812
|
+
},
|
|
10813
|
+
firstItemIndex: firstItemIndex,
|
|
10814
|
+
increaseViewportBy: 200,
|
|
10815
|
+
overscan: 10,
|
|
10816
|
+
logLevel: 0,
|
|
10817
|
+
onScroll: function(e) {
|
|
10818
|
+
//生成答案过程中
|
|
10819
|
+
if (!finishedRef.current) {
|
|
10820
|
+
var _container, _container1, _container2;
|
|
10821
|
+
var container = e.target;
|
|
10822
|
+
var _container_scrollTop;
|
|
10823
|
+
var scrollTop = (_container_scrollTop = (_container = container) === null || _container === void 0 ? void 0 : _container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0;
|
|
10824
|
+
var _container_clientHeight;
|
|
10825
|
+
var clientHeight = (_container_clientHeight = (_container1 = container) === null || _container1 === void 0 ? void 0 : _container1.clientHeight) !== null && _container_clientHeight !== void 0 ? _container_clientHeight : 0;
|
|
10826
|
+
var _container_scrollHeight;
|
|
10827
|
+
var scrollHeight = (_container_scrollHeight = (_container2 = container) === null || _container2 === void 0 ? void 0 : _container2.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0;
|
|
10828
|
+
var distanceFromBottom = scrollHeight - (scrollTop + clientHeight);
|
|
10829
|
+
if (distanceFromBottom > 10) {
|
|
10830
|
+
// 距离底部超过10像素才认为是主动向上滚动
|
|
10831
|
+
isPosition.current = false;
|
|
10832
|
+
setIsPositionState(false);
|
|
10833
|
+
} else if (distanceFromBottom < 10) {
|
|
10834
|
+
// 距离底部很近时恢复自动滚动
|
|
10835
|
+
isPosition.current = true;
|
|
10836
|
+
setIsPositionState(true);
|
|
10837
|
+
}
|
|
10838
|
+
console.log("Scroll-onScroll", {
|
|
10839
|
+
container: container,
|
|
10840
|
+
scrollTop: scrollTop,
|
|
10841
|
+
clientHeight: clientHeight,
|
|
10842
|
+
scrollHeight: scrollHeight,
|
|
10843
|
+
isPosition: isPosition.current
|
|
10844
|
+
});
|
|
10507
10845
|
}
|
|
10508
|
-
li = /*#__PURE__*/ jsxs(Fragment, {
|
|
10509
|
-
children: [
|
|
10510
|
-
dataTime ? /*#__PURE__*/ jsx("li", {
|
|
10511
|
-
className: styles.time,
|
|
10512
|
-
children: dataTime
|
|
10513
|
-
}) : "",
|
|
10514
|
-
/*#__PURE__*/ jsxs("li", {
|
|
10515
|
-
className: styles.right,
|
|
10516
|
-
id: lastId == item.id ? "li_flag" : item.id,
|
|
10517
|
-
children: [
|
|
10518
|
-
(showType == 2 || showType == 4) && /*#__PURE__*/ jsx("div", {
|
|
10519
|
-
className: styles.head_sculpture,
|
|
10520
|
-
style: {
|
|
10521
|
-
marginRight: "12px"
|
|
10522
|
-
},
|
|
10523
|
-
children: isAiChatWindow ? item.extraInfo == null || header == 1 ? /*#__PURE__*/ jsx(CustomAiIcon$1, {}) : /*#__PURE__*/ jsx("img", {
|
|
10524
|
-
src: knowledge_icon
|
|
10525
|
-
}) : /*#__PURE__*/ jsx("img", {
|
|
10526
|
-
src: headImg
|
|
10527
|
-
})
|
|
10528
|
-
}),
|
|
10529
|
-
/*#__PURE__*/ jsx("div", {
|
|
10530
|
-
className: styles.main,
|
|
10531
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
10532
|
-
className: styles.main_content,
|
|
10533
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
10534
|
-
className: styles.main_content_flag,
|
|
10535
|
-
onMouseEnter: function() {
|
|
10536
|
-
var isSmall = showType == 1 || showType == 3;
|
|
10537
|
-
var container = document.getElementById(isSmall ? "chat_content" : "chat_content_modal");
|
|
10538
|
-
if (container) {
|
|
10539
|
-
var dom = container.querySelector('[id="'.concat(item.id, '"]'));
|
|
10540
|
-
if (dom) {
|
|
10541
|
-
// const con_h=document.getElementById('chat_content').clientHeight-24;//滚动区域的高度
|
|
10542
|
-
var con_h = container.clientHeight - (isSmall ? 24 : 0); //滚动区域的高度;
|
|
10543
|
-
var rectY = dom.getBoundingClientRect().y - 48;
|
|
10544
|
-
var h = dom.clientHeight + (isSmall ? 24 : 0); //当前元素高度
|
|
10545
|
-
var topDom = dom.getElementsByClassName("operate_modal_showtop")[0];
|
|
10546
|
-
var bottomDom = dom.getElementsByClassName("operate_modal_showbottom")[0];
|
|
10547
|
-
// console.log({h,con_h,rectY,topDom,bottomDom})
|
|
10548
|
-
if (topDom && bottomDom) {
|
|
10549
|
-
if (rectY > 0) {
|
|
10550
|
-
topDom.style.cssText = "";
|
|
10551
|
-
bottomDom.style.cssText = "visibility: hidden;";
|
|
10552
|
-
// 上下都能显示时,显示到下边
|
|
10553
|
-
if (h < con_h - rectY) {
|
|
10554
|
-
console.log("上下都能显示时,显示到下边");
|
|
10555
|
-
topDom.style.cssText = "visibility: hidden;";
|
|
10556
|
-
bottomDom.style.cssText = "";
|
|
10557
|
-
}
|
|
10558
|
-
} else {
|
|
10559
|
-
// 上下都不显示
|
|
10560
|
-
if (h > con_h && h - con_h > Math.abs(rectY)) {
|
|
10561
|
-
console.log("上下都不显示");
|
|
10562
|
-
topDom.style.cssText = "visibility: hidden;";
|
|
10563
|
-
bottomDom.style.cssText = "top:".concat(-(h + rectY - 51 - (isSmall ? 0 : 58)), "px;");
|
|
10564
|
-
} else {
|
|
10565
|
-
console.log("12312312");
|
|
10566
|
-
topDom.style.cssText = "visibility: hidden;";
|
|
10567
|
-
bottomDom.style.cssText = "";
|
|
10568
|
-
}
|
|
10569
|
-
}
|
|
10570
|
-
}
|
|
10571
|
-
}
|
|
10572
|
-
}
|
|
10573
|
-
},
|
|
10574
|
-
children: [
|
|
10575
|
-
/*#__PURE__*/ jsx("div", {
|
|
10576
|
-
className: "".concat(styles.operate_modal, " operate_modal_showtop"),
|
|
10577
|
-
children: // 不是最后一行,
|
|
10578
|
-
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
10579
|
-
}),
|
|
10580
|
-
/*#__PURE__*/ jsxs("div", {
|
|
10581
|
-
className: styles.content,
|
|
10582
|
-
children: [
|
|
10583
|
-
item.message != "AI助手繁忙,请稍后再提问或" && /*#__PURE__*/ jsx("p", {
|
|
10584
|
-
dangerouslySetInnerHTML: {
|
|
10585
|
-
__html: message
|
|
10586
|
-
},
|
|
10587
|
-
className: styles.content_child
|
|
10588
|
-
}),
|
|
10589
|
-
item.message == "AI助手繁忙,请稍后再提问或" && /*#__PURE__*/ jsxs("p", {
|
|
10590
|
-
children: [
|
|
10591
|
-
"AI助手繁忙,请稍后再提问或",
|
|
10592
|
-
/*#__PURE__*/ jsx("span", {
|
|
10593
|
-
className: styles.find_teacher_con,
|
|
10594
|
-
onClick: function() {
|
|
10595
|
-
var extraInfo = historyMessageList[i - 1].extraInfo;
|
|
10596
|
-
var url = "";
|
|
10597
|
-
if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
|
|
10598
|
-
url = JSON.parse(extraInfo)[0].value;
|
|
10599
|
-
}
|
|
10600
|
-
setProblem({
|
|
10601
|
-
question: historyMessageList[i - 1].message,
|
|
10602
|
-
url: url
|
|
10603
|
-
});
|
|
10604
|
-
setShowTeacherList(true);
|
|
10605
|
-
},
|
|
10606
|
-
children: "召唤老师回答"
|
|
10607
|
-
})
|
|
10608
|
-
]
|
|
10609
|
-
}),
|
|
10610
|
-
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ jsxs("p", {
|
|
10611
|
-
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
10612
|
-
children: [
|
|
10613
|
-
/*#__PURE__*/ jsx("img", {
|
|
10614
|
-
src: JSON.parse(item.extraInfo)[0].value
|
|
10615
|
-
}),
|
|
10616
|
-
/*#__PURE__*/ jsx("div", {
|
|
10617
|
-
className: styles.mask_zoom,
|
|
10618
|
-
children: /*#__PURE__*/ jsx(ZoomInOutlined, {
|
|
10619
|
-
onClick: function() {
|
|
10620
|
-
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
10621
|
-
setVisible(true);
|
|
10622
|
-
}
|
|
10623
|
-
})
|
|
10624
|
-
})
|
|
10625
|
-
]
|
|
10626
|
-
}),
|
|
10627
|
-
item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "messageSource" && JSON.parse(item.extraInfo)[0].value != "knowledgebase" && /*#__PURE__*/ jsxs("ul", {
|
|
10628
|
-
className: "".concat(styles.association_problem, " ").concat(item.message == "抱歉,我暂时无法回答这样的问题。" ? styles.association_problem_flag : ""),
|
|
10629
|
-
children: [
|
|
10630
|
-
item.message == "抱歉,我暂时无法回答这样的问题。" && /*#__PURE__*/ jsx("li", {
|
|
10631
|
-
className: styles.related_issues_flag,
|
|
10632
|
-
children: /*#__PURE__*/ jsx("span", {
|
|
10633
|
-
children: "相关问题"
|
|
10634
|
-
})
|
|
10635
|
-
}),
|
|
10636
|
-
JSON.parse(item.extraInfo).map(function(list, index) {
|
|
10637
|
-
return /*#__PURE__*/ jsx("li", {
|
|
10638
|
-
onClick: function() {
|
|
10639
|
-
sendMessage(list, 1);
|
|
10640
|
-
setBottomRecommendationQuestions([]);
|
|
10641
|
-
resettingBottomHei();
|
|
10642
|
-
},
|
|
10643
|
-
children: item.message == "抱歉,我暂时无法回答这样的问题。" ? list.question : /*#__PURE__*/ jsxs(Fragment, {
|
|
10644
|
-
children: [
|
|
10645
|
-
JSON.parse(item.extraInfo).length > 1 ? index + 1 + "." : "",
|
|
10646
|
-
list.question
|
|
10647
|
-
]
|
|
10648
|
-
})
|
|
10649
|
-
}, i + "_" + index + "_" + list.value);
|
|
10650
|
-
})
|
|
10651
|
-
]
|
|
10652
|
-
}),
|
|
10653
|
-
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
10654
|
-
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != "123456_date" && renderLastOperateBtn(item, isAiChatWindow, i)
|
|
10655
|
-
]
|
|
10656
|
-
}),
|
|
10657
|
-
//引用消息
|
|
10658
|
-
item.quotedMessage && /*#__PURE__*/ jsxs("div", {
|
|
10659
|
-
className: styles.citation_content,
|
|
10660
|
-
children: [
|
|
10661
|
-
getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ jsx(Tooltip, {
|
|
10662
|
-
overlayClassName: styles.popover_main_content,
|
|
10663
|
-
title: item.quotedMessage,
|
|
10664
|
-
placement: "rightTop",
|
|
10665
|
-
children: /*#__PURE__*/ jsxs("p", {
|
|
10666
|
-
className: styles.text_exceed,
|
|
10667
|
-
children: [
|
|
10668
|
-
item.quotedMessage,
|
|
10669
|
-
/*#__PURE__*/ jsx(RightOutlined, {})
|
|
10670
|
-
]
|
|
10671
|
-
})
|
|
10672
|
-
}) : /*#__PURE__*/ jsx("p", {
|
|
10673
|
-
children: item.quotedMessage
|
|
10674
|
-
}),
|
|
10675
|
-
item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ jsxs("p", {
|
|
10676
|
-
className: "".concat(styles.img_con, " ").concat(showType == 2 || showType == 4 ? styles.img_con2 : ""),
|
|
10677
|
-
children: [
|
|
10678
|
-
/*#__PURE__*/ jsx("img", {
|
|
10679
|
-
src: JSON.parse(item.extraInfo)[0].value
|
|
10680
|
-
}),
|
|
10681
|
-
/*#__PURE__*/ jsx("div", {
|
|
10682
|
-
className: styles.mask_zoom,
|
|
10683
|
-
children: /*#__PURE__*/ jsx(ZoomInOutlined, {
|
|
10684
|
-
onClick: function() {
|
|
10685
|
-
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
10686
|
-
setVisible(true);
|
|
10687
|
-
}
|
|
10688
|
-
})
|
|
10689
|
-
})
|
|
10690
|
-
]
|
|
10691
|
-
})
|
|
10692
|
-
]
|
|
10693
|
-
}),
|
|
10694
|
-
historyMessageList.length - 1 !== i && /*#__PURE__*/ jsx("div", {
|
|
10695
|
-
className: "".concat(styles.operate_modal, " ").concat(styles.bottom, " operate_modal_showbottom"),
|
|
10696
|
-
children: // 不是最后一行,
|
|
10697
|
-
renderOperateBtn(item, isAiChatWindow, i)
|
|
10698
|
-
})
|
|
10699
|
-
]
|
|
10700
|
-
})
|
|
10701
|
-
})
|
|
10702
|
-
})
|
|
10703
|
-
]
|
|
10704
|
-
}, item.id)
|
|
10705
|
-
]
|
|
10706
|
-
});
|
|
10707
10846
|
}
|
|
10708
|
-
return /*#__PURE__*/ jsx(React__default.Fragment, {
|
|
10709
|
-
children: li
|
|
10710
|
-
}, item.id);
|
|
10711
10847
|
})
|
|
10712
10848
|
});
|
|
10713
|
-
// } else {
|
|
10714
|
-
// return "";
|
|
10715
|
-
// }
|
|
10716
10849
|
};
|
|
10717
10850
|
//渲染相关操作按钮 header == 1 ai ,== 2 知识库
|
|
10718
10851
|
var renderOperateBtn = function(item, isAiChatWindow, i) {
|
|
@@ -10731,7 +10864,7 @@ var CustomerService = function(props) {
|
|
|
10731
10864
|
}) && /*#__PURE__*/ jsx("span", {
|
|
10732
10865
|
className: styles.ask_question,
|
|
10733
10866
|
onClick: function() {
|
|
10734
|
-
console.log(historyMessageList[i - 1], 4444444);
|
|
10867
|
+
// console.log(historyMessageList[i - 1], 4444444);
|
|
10735
10868
|
var extraInfo = historyMessageList[i - 1].extraInfo;
|
|
10736
10869
|
var url = "";
|
|
10737
10870
|
if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
|
|
@@ -10848,12 +10981,12 @@ var CustomerService = function(props) {
|
|
|
10848
10981
|
}
|
|
10849
10982
|
//1、是否显示停止生成按钮 finished 是否生产完成
|
|
10850
10983
|
var showStopBtn = false;
|
|
10851
|
-
if (!
|
|
10984
|
+
if (!finished && item.sender == "AI" && item.extraInfo == null) {
|
|
10852
10985
|
showStopBtn = true;
|
|
10853
10986
|
}
|
|
10854
10987
|
//2、是否展示重新生成按钮
|
|
10855
10988
|
var regenerationBtn = false;
|
|
10856
|
-
if (
|
|
10989
|
+
if (finished && item.sender == "AI" && item.extraInfo == null) {
|
|
10857
10990
|
regenerationBtn = true;
|
|
10858
10991
|
}
|
|
10859
10992
|
//3、是否显示召唤老师回答按钮
|
|
@@ -10878,16 +11011,14 @@ var CustomerService = function(props) {
|
|
|
10878
11011
|
}
|
|
10879
11012
|
} catch (error) {}
|
|
10880
11013
|
clearTimeout(receiveMessageTimer.current);
|
|
11014
|
+
clearTimeout(renderAiAnswerTimer.current);
|
|
10881
11015
|
setHistoryMessageList(function(historyMessageList) {
|
|
10882
11016
|
return historyMessageList.filter(function(item) {
|
|
10883
11017
|
return item.id != "123456";
|
|
10884
11018
|
});
|
|
10885
11019
|
});
|
|
10886
|
-
|
|
10887
|
-
setFinished(
|
|
10888
|
-
finishedRef.current = true;
|
|
10889
|
-
return finishedRef.current;
|
|
10890
|
-
});
|
|
11020
|
+
finishedRef.current = true;
|
|
11021
|
+
setFinished(true);
|
|
10891
11022
|
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
10892
11023
|
}
|
|
10893
11024
|
}),
|
|
@@ -10900,16 +11031,14 @@ var CustomerService = function(props) {
|
|
|
10900
11031
|
}
|
|
10901
11032
|
} catch (error) {}
|
|
10902
11033
|
clearTimeout(receiveMessageTimer.current);
|
|
11034
|
+
clearTimeout(renderAiAnswerTimer.current);
|
|
10903
11035
|
setHistoryMessageList(function(historyMessageList) {
|
|
10904
11036
|
return historyMessageList.filter(function(item) {
|
|
10905
11037
|
return item.id != "123456";
|
|
10906
11038
|
});
|
|
10907
11039
|
});
|
|
10908
|
-
|
|
10909
|
-
setFinished(
|
|
10910
|
-
finishedRef.current = true;
|
|
10911
|
-
return finishedRef.current;
|
|
10912
|
-
});
|
|
11040
|
+
finishedRef.current = true;
|
|
11041
|
+
setFinished(true);
|
|
10913
11042
|
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
10914
11043
|
},
|
|
10915
11044
|
children: "停止生成"
|
|
@@ -10942,6 +11071,7 @@ var CustomerService = function(props) {
|
|
|
10942
11071
|
children: [
|
|
10943
11072
|
regenerationBtn && /*#__PURE__*/ jsx("i", {
|
|
10944
11073
|
onClick: function() {
|
|
11074
|
+
finishedRef.current = false;
|
|
10945
11075
|
setFinished(false);
|
|
10946
11076
|
aiSendQuestions(2, {
|
|
10947
11077
|
roomId: roomId,
|
|
@@ -11006,7 +11136,7 @@ var CustomerService = function(props) {
|
|
|
11006
11136
|
if (!isAiChatWindow) return;
|
|
11007
11137
|
//只有最后一条回答,支持发送点赞或踩
|
|
11008
11138
|
if (!item.upvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
11009
|
-
console.log("判断是AI还是智能问答", item);
|
|
11139
|
+
// console.log("判断是AI还是智能问答", item);
|
|
11010
11140
|
if (!item.extraInfo && item.sender == "AI") {
|
|
11011
11141
|
aiSendQuestions(1, {
|
|
11012
11142
|
roomId: roomId,
|
|
@@ -11016,7 +11146,7 @@ var CustomerService = function(props) {
|
|
|
11016
11146
|
generateUpvoteOrDownvoteMessage: true
|
|
11017
11147
|
}, 1);
|
|
11018
11148
|
} else {
|
|
11019
|
-
console.log("AI回答2255555");
|
|
11149
|
+
// console.log("AI回答2255555");
|
|
11020
11150
|
sendGreetingMessage(2);
|
|
11021
11151
|
}
|
|
11022
11152
|
}
|
|
@@ -11030,10 +11160,10 @@ var CustomerService = function(props) {
|
|
|
11030
11160
|
//老师的聊天窗口中不需要点赞和踩消息
|
|
11031
11161
|
if (!isAiChatWindow) return;
|
|
11032
11162
|
//只有最后一条回答,支持发送点赞或踩
|
|
11033
|
-
console.log(item, "dlfkvmdflkv");
|
|
11163
|
+
// console.log(item, "dlfkvmdflkv");
|
|
11034
11164
|
if (!item.downvoted && (historyMessageList.length == i + 1 || historyMessageList.length - 2 == i)) {
|
|
11035
11165
|
if (!item.extraInfo && item.sender == "AI") {
|
|
11036
|
-
console.log("AI回答2222");
|
|
11166
|
+
// console.log("AI回答2222");
|
|
11037
11167
|
//AI回答
|
|
11038
11168
|
aiSendQuestions(1, {
|
|
11039
11169
|
roomId: roomId,
|
|
@@ -11211,7 +11341,8 @@ var CustomerService = function(props) {
|
|
|
11211
11341
|
},
|
|
11212
11342
|
children: [
|
|
11213
11343
|
/*#__PURE__*/ jsx(CustomWenhaoRound$1, {}),
|
|
11214
|
-
"总结图片内容
|
|
11344
|
+
"总结图片内容",
|
|
11345
|
+
" "
|
|
11215
11346
|
]
|
|
11216
11347
|
})
|
|
11217
11348
|
]
|
|
@@ -11261,6 +11392,7 @@ var CustomerService = function(props) {
|
|
|
11261
11392
|
if (contactsList.length > 0 && contactsList[0].roomId != roomId) {
|
|
11262
11393
|
sendToTeacher(2);
|
|
11263
11394
|
} else {
|
|
11395
|
+
finishedRef.current = false;
|
|
11264
11396
|
setFinished(false);
|
|
11265
11397
|
setQuestionsList([]);
|
|
11266
11398
|
sendMessage("", 0);
|