bhd-components 0.9.12 → 0.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.esm.es5.development.js +536 -427
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +2 -2
- package/dist/vendor.esm.es5.production.js +2 -2
- package/es2017/customerService/function.js +2 -1
- package/es2017/customerService/historyFun.js +168 -159
- package/es2017/customerService/index.js +61 -31
- package/esm/customerService/function.js +2 -1
- package/esm/customerService/historyFun.js +174 -165
- package/esm/customerService/index.js +341 -266
- 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 Icon, E as ExclamationCircleFilled, i as _to_consumable_array, P as Pagination$1, 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, L as LeftOutlined, R as RightOutlined, u as MinusOutlined, v as PlusOutlined, w as __generator, x as Input, y as SearchOutlined, B as CloseOutlined, X,
|
|
2
|
-
export {
|
|
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 Icon, E as ExclamationCircleFilled, i as _to_consumable_array, P as Pagination$1, 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, L as LeftOutlined, R as RightOutlined, u as MinusOutlined, v as PlusOutlined, w as __generator, x as Input, y as SearchOutlined, B as Spin, D as CloseOutlined, X, F as I, H, G as html2canvas$1, J as Remarkable, K as Drawer, N as HighlightJS, Z as ZoomInOutlined, O as DatePicker, Q as Button } from './vendor.esm.es5.development.js';
|
|
2
|
+
export { U as Affix, V as Alert, W as Anchor, a as AntdMessage, A as App, Y as AutoComplete, $ as Avatar, a1 as BackTop, a2 as Badge, a3 as Breadcrumb, Q as Button, a4 as Calendar, a5 as Card, a6 as Carousel, a7 as Cascader, a8 as Checkbox, a9 as Col, aa as Collapse, O as DatePicker, ab as Descriptions, ac as Divider, K as Drawer, ad as Dropdown, ae as Empty, a0 as FloatButton, af as Form, ag as Grid, ah as Image, x as Input, ai as InputNumber, aj as Layout, ak as List, al as Mentions, am as Menu, M as Modal, an as Popconfirm, ao as Popover, ap as Progress, aN as QRCode, aq as Radio, ar as Rate, as as Result, at as Row, au as Segmented, k as Select, av as Skeleton, aw as Slider, ax as Space, B as Spin, ay as Statistic, az as Steps, aA as Switch, aB as Tabs, aC as Tag, aE as TimePicker, aF as Timeline, T as Tooltip, aG as Tour, aH as Transfer, aI as Tree, aJ as TreeSelect, aK as Typography, aL as Upload, aM as Watermark, aP as en_US, b as notification, aD as theme, aO 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 } from 'react';
|
|
5
5
|
import { Fragment } from 'react/jsx-runtime';
|
|
@@ -2665,15 +2665,41 @@ var formatDate = function(dateStr) {
|
|
|
2665
2665
|
return date.toLocaleDateString("zh-CN");
|
|
2666
2666
|
}
|
|
2667
2667
|
};
|
|
2668
|
+
var urlToBase64 = function(url) {
|
|
2669
|
+
return new Promise(function(resolve) {
|
|
2670
|
+
var image = new Image();
|
|
2671
|
+
// 先设置图片跨域属性
|
|
2672
|
+
// image.crossOrigin = 'Anonymous'
|
|
2673
|
+
image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
|
|
2674
|
+
// 再给image赋值src属性,先后顺序不能颠倒
|
|
2675
|
+
image.src = url;
|
|
2676
|
+
image.onload = function() {
|
|
2677
|
+
var canvas = document.createElement("CANVAS");
|
|
2678
|
+
// 设置canvas宽高等于图片实际宽高
|
|
2679
|
+
canvas.width = image.width;
|
|
2680
|
+
canvas.height = image.height;
|
|
2681
|
+
canvas.getContext("2d").drawImage(image, 0, 0);
|
|
2682
|
+
// toDataUrl可以接收2个参数,参数一:图片类型,参数二: 图片质量0-1(不传默认为0.92)
|
|
2683
|
+
var dataURL = canvas.toDataURL("image/jpeg");
|
|
2684
|
+
resolve(dataURL);
|
|
2685
|
+
};
|
|
2686
|
+
image.onerror = function() {
|
|
2687
|
+
resolve({
|
|
2688
|
+
message: "相片处理失败"
|
|
2689
|
+
});
|
|
2690
|
+
};
|
|
2691
|
+
});
|
|
2692
|
+
};
|
|
2668
2693
|
|
|
2669
2694
|
var HistoryFun = function(props) {
|
|
2670
2695
|
var type = props.type; props.roomId; var userData = props.userData, http = props.http, urllocation = props.urllocation, onClose = props.onClose, loadSpecifiedData = props.loadSpecifiedData;
|
|
2671
|
-
var _useState = _sliced_to_array(useState(
|
|
2672
|
-
var _useState1 = _sliced_to_array(useState(
|
|
2673
|
-
var _useState2 = _sliced_to_array(useState(1), 2),
|
|
2674
|
-
var _useState3 = _sliced_to_array(useState(
|
|
2675
|
-
var _useState4 = _sliced_to_array(useState(
|
|
2676
|
-
var _useState5 = _sliced_to_array(useState(
|
|
2696
|
+
var _useState = _sliced_to_array(useState(false), 2), loading = _useState[0], setLoading = _useState[1];
|
|
2697
|
+
var _useState1 = _sliced_to_array(useState(""), 2), keyWordProblem = _useState1[0], setKeyWordProblem = _useState1[1]; //搜索内容
|
|
2698
|
+
var _useState2 = _sliced_to_array(useState(1), 2), showLoadingState = _useState2[0], setShowLoadingState = _useState2[1]; //1,初始状态,2、无数据 ,3、不显示图片
|
|
2699
|
+
var _useState3 = _sliced_to_array(useState(1), 2), pageNum = _useState3[0], setPageNum = _useState3[1];
|
|
2700
|
+
var _useState4 = _sliced_to_array(useState(0), 2), pageCount = _useState4[0], setPageCount = _useState4[1];
|
|
2701
|
+
var _useState5 = _sliced_to_array(useState(10), 2), maxPageSize = _useState5[0]; _useState5[1];
|
|
2702
|
+
var _useState6 = _sliced_to_array(useState([]), 2), totalData = _useState6[0], setTotalData = _useState6[1]; //总数据
|
|
2677
2703
|
var timer = useRef(null); //文本框输入时
|
|
2678
2704
|
useEffect(function() {
|
|
2679
2705
|
function handleScroll() {
|
|
@@ -2706,6 +2732,7 @@ var HistoryFun = function(props) {
|
|
|
2706
2732
|
pageNum
|
|
2707
2733
|
]);
|
|
2708
2734
|
var getList = function(val, pageNum) {
|
|
2735
|
+
setLoading(true);
|
|
2709
2736
|
return http.get("".concat(urllocation, "/chat-service/public/v1.0/history-messages-total"), {
|
|
2710
2737
|
params: {
|
|
2711
2738
|
message: val,
|
|
@@ -2713,6 +2740,7 @@ var HistoryFun = function(props) {
|
|
|
2713
2740
|
maxPageSize: maxPageSize
|
|
2714
2741
|
}
|
|
2715
2742
|
}).then(function(res) {
|
|
2743
|
+
setLoading(false);
|
|
2716
2744
|
var data = res.data;
|
|
2717
2745
|
if (data.total > 0) {
|
|
2718
2746
|
setShowLoadingState(3);
|
|
@@ -2727,7 +2755,9 @@ var HistoryFun = function(props) {
|
|
|
2727
2755
|
} else {
|
|
2728
2756
|
setShowLoadingState(2);
|
|
2729
2757
|
}
|
|
2730
|
-
}).catch(function(res) {
|
|
2758
|
+
}).catch(function(res) {
|
|
2759
|
+
setLoading(false);
|
|
2760
|
+
});
|
|
2731
2761
|
};
|
|
2732
2762
|
//获取全部数据
|
|
2733
2763
|
var allData = function(roomId) {
|
|
@@ -2978,181 +3008,185 @@ var HistoryFun = function(props) {
|
|
|
2978
3008
|
})
|
|
2979
3009
|
]
|
|
2980
3010
|
}),
|
|
2981
|
-
/*#__PURE__*/
|
|
3011
|
+
/*#__PURE__*/ jsx("div", {
|
|
2982
3012
|
className: modules_63b47c51$1.main_list,
|
|
2983
3013
|
id: "history_list",
|
|
2984
|
-
children:
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
var
|
|
3014
|
-
var
|
|
3015
|
-
if (
|
|
3016
|
-
message = message
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
}
|
|
3014
|
+
children: /*#__PURE__*/ jsxs(Spin, {
|
|
3015
|
+
spinning: loading,
|
|
3016
|
+
tip: "加载中...",
|
|
3017
|
+
children: [
|
|
3018
|
+
showLoadingState == 1 && /*#__PURE__*/ jsxs("div", {
|
|
3019
|
+
className: modules_63b47c51$1.no_data,
|
|
3020
|
+
children: [
|
|
3021
|
+
/*#__PURE__*/ jsx("img", {
|
|
3022
|
+
src: "/new_yun/images/aiService/search_for_icon.png"
|
|
3023
|
+
}),
|
|
3024
|
+
/*#__PURE__*/ jsx("p", {
|
|
3025
|
+
children: "输入关键词,搜索聊天记录"
|
|
3026
|
+
})
|
|
3027
|
+
]
|
|
3028
|
+
}),
|
|
3029
|
+
showLoadingState == 2 && /*#__PURE__*/ jsxs("div", {
|
|
3030
|
+
className: modules_63b47c51$1.no_data,
|
|
3031
|
+
children: [
|
|
3032
|
+
/*#__PURE__*/ jsx("img", {
|
|
3033
|
+
src: "/new_yun/images/aiService/no_data.png"
|
|
3034
|
+
}),
|
|
3035
|
+
/*#__PURE__*/ jsx("p", {
|
|
3036
|
+
children: "暂无记录"
|
|
3037
|
+
})
|
|
3038
|
+
]
|
|
3039
|
+
}),
|
|
3040
|
+
/*#__PURE__*/ jsx("div", {
|
|
3041
|
+
className: modules_63b47c51$1.list_item,
|
|
3042
|
+
children: totalData.map(function(item) {
|
|
3043
|
+
var span = "";
|
|
3044
|
+
var time = "";
|
|
3045
|
+
if (item.count == 1) {
|
|
3046
|
+
var message = item.message;
|
|
3047
|
+
var position_i = message.indexOf(keyWordProblem);
|
|
3048
|
+
if (position_i > 30) {
|
|
3049
|
+
message = message.substring(position_i - 15);
|
|
3050
|
+
}
|
|
3051
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
3052
|
+
//搜索内容是否有特殊字符
|
|
3053
|
+
if (reg.test(keyWordProblem)) {
|
|
3054
|
+
span = message.replaceAll(keyWordProblem, function(e) {
|
|
3055
|
+
return "<span class=".concat(modules_63b47c51$1.sign, ">").concat(e, "</span>");
|
|
3056
|
+
});
|
|
3057
|
+
} else {
|
|
3058
|
+
span = message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
3059
|
+
return "<span class=".concat(modules_63b47c51$1.sign, ">").concat(i, "</span>");
|
|
3060
|
+
});
|
|
3061
|
+
}
|
|
3062
|
+
time = formatDate(item.createdAt);
|
|
3028
3063
|
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
if (item.count == 1) {
|
|
3038
|
-
calculationData(item.roomId, item.id, item.member);
|
|
3039
|
-
} else {
|
|
3040
|
-
showDetails(item.roomId, item.show);
|
|
3041
|
-
}
|
|
3042
|
-
},
|
|
3043
|
-
children: [
|
|
3044
|
-
/*#__PURE__*/ jsx("div", {
|
|
3045
|
-
className: modules_63b47c51$1.head_img,
|
|
3046
|
-
children: item.member == "AI" ? /*#__PURE__*/ jsx(CustomAiIcon$1, {}) : /*#__PURE__*/ jsx("img", {
|
|
3047
|
-
src: item.headImg
|
|
3048
|
-
})
|
|
3049
|
-
}),
|
|
3050
|
-
/*#__PURE__*/ jsxs("div", {
|
|
3051
|
-
className: modules_63b47c51$1.list_desc,
|
|
3052
|
-
children: [
|
|
3053
|
-
/*#__PURE__*/ jsxs("p", {
|
|
3054
|
-
className: modules_63b47c51$1.name,
|
|
3055
|
-
children: [
|
|
3056
|
-
item.member == "AI" ? "AI助手" : item.name,
|
|
3057
|
-
item.count == 1 ? /*#__PURE__*/ jsx("span", {
|
|
3058
|
-
className: modules_63b47c51$1.time,
|
|
3059
|
-
children: time
|
|
3060
|
-
}) : ""
|
|
3061
|
-
]
|
|
3062
|
-
}),
|
|
3063
|
-
item.count == 1 ? /*#__PURE__*/ jsx("p", {
|
|
3064
|
-
className: modules_63b47c51$1.decs,
|
|
3065
|
-
style: {
|
|
3066
|
-
width: "calc(100% - 36px)"
|
|
3067
|
-
},
|
|
3068
|
-
dangerouslySetInnerHTML: {
|
|
3069
|
-
__html: span
|
|
3070
|
-
}
|
|
3071
|
-
}) : /*#__PURE__*/ jsx("p", {
|
|
3072
|
-
className: modules_63b47c51$1.decs,
|
|
3073
|
-
children: "".concat(item.count, "条相关聊天记录")
|
|
3074
|
-
})
|
|
3075
|
-
]
|
|
3076
|
-
}),
|
|
3077
|
-
item.count != 1 ? /*#__PURE__*/ jsx("div", {
|
|
3078
|
-
className: "".concat(modules_63b47c51$1.open, " ").concat(item.show ? modules_63b47c51$1.active : ""),
|
|
3079
|
-
children: /*#__PURE__*/ jsx(CustomExpand$1, {})
|
|
3080
|
-
}) : ""
|
|
3081
|
-
]
|
|
3082
|
-
}),
|
|
3083
|
-
/*#__PURE__*/ jsxs("div", {
|
|
3084
|
-
className: modules_63b47c51$1.list_detail,
|
|
3085
|
-
children: [
|
|
3086
|
-
item.show && item.detailsList && item.detailsList.map(function(list) {
|
|
3087
|
-
// console.log(list,item,'dklfvmdflkvmdfklv')
|
|
3088
|
-
var name = "";
|
|
3089
|
-
if (list.sender == "AI") {
|
|
3090
|
-
name = "AI助手";
|
|
3091
|
-
} else if (list.sender == item.member) {
|
|
3092
|
-
name = item.name;
|
|
3093
|
-
} else {
|
|
3094
|
-
name = userData.real_name;
|
|
3095
|
-
}
|
|
3096
|
-
var time = formatDate(list.updatedAt);
|
|
3097
|
-
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
3098
|
-
var span = "";
|
|
3099
|
-
var message = list.message;
|
|
3100
|
-
var position_i = message.indexOf(keyWordProblem);
|
|
3101
|
-
if (position_i > 30) {
|
|
3102
|
-
message = message.substring(position_i - 15);
|
|
3103
|
-
}
|
|
3104
|
-
//搜索内容是否有特殊字符
|
|
3105
|
-
if (reg.test(keyWordProblem)) {
|
|
3106
|
-
span = message.replaceAll(keyWordProblem, function(e) {
|
|
3107
|
-
return "<span class=".concat(modules_63b47c51$1.sign, ">").concat(e, "</span>");
|
|
3108
|
-
});
|
|
3064
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
3065
|
+
children: [
|
|
3066
|
+
/*#__PURE__*/ jsxs("div", {
|
|
3067
|
+
className: "".concat(modules_63b47c51$1.list_summary, " ").concat(item.show ? modules_63b47c51$1.list_summary_active : ""),
|
|
3068
|
+
id: item.roomId,
|
|
3069
|
+
onClick: function() {
|
|
3070
|
+
if (item.count == 1) {
|
|
3071
|
+
calculationData(item.roomId, item.id, item.member);
|
|
3109
3072
|
} else {
|
|
3110
|
-
|
|
3111
|
-
// console.log(i,'skdcnsdjk')
|
|
3112
|
-
return "<span class=".concat(modules_63b47c51$1.sign, ">").concat(i, "</span>");
|
|
3113
|
-
});
|
|
3073
|
+
showDetails(item.roomId, item.show);
|
|
3114
3074
|
}
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
},
|
|
3075
|
+
},
|
|
3076
|
+
children: [
|
|
3077
|
+
/*#__PURE__*/ jsx("div", {
|
|
3078
|
+
className: modules_63b47c51$1.head_img,
|
|
3079
|
+
children: item.member == "AI" ? /*#__PURE__*/ jsx(CustomAiIcon$1, {}) : /*#__PURE__*/ jsx("img", {
|
|
3080
|
+
src: item.headImg
|
|
3081
|
+
})
|
|
3082
|
+
}),
|
|
3083
|
+
/*#__PURE__*/ jsxs("div", {
|
|
3084
|
+
className: modules_63b47c51$1.list_desc,
|
|
3120
3085
|
children: [
|
|
3121
|
-
/*#__PURE__*/ jsxs("
|
|
3086
|
+
/*#__PURE__*/ jsxs("p", {
|
|
3122
3087
|
className: modules_63b47c51$1.name,
|
|
3123
3088
|
children: [
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
}),
|
|
3127
|
-
/*#__PURE__*/ jsx("span", {
|
|
3089
|
+
item.member == "AI" ? "AI助手" : item.name,
|
|
3090
|
+
item.count == 1 ? /*#__PURE__*/ jsx("span", {
|
|
3128
3091
|
className: modules_63b47c51$1.time,
|
|
3129
3092
|
children: time
|
|
3130
|
-
})
|
|
3093
|
+
}) : ""
|
|
3131
3094
|
]
|
|
3132
3095
|
}),
|
|
3133
|
-
/*#__PURE__*/ jsx("
|
|
3134
|
-
className: modules_63b47c51$1.
|
|
3096
|
+
item.count == 1 ? /*#__PURE__*/ jsx("p", {
|
|
3097
|
+
className: modules_63b47c51$1.decs,
|
|
3098
|
+
style: {
|
|
3099
|
+
width: "calc(100% - 36px)"
|
|
3100
|
+
},
|
|
3135
3101
|
dangerouslySetInnerHTML: {
|
|
3136
3102
|
__html: span
|
|
3137
3103
|
}
|
|
3104
|
+
}) : /*#__PURE__*/ jsx("p", {
|
|
3105
|
+
className: modules_63b47c51$1.decs,
|
|
3106
|
+
children: "".concat(item.count, "条相关聊天记录")
|
|
3138
3107
|
})
|
|
3139
3108
|
]
|
|
3140
|
-
},
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3109
|
+
}),
|
|
3110
|
+
item.count != 1 ? /*#__PURE__*/ jsx("div", {
|
|
3111
|
+
className: "".concat(modules_63b47c51$1.open, " ").concat(item.show ? modules_63b47c51$1.active : ""),
|
|
3112
|
+
children: /*#__PURE__*/ jsx(CustomExpand$1, {})
|
|
3113
|
+
}) : ""
|
|
3114
|
+
]
|
|
3115
|
+
}),
|
|
3116
|
+
/*#__PURE__*/ jsxs("div", {
|
|
3117
|
+
className: modules_63b47c51$1.list_detail,
|
|
3118
|
+
children: [
|
|
3119
|
+
item.show && item.detailsList && item.detailsList.map(function(list) {
|
|
3120
|
+
// console.log(list,item,'dklfvmdflkvmdfklv')
|
|
3121
|
+
var name = "";
|
|
3122
|
+
if (list.sender == "AI") {
|
|
3123
|
+
name = "AI助手";
|
|
3124
|
+
} else if (list.sender == item.member) {
|
|
3125
|
+
name = item.name;
|
|
3126
|
+
} else {
|
|
3127
|
+
name = userData.real_name;
|
|
3128
|
+
}
|
|
3129
|
+
var time = formatDate(list.updatedAt);
|
|
3130
|
+
var reg = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
|
|
3131
|
+
var span = "";
|
|
3132
|
+
var message = list.message;
|
|
3133
|
+
var position_i = message.indexOf(keyWordProblem);
|
|
3134
|
+
if (position_i > 30) {
|
|
3135
|
+
message = message.substring(position_i - 15);
|
|
3136
|
+
}
|
|
3137
|
+
//搜索内容是否有特殊字符
|
|
3138
|
+
if (reg.test(keyWordProblem)) {
|
|
3139
|
+
span = message.replaceAll(keyWordProblem, function(e) {
|
|
3140
|
+
return "<span class=".concat(modules_63b47c51$1.sign, ">").concat(e, "</span>");
|
|
3141
|
+
});
|
|
3142
|
+
} else {
|
|
3143
|
+
span = message.replaceAll(new RegExp(keyWordProblem, "ig"), function(i) {
|
|
3144
|
+
// console.log(i,'skdcnsdjk')
|
|
3145
|
+
return "<span class=".concat(modules_63b47c51$1.sign, ">").concat(i, "</span>");
|
|
3146
|
+
});
|
|
3147
|
+
}
|
|
3148
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
3149
|
+
className: modules_63b47c51$1.list,
|
|
3150
|
+
onClick: function() {
|
|
3151
|
+
calculationData(item.roomId, list.id, list.receiver);
|
|
3152
|
+
},
|
|
3153
|
+
children: [
|
|
3154
|
+
/*#__PURE__*/ jsxs("div", {
|
|
3155
|
+
className: modules_63b47c51$1.name,
|
|
3156
|
+
children: [
|
|
3157
|
+
/*#__PURE__*/ jsx("p", {
|
|
3158
|
+
children: name
|
|
3159
|
+
}),
|
|
3160
|
+
/*#__PURE__*/ jsx("span", {
|
|
3161
|
+
className: modules_63b47c51$1.time,
|
|
3162
|
+
children: time
|
|
3163
|
+
})
|
|
3164
|
+
]
|
|
3165
|
+
}),
|
|
3166
|
+
/*#__PURE__*/ jsx("div", {
|
|
3167
|
+
className: modules_63b47c51$1.con,
|
|
3168
|
+
dangerouslySetInnerHTML: {
|
|
3169
|
+
__html: span
|
|
3170
|
+
}
|
|
3171
|
+
})
|
|
3172
|
+
]
|
|
3173
|
+
}, list.id);
|
|
3174
|
+
}),
|
|
3175
|
+
item.show && item.pageCount > 1 && item.pageCount > item.pageNum && /*#__PURE__*/ jsx("div", {
|
|
3176
|
+
className: "".concat(modules_63b47c51$1.list, " ").concat(modules_63b47c51$1.list_more),
|
|
3177
|
+
onClick: function() {
|
|
3178
|
+
loadMore(item.pageNum + 1, item.roomId);
|
|
3179
|
+
},
|
|
3180
|
+
children: "点击加载更多"
|
|
3181
|
+
})
|
|
3182
|
+
]
|
|
3183
|
+
})
|
|
3184
|
+
]
|
|
3185
|
+
});
|
|
3186
|
+
})
|
|
3153
3187
|
})
|
|
3154
|
-
|
|
3155
|
-
|
|
3188
|
+
]
|
|
3189
|
+
})
|
|
3156
3190
|
})
|
|
3157
3191
|
]
|
|
3158
3192
|
})
|
|
@@ -7866,7 +7900,7 @@ var ScreenShot = /*#__PURE__*/ function() {
|
|
|
7866
7900
|
|
|
7867
7901
|
var styles = modules_63b47c51$1;
|
|
7868
7902
|
var TextArea = Input.TextArea;
|
|
7869
|
-
/*
|
|
7903
|
+
/*
|
|
7870
7904
|
自定义remarkable的text解析规则
|
|
7871
7905
|
*/ var HTML_ESCAPE_TEST_RE = /[&<>"]/;
|
|
7872
7906
|
var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
|
|
@@ -7904,6 +7938,7 @@ var CustomerService = function(props) {
|
|
|
7904
7938
|
var _useState11 = _sliced_to_array(useState(false), 2), loading = _useState11[0], setLoading = _useState11[1]; //上拉显示加载图标
|
|
7905
7939
|
var _useState12 = _sliced_to_array(useState(false), 2), bottomLoading = _useState12[0], setBottomLoading = _useState12[1]; //下拉显示加载图标
|
|
7906
7940
|
var _useState13 = _sliced_to_array(useState(true), 2), finished = _useState13[0], setFinished = _useState13[1]; //是否结束生成
|
|
7941
|
+
var finishedRef = useRef(true); //是否结束生成
|
|
7907
7942
|
var _useState14 = _sliced_to_array(useState(""), 2), lastId = _useState14[0], setLastId = _useState14[1]; //最后一条数据的id,可用于定位当前位置
|
|
7908
7943
|
var _useState15 = _sliced_to_array(useState({}), 2), chatWith = _useState15[0], setChatWith = _useState15[1]; //聊天的老师id或ai
|
|
7909
7944
|
var _useState16 = _sliced_to_array(useState(false), 2), firstLoad = _useState16[0], setFirstLoad = _useState16[1]; //第一次切换全屏时滚动到页面底部
|
|
@@ -8163,12 +8198,13 @@ var CustomerService = function(props) {
|
|
|
8163
8198
|
}, 1000);
|
|
8164
8199
|
}
|
|
8165
8200
|
//生成答案过程中
|
|
8166
|
-
if (!finished &&
|
|
8201
|
+
if (!finished && scrollHeight > scrollTop) {
|
|
8202
|
+
console.log("生成答案过程中", scrollTopHei.current, scrollTop);
|
|
8167
8203
|
// setIsPosition(false);
|
|
8168
8204
|
isPosition.current = false;
|
|
8169
8205
|
}
|
|
8170
8206
|
if (!finished && clientHeight + scrollTop >= scrollHeight) {
|
|
8171
|
-
|
|
8207
|
+
console.log("到顶了111", clientHeight, scrollTop, scrollHeight);
|
|
8172
8208
|
isPosition.current = true;
|
|
8173
8209
|
}
|
|
8174
8210
|
scrollTopHei.current = scrollTop;
|
|
@@ -8559,217 +8595,256 @@ var CustomerService = function(props) {
|
|
|
8559
8595
|
});
|
|
8560
8596
|
};
|
|
8561
8597
|
//消息发送给老师type == 1,召唤老师时发送,type == 2,在老师聊天窗口聊天
|
|
8562
|
-
var sendToTeacher = function(
|
|
8563
|
-
var
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
recevier: chatWith.uid,
|
|
8571
|
-
message: problem.question
|
|
8572
|
-
};
|
|
8573
|
-
if (problem.url) {
|
|
8574
|
-
obj.image = problem.url;
|
|
8575
|
-
}
|
|
8576
|
-
setProblem({});
|
|
8577
|
-
} else if (type == 2 || type == 3) {
|
|
8578
|
-
var list = contactsList.filter(function(item) {
|
|
8579
|
-
return item.roomId == roomId;
|
|
8580
|
-
});
|
|
8581
|
-
var recevier = "";
|
|
8582
|
-
if (list.length > 0) {
|
|
8583
|
-
recevier = list[0].sender;
|
|
8584
|
-
}
|
|
8585
|
-
obj = {
|
|
8586
|
-
roomId: roomId,
|
|
8587
|
-
sender: mid,
|
|
8588
|
-
recevier: recevier,
|
|
8589
|
-
message: type == 2 ? keyWord : message,
|
|
8590
|
-
quotedMessage: citationContent.content || ""
|
|
8591
|
-
};
|
|
8592
|
-
if (citationContent.imageUrl) {
|
|
8593
|
-
obj.image = citationContent.imageUrl;
|
|
8594
|
-
}
|
|
8595
|
-
if (screenshotBese64) {
|
|
8596
|
-
obj.image = screenshotBese64;
|
|
8597
|
-
setScreenshotBese64("");
|
|
8598
|
-
}
|
|
8599
|
-
}
|
|
8600
|
-
http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
|
|
8601
|
-
if (res.data.id) {
|
|
8602
|
-
// console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
|
|
8603
|
-
if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
|
|
8604
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
8605
|
-
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
8606
|
-
id: res.data.id,
|
|
8607
|
-
upvoted: false,
|
|
8608
|
-
downvoted: false,
|
|
8609
|
-
createdAt: getDataTime(-1),
|
|
8610
|
-
extraInfo: obj.image ? JSON.stringify([
|
|
8611
|
-
{
|
|
8612
|
-
key: "imageUrl",
|
|
8613
|
-
value: obj.image
|
|
8614
|
-
}
|
|
8615
|
-
]) : null
|
|
8616
|
-
}));
|
|
8617
|
-
return newHistoryMessageList;
|
|
8618
|
-
});
|
|
8619
|
-
// console.log(lastId,'消息发送给老师111');
|
|
8620
|
-
scrollToBottom();
|
|
8621
|
-
}
|
|
8622
|
-
//判断当前窗口是否是
|
|
8598
|
+
var sendToTeacher = function() {
|
|
8599
|
+
var _ref = _async_to_generator(function(type) {
|
|
8600
|
+
var message, obj, list, recevier;
|
|
8601
|
+
var _arguments = arguments;
|
|
8602
|
+
return __generator(this, function(_state) {
|
|
8603
|
+
message = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : "";
|
|
8604
|
+
console.log("消息发送给老师111");
|
|
8605
|
+
obj = {};
|
|
8623
8606
|
if (type == 1) {
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8607
|
+
obj = {
|
|
8608
|
+
roomId: roomId,
|
|
8609
|
+
sender: mid,
|
|
8610
|
+
recevier: chatWith.uid,
|
|
8611
|
+
message: problem.question
|
|
8612
|
+
};
|
|
8613
|
+
if (problem.url) {
|
|
8614
|
+
obj.image = problem.url;
|
|
8615
|
+
}
|
|
8616
|
+
setProblem({});
|
|
8617
|
+
} else if (type == 2 || type == 3) {
|
|
8618
|
+
list = contactsList.filter(function(item) {
|
|
8619
|
+
return item.roomId == roomId;
|
|
8635
8620
|
});
|
|
8621
|
+
recevier = "";
|
|
8622
|
+
if (list.length > 0) {
|
|
8623
|
+
recevier = list[0].sender;
|
|
8624
|
+
}
|
|
8625
|
+
obj = {
|
|
8626
|
+
roomId: roomId,
|
|
8627
|
+
sender: mid,
|
|
8628
|
+
recevier: recevier,
|
|
8629
|
+
message: type == 2 ? keyWord : message,
|
|
8630
|
+
quotedMessage: citationContent.content || ""
|
|
8631
|
+
};
|
|
8632
|
+
if (citationContent.imageUrl) {
|
|
8633
|
+
obj.image = citationContent.imageUrl;
|
|
8634
|
+
}
|
|
8635
|
+
if (screenshotBese64) {
|
|
8636
|
+
obj.image = screenshotBese64;
|
|
8637
|
+
setScreenshotBese64("");
|
|
8638
|
+
}
|
|
8636
8639
|
}
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
+
http.post("".concat(urllocation, "/chat-service/public/v1.0/chat-with-user/messages"), obj).then(function(res) {
|
|
8641
|
+
if (res.data.id) {
|
|
8642
|
+
// console.log(pageNum, pageNumHistory, lastId, "dlskskdsd4444");
|
|
8643
|
+
if (pageNum == 1 || pageNumHistory == 1 || pageNumHistory == 0) {
|
|
8644
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
8645
|
+
var newHistoryMessageList = historyMessageList.concat(_object_spread_props(_object_spread({}, obj), {
|
|
8646
|
+
id: res.data.id,
|
|
8647
|
+
upvoted: false,
|
|
8648
|
+
downvoted: false,
|
|
8649
|
+
createdAt: getDataTime(-1),
|
|
8650
|
+
extraInfo: obj.image ? JSON.stringify([
|
|
8651
|
+
{
|
|
8652
|
+
key: "imageUrl",
|
|
8653
|
+
value: obj.image
|
|
8654
|
+
}
|
|
8655
|
+
]) : null
|
|
8656
|
+
}));
|
|
8657
|
+
return newHistoryMessageList;
|
|
8658
|
+
});
|
|
8659
|
+
// console.log(lastId,'消息发送给老师111');
|
|
8660
|
+
scrollToBottom();
|
|
8661
|
+
}
|
|
8662
|
+
//判断当前窗口是否是
|
|
8663
|
+
if (type == 1) {
|
|
8664
|
+
var roomList = [
|
|
8665
|
+
{
|
|
8666
|
+
roomId: roomId,
|
|
8667
|
+
id: res.data.id
|
|
8668
|
+
}
|
|
8669
|
+
];
|
|
8670
|
+
setChatObj(function(list) {
|
|
8671
|
+
var list2 = list.filter(function(item) {
|
|
8672
|
+
return item.id != roomList[0].id;
|
|
8673
|
+
});
|
|
8674
|
+
return list2.concat(roomList);
|
|
8675
|
+
});
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
}).catch(function(err) {
|
|
8679
|
+
console.log(err);
|
|
8680
|
+
});
|
|
8681
|
+
return [
|
|
8682
|
+
2
|
|
8683
|
+
];
|
|
8684
|
+
});
|
|
8640
8685
|
});
|
|
8641
|
-
|
|
8686
|
+
return function sendToTeacher(type) {
|
|
8687
|
+
return _ref.apply(this, arguments);
|
|
8688
|
+
};
|
|
8689
|
+
}();
|
|
8642
8690
|
//发送知识库问题 item,flag == 1 是获取问候信息的答案,flag == 2 是普通消息,flag == 3 是针对视频页面点击底部推荐问题
|
|
8643
8691
|
var sendMessage = function() {
|
|
8644
8692
|
var _ref = _async_to_generator(function(item, flag) {
|
|
8645
|
-
var type, questions, sendData, obj, sendData1, imageUrl;
|
|
8693
|
+
var type, questions, sendData, obj, sendData1, imageUrl, base64;
|
|
8646
8694
|
var _arguments = arguments;
|
|
8647
8695
|
return __generator(this, function(_state) {
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
item
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8696
|
+
switch(_state.label){
|
|
8697
|
+
case 0:
|
|
8698
|
+
type = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : "";
|
|
8699
|
+
console.log(item, flag, 888888888);
|
|
8700
|
+
questions = [];
|
|
8701
|
+
if (item && flag) {
|
|
8702
|
+
questions = [
|
|
8703
|
+
item
|
|
8704
|
+
];
|
|
8705
|
+
}
|
|
8706
|
+
if (!(questions.length > 0)) return [
|
|
8707
|
+
3,
|
|
8708
|
+
1
|
|
8709
|
+
];
|
|
8710
|
+
questions = questions[0];
|
|
8711
|
+
//知识库联想的问题没有答案
|
|
8712
|
+
if (!questions.answer && userData.modules.some(function(item) {
|
|
8713
|
+
return item.short == "AIservice";
|
|
8714
|
+
})) {
|
|
8715
|
+
sendData = {
|
|
8716
|
+
//相关数据
|
|
8717
|
+
roomId: roomId,
|
|
8718
|
+
message: questions.question,
|
|
8719
|
+
quotedMessage: "",
|
|
8720
|
+
regenerate: true,
|
|
8721
|
+
generateUpvoteOrDownvoteMessage: false
|
|
8722
|
+
};
|
|
8723
|
+
if (pageNumHistory <= 1) {
|
|
8724
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
8725
|
+
var newHistoryMessageList = historyMessageList.concat({
|
|
8726
|
+
roomId: roomId,
|
|
8727
|
+
sender: mid,
|
|
8728
|
+
recevier: "AI",
|
|
8729
|
+
message: questions.question,
|
|
8730
|
+
quotedMessage: "",
|
|
8731
|
+
id: "p" + new Date().getTime(),
|
|
8732
|
+
upvoted: false,
|
|
8733
|
+
downvoted: false,
|
|
8734
|
+
createdAt: getDataTime(-1),
|
|
8735
|
+
extraInfo: JSON.stringify([])
|
|
8736
|
+
});
|
|
8737
|
+
return newHistoryMessageList;
|
|
8738
|
+
});
|
|
8739
|
+
}
|
|
8740
|
+
setFinished(false);
|
|
8741
|
+
aiSendQuestions(3, sendData, 1);
|
|
8742
|
+
return [
|
|
8743
|
+
2
|
|
8744
|
+
];
|
|
8745
|
+
}
|
|
8746
|
+
console.log(questions, "知识库内容11111");
|
|
8747
|
+
obj = {
|
|
8665
8748
|
roomId: roomId,
|
|
8749
|
+
sender: mid,
|
|
8750
|
+
recevier: "AI",
|
|
8666
8751
|
message: questions.question,
|
|
8667
|
-
|
|
8668
|
-
|
|
8752
|
+
extraInfos: [
|
|
8753
|
+
{
|
|
8754
|
+
key: "questionId",
|
|
8755
|
+
value: flag == 1 ? questions.value : questions.id
|
|
8756
|
+
}
|
|
8757
|
+
]
|
|
8758
|
+
};
|
|
8759
|
+
//发送问题 1 类型,发送问题需要的参数,问题的答案id等
|
|
8760
|
+
sendingExistingIssues(1, obj, {
|
|
8761
|
+
key: "questionId",
|
|
8762
|
+
value: flag == 1 ? questions.value : questions.id,
|
|
8763
|
+
answer: questions.answer
|
|
8764
|
+
}, type);
|
|
8765
|
+
setKeyWord("");
|
|
8766
|
+
setQuestionsList([]);
|
|
8767
|
+
setCitationContent({});
|
|
8768
|
+
return [
|
|
8769
|
+
3,
|
|
8770
|
+
5
|
|
8771
|
+
];
|
|
8772
|
+
case 1:
|
|
8773
|
+
if (!userData.modules.some(function(item) {
|
|
8774
|
+
return item.short == "AIservice";
|
|
8775
|
+
})) return [
|
|
8776
|
+
3,
|
|
8777
|
+
4
|
|
8778
|
+
];
|
|
8779
|
+
console.log("citationContent", citationContent);
|
|
8780
|
+
sendData1 = {
|
|
8781
|
+
//相关数据
|
|
8782
|
+
roomId: roomId,
|
|
8783
|
+
message: keyWord,
|
|
8784
|
+
quotedMessage: citationContent.content || "",
|
|
8785
|
+
regenerate: citationContent.content != "" ? false : true,
|
|
8669
8786
|
generateUpvoteOrDownvoteMessage: false
|
|
8670
8787
|
};
|
|
8788
|
+
imageUrl = "";
|
|
8789
|
+
if (!citationContent.imageUrl) return [
|
|
8790
|
+
3,
|
|
8791
|
+
3
|
|
8792
|
+
];
|
|
8793
|
+
return [
|
|
8794
|
+
4,
|
|
8795
|
+
urlToBase64(citationContent.imageUrl)
|
|
8796
|
+
];
|
|
8797
|
+
case 2:
|
|
8798
|
+
base64 = _state.sent();
|
|
8799
|
+
console.log("base64", base64);
|
|
8800
|
+
console.log("citationContent.imageUrl", citationContent.imageUrl);
|
|
8801
|
+
sendData1.image = base64;
|
|
8802
|
+
imageUrl = base64;
|
|
8803
|
+
_state.label = 3;
|
|
8804
|
+
case 3:
|
|
8805
|
+
if (screenshotBese64) {
|
|
8806
|
+
console.log("screenshotBese64", screenshotBese64);
|
|
8807
|
+
sendData1.image = screenshotBese64;
|
|
8808
|
+
imageUrl = screenshotBese64;
|
|
8809
|
+
}
|
|
8671
8810
|
if (pageNumHistory <= 1) {
|
|
8672
8811
|
setHistoryMessageList(function(historyMessageList) {
|
|
8673
8812
|
var newHistoryMessageList = historyMessageList.concat({
|
|
8674
8813
|
roomId: roomId,
|
|
8675
8814
|
sender: mid,
|
|
8676
8815
|
recevier: "AI",
|
|
8677
|
-
message:
|
|
8678
|
-
quotedMessage:
|
|
8816
|
+
message: keyWord,
|
|
8817
|
+
quotedMessage: citationContent.content,
|
|
8679
8818
|
id: "p" + new Date().getTime(),
|
|
8680
8819
|
upvoted: false,
|
|
8681
8820
|
downvoted: false,
|
|
8682
8821
|
createdAt: getDataTime(-1),
|
|
8683
|
-
extraInfo: JSON.stringify([
|
|
8822
|
+
extraInfo: imageUrl ? JSON.stringify([
|
|
8823
|
+
{
|
|
8824
|
+
key: "imageUrl",
|
|
8825
|
+
value: imageUrl
|
|
8826
|
+
}
|
|
8827
|
+
]) : JSON.stringify([])
|
|
8684
8828
|
});
|
|
8685
8829
|
return newHistoryMessageList;
|
|
8686
8830
|
});
|
|
8687
8831
|
}
|
|
8688
8832
|
setFinished(false);
|
|
8689
|
-
aiSendQuestions(3,
|
|
8833
|
+
aiSendQuestions(3, sendData1, 1);
|
|
8834
|
+
setScreenshotBese64("");
|
|
8835
|
+
return [
|
|
8836
|
+
3,
|
|
8837
|
+
5
|
|
8838
|
+
];
|
|
8839
|
+
case 4:
|
|
8840
|
+
//不存在AI客服
|
|
8841
|
+
sendGreetingMessage(4);
|
|
8842
|
+
_state.label = 5;
|
|
8843
|
+
case 5:
|
|
8690
8844
|
return [
|
|
8691
8845
|
2
|
|
8692
8846
|
];
|
|
8693
|
-
}
|
|
8694
|
-
console.log(questions, "知识库内容11111");
|
|
8695
|
-
obj = {
|
|
8696
|
-
roomId: roomId,
|
|
8697
|
-
sender: mid,
|
|
8698
|
-
recevier: "AI",
|
|
8699
|
-
message: questions.question,
|
|
8700
|
-
extraInfos: [
|
|
8701
|
-
{
|
|
8702
|
-
key: "questionId",
|
|
8703
|
-
value: flag == 1 ? questions.value : questions.id
|
|
8704
|
-
}
|
|
8705
|
-
]
|
|
8706
|
-
};
|
|
8707
|
-
//发送问题 1 类型,发送问题需要的参数,问题的答案id等
|
|
8708
|
-
sendingExistingIssues(1, obj, {
|
|
8709
|
-
key: "questionId",
|
|
8710
|
-
value: flag == 1 ? questions.value : questions.id,
|
|
8711
|
-
answer: questions.answer
|
|
8712
|
-
}, type);
|
|
8713
|
-
setKeyWord("");
|
|
8714
|
-
setQuestionsList([]);
|
|
8715
|
-
setCitationContent({});
|
|
8716
|
-
} else if (userData.modules.some(function(item) {
|
|
8717
|
-
return item.short == "AIservice";
|
|
8718
|
-
})) {
|
|
8719
|
-
console.log("citationContent", citationContent);
|
|
8720
|
-
sendData1 = {
|
|
8721
|
-
//相关数据
|
|
8722
|
-
roomId: roomId,
|
|
8723
|
-
message: keyWord,
|
|
8724
|
-
quotedMessage: citationContent.content || "",
|
|
8725
|
-
regenerate: citationContent.content != "" ? false : true,
|
|
8726
|
-
generateUpvoteOrDownvoteMessage: false
|
|
8727
|
-
};
|
|
8728
|
-
imageUrl = "";
|
|
8729
|
-
if (citationContent.imageUrl) {
|
|
8730
|
-
// let base64:string=await urlToBase64(citationContent.imageUrl) as string
|
|
8731
|
-
console.log("citationContent.imageUrl", citationContent.imageUrl);
|
|
8732
|
-
sendData1.image = citationContent.imageUrl;
|
|
8733
|
-
imageUrl = citationContent.imageUrl;
|
|
8734
|
-
}
|
|
8735
|
-
if (screenshotBese64) {
|
|
8736
|
-
console.log("screenshotBese64", screenshotBese64);
|
|
8737
|
-
sendData1.image = screenshotBese64;
|
|
8738
|
-
imageUrl = screenshotBese64;
|
|
8739
|
-
}
|
|
8740
|
-
if (pageNumHistory <= 1) {
|
|
8741
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
8742
|
-
var newHistoryMessageList = historyMessageList.concat({
|
|
8743
|
-
roomId: roomId,
|
|
8744
|
-
sender: mid,
|
|
8745
|
-
recevier: "AI",
|
|
8746
|
-
message: keyWord,
|
|
8747
|
-
quotedMessage: citationContent.content,
|
|
8748
|
-
id: "p" + new Date().getTime(),
|
|
8749
|
-
upvoted: false,
|
|
8750
|
-
downvoted: false,
|
|
8751
|
-
createdAt: getDataTime(-1),
|
|
8752
|
-
extraInfo: imageUrl ? JSON.stringify([
|
|
8753
|
-
{
|
|
8754
|
-
key: "imageUrl",
|
|
8755
|
-
value: imageUrl
|
|
8756
|
-
}
|
|
8757
|
-
]) : JSON.stringify([])
|
|
8758
|
-
});
|
|
8759
|
-
return newHistoryMessageList;
|
|
8760
|
-
});
|
|
8761
|
-
}
|
|
8762
|
-
setFinished(false);
|
|
8763
|
-
aiSendQuestions(3, sendData1, 1);
|
|
8764
|
-
setScreenshotBese64("");
|
|
8765
|
-
//存在AI客服
|
|
8766
|
-
} else {
|
|
8767
|
-
//不存在AI客服
|
|
8768
|
-
sendGreetingMessage(4);
|
|
8769
8847
|
}
|
|
8770
|
-
return [
|
|
8771
|
-
2
|
|
8772
|
-
];
|
|
8773
8848
|
});
|
|
8774
8849
|
});
|
|
8775
8850
|
return function sendMessage(item, flag) {
|
|
@@ -8938,67 +9013,74 @@ var CustomerService = function(props) {
|
|
|
8938
9013
|
signal: ctrl.current.signal,
|
|
8939
9014
|
openWhenHidden: true,
|
|
8940
9015
|
onopen: function(res) {
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
}
|
|
8953
|
-
if (res.status == 200) {
|
|
8954
|
-
setFinished(false);
|
|
8955
|
-
}
|
|
8956
|
-
if (res.status == 401) {
|
|
8957
|
-
//身份认证未通过,从新请求新的token后再次发送请求
|
|
8958
|
-
verifyJWT(urllocation).then(function() {
|
|
8959
|
-
console.log("重新请求");
|
|
8960
|
-
setHistoryMessageList(function(historyMessageList) {
|
|
8961
|
-
return historyMessageList.filter(function(item) {
|
|
8962
|
-
return item.id != "123456" && item.id != "654321";
|
|
9016
|
+
return _async_to_generator(function() {
|
|
9017
|
+
return __generator(this, function(_state) {
|
|
9018
|
+
console.info("eventSource open: ", res);
|
|
9019
|
+
clearTimeout(receiveMessageTimer.current);
|
|
9020
|
+
if (res.status >= 300) {
|
|
9021
|
+
console.log("sdckjsdncskdcjsdc", res.status);
|
|
9022
|
+
setFinished(true);
|
|
9023
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
9024
|
+
return historyMessageList.filter(function(item) {
|
|
9025
|
+
return item.id != "123456" && item.id != "654321";
|
|
9026
|
+
});
|
|
8963
9027
|
});
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
}
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9028
|
+
ctrl.current.abort();
|
|
9029
|
+
}
|
|
9030
|
+
if (res.status == 200) {
|
|
9031
|
+
setFinished(false);
|
|
9032
|
+
}
|
|
9033
|
+
if (res.status == 401) {
|
|
9034
|
+
//身份认证未通过,从新请求新的token后再次发送请求
|
|
9035
|
+
verifyJWT(urllocation).then(function() {
|
|
9036
|
+
console.log("重新请求");
|
|
9037
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
9038
|
+
return historyMessageList.filter(function(item) {
|
|
9039
|
+
return item.id != "123456" && item.id != "654321";
|
|
9040
|
+
});
|
|
9041
|
+
});
|
|
9042
|
+
aiSendQuestions(type, obj, id);
|
|
9043
|
+
});
|
|
9044
|
+
}
|
|
9045
|
+
if (res.status == 403) {
|
|
9046
|
+
//暂无权限
|
|
9047
|
+
console.log("暂无权限");
|
|
9048
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
9049
|
+
return historyMessageList.concat({
|
|
9050
|
+
roomId: roomId,
|
|
9051
|
+
sender: "AI",
|
|
9052
|
+
recevier: mid,
|
|
9053
|
+
message: "暂无权限",
|
|
9054
|
+
id: "123456",
|
|
9055
|
+
createdAt: "",
|
|
9056
|
+
extraInfo: null
|
|
9057
|
+
});
|
|
9058
|
+
});
|
|
9059
|
+
}
|
|
9060
|
+
if (res.status == 429) ;
|
|
9061
|
+
if (res.status == 429) {
|
|
9062
|
+
//每天问答的 Token 数必须小于等于 10 万。
|
|
9063
|
+
sendGreetingMessage(5);
|
|
9064
|
+
}
|
|
9065
|
+
if (res.status == 500) {
|
|
9066
|
+
// 系统错误,请稍后再试。
|
|
9067
|
+
setHistoryMessageList(function(historyMessageList) {
|
|
9068
|
+
return historyMessageList.concat({
|
|
9069
|
+
roomId: roomId,
|
|
9070
|
+
sender: "AI",
|
|
9071
|
+
recevier: mid,
|
|
9072
|
+
message: "系统出错了,请稍后重试!",
|
|
9073
|
+
id: "123456",
|
|
9074
|
+
createdAt: "",
|
|
9075
|
+
extraInfo: null
|
|
9076
|
+
});
|
|
9077
|
+
});
|
|
9078
|
+
}
|
|
9079
|
+
return [
|
|
9080
|
+
2
|
|
9081
|
+
];
|
|
9000
9082
|
});
|
|
9001
|
-
}
|
|
9083
|
+
})();
|
|
9002
9084
|
},
|
|
9003
9085
|
onerror: function(err) {
|
|
9004
9086
|
console.log(err, "dflkvdmfvlkdfv");
|
|
@@ -9019,31 +9101,39 @@ var CustomerService = function(props) {
|
|
|
9019
9101
|
//识别的内容
|
|
9020
9102
|
// console.log("eventSource msg: ", event.data);
|
|
9021
9103
|
var msg = JSON.parse(event.data);
|
|
9022
|
-
if (msg.message)
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9104
|
+
if (msg.message) ;
|
|
9105
|
+
setFinished(function(prevData) {
|
|
9106
|
+
finishedRef.current = false;
|
|
9107
|
+
return finishedRef.current;
|
|
9108
|
+
});
|
|
9109
|
+
console.log("返回中", msg);
|
|
9110
|
+
content = content + msg.message;
|
|
9111
|
+
// isPosition.current = true;
|
|
9112
|
+
renderAiAnswerTimer.current = setTimeout(function() {
|
|
9113
|
+
if (!finishedRef.current) {
|
|
9026
9114
|
renderAiAnswer(msg, id, type);
|
|
9027
|
-
}
|
|
9028
|
-
}
|
|
9115
|
+
}
|
|
9116
|
+
}, 100);
|
|
9029
9117
|
if (msg.finished) {
|
|
9030
|
-
|
|
9118
|
+
// console.log('返回完成',msg)
|
|
9119
|
+
// setFinished(true); //发送结束
|
|
9031
9120
|
if (!flagKeyWord) {
|
|
9032
9121
|
videoPageQuestiionsList(2);
|
|
9033
9122
|
}
|
|
9034
9123
|
// isPosition.current = true;
|
|
9035
|
-
setTimeout(
|
|
9036
|
-
|
|
9037
|
-
},
|
|
9124
|
+
// setTimeout(()=>{
|
|
9125
|
+
// isPosition.current = true;
|
|
9126
|
+
// },100)
|
|
9038
9127
|
testLabQuestion(JSON.parse(data).message, content, "");
|
|
9039
9128
|
}
|
|
9040
9129
|
},
|
|
9041
9130
|
onclose: function() {
|
|
9042
|
-
|
|
9043
|
-
//
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9131
|
+
console.log("eventSource close");
|
|
9132
|
+
// setFinished(true); //发送结束
|
|
9133
|
+
// // isPosition.current = true;
|
|
9134
|
+
// setTimeout(()=>{
|
|
9135
|
+
// isPosition.current = true;
|
|
9136
|
+
// },100)
|
|
9047
9137
|
setHistoryMessageList(function(historyMessageList) {
|
|
9048
9138
|
return historyMessageList.filter(function(item) {
|
|
9049
9139
|
return item.id != "123456";
|
|
@@ -9124,9 +9214,20 @@ var CustomerService = function(props) {
|
|
|
9124
9214
|
return newHistoryMessageList2;
|
|
9125
9215
|
}
|
|
9126
9216
|
});
|
|
9127
|
-
|
|
9128
|
-
if (
|
|
9129
|
-
container
|
|
9217
|
+
console.log("isPosition", isPosition.current);
|
|
9218
|
+
if (isPosition.current) {
|
|
9219
|
+
var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
|
|
9220
|
+
if (container) {
|
|
9221
|
+
container.scrollTop = container.scrollHeight;
|
|
9222
|
+
}
|
|
9223
|
+
}
|
|
9224
|
+
if (msg.finished) {
|
|
9225
|
+
console.log("返回完成", msg);
|
|
9226
|
+
//发送结束
|
|
9227
|
+
setFinished(function(prevData) {
|
|
9228
|
+
finishedRef.current = true;
|
|
9229
|
+
return finishedRef.current;
|
|
9230
|
+
});
|
|
9130
9231
|
}
|
|
9131
9232
|
// console.log('historyMessageList',historyMessageList)
|
|
9132
9233
|
// if(isPosition.current){
|
|
@@ -10526,7 +10627,11 @@ var CustomerService = function(props) {
|
|
|
10526
10627
|
return item.id != "123456";
|
|
10527
10628
|
});
|
|
10528
10629
|
});
|
|
10529
|
-
setFinished(true);
|
|
10630
|
+
// setFinished(true);
|
|
10631
|
+
setFinished(function(prevData) {
|
|
10632
|
+
finishedRef.current = true;
|
|
10633
|
+
return finishedRef.current;
|
|
10634
|
+
});
|
|
10530
10635
|
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
10531
10636
|
}
|
|
10532
10637
|
}),
|
|
@@ -10544,7 +10649,11 @@ var CustomerService = function(props) {
|
|
|
10544
10649
|
return item.id != "123456";
|
|
10545
10650
|
});
|
|
10546
10651
|
});
|
|
10547
|
-
setFinished(true);
|
|
10652
|
+
// setFinished(true);
|
|
10653
|
+
setFinished(function(prevData) {
|
|
10654
|
+
finishedRef.current = true;
|
|
10655
|
+
return finishedRef.current;
|
|
10656
|
+
});
|
|
10548
10657
|
onEvent(serverName + serverUrl(), "click_智能问答_停止生成", "提交");
|
|
10549
10658
|
},
|
|
10550
10659
|
children: "停止生成"
|