bhd-components 0.9.13 → 0.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.esm.es5.development.css +1093 -1087
- package/dist/index.esm.es5.development.js +236 -264
- 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 +1 -1
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/customerService/function.js +2 -1
- package/es2017/customerService/index.js +155 -162
- package/es2017/customerService/index.module.less +5 -0
- package/es2017/customerService/index2.module.less +5 -0
- package/esm/customerService/function.js +2 -1
- package/esm/customerService/index.js +233 -262
- package/esm/customerService/index.module.less +5 -0
- package/esm/customerService/index2.module.less +5 -0
- package/package.json +1 -1
|
@@ -160,7 +160,8 @@ const urlToBase64 = (url)=>{
|
|
|
160
160
|
return new Promise((resolve)=>{
|
|
161
161
|
const image = new Image();
|
|
162
162
|
// 先设置图片跨域属性
|
|
163
|
-
image.crossOrigin = 'Anonymous'
|
|
163
|
+
// image.crossOrigin = 'Anonymous'
|
|
164
|
+
image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
|
|
164
165
|
// 再给image赋值src属性,先后顺序不能颠倒
|
|
165
166
|
image.src = url;
|
|
166
167
|
image.onload = function() {
|
|
@@ -523,7 +523,7 @@ const CustomerService = (props)=>{
|
|
|
523
523
|
roomId: roomId,
|
|
524
524
|
sender: "AI",
|
|
525
525
|
recevier: mid,
|
|
526
|
-
message: `Hi
|
|
526
|
+
message: `Hi,我是智能学习助手,你遇到了什么问题?`,
|
|
527
527
|
extraInfos: questionsList == null ? null : questionsList
|
|
528
528
|
};
|
|
529
529
|
if (pageNumHistory <= 1) {
|
|
@@ -551,7 +551,7 @@ const CustomerService = (props)=>{
|
|
|
551
551
|
roomId: roomId,
|
|
552
552
|
sender: "AI",
|
|
553
553
|
recevier: mid,
|
|
554
|
-
message: `Hi
|
|
554
|
+
message: `Hi,我是智能学习助手,你遇到了什么问题?`
|
|
555
555
|
};
|
|
556
556
|
if (pageNumHistory <= 1) {
|
|
557
557
|
setHistoryMessageList((historyMessageList)=>{
|
|
@@ -743,12 +743,7 @@ const CustomerService = (props)=>{
|
|
|
743
743
|
quotedMessage: citationContent.content || ""
|
|
744
744
|
};
|
|
745
745
|
if (citationContent.imageUrl) {
|
|
746
|
-
|
|
747
|
-
// obj.image = urlToBase64(citationContent.imageUrl);
|
|
748
|
-
let base64 = await urlToBase64(citationContent.imageUrl);
|
|
749
|
-
console.log('citationContent.imageUrl', citationContent.imageUrl);
|
|
750
|
-
//imageUrl = citationContent.imageUrl;
|
|
751
|
-
obj.image = base64;
|
|
746
|
+
obj.image = citationContent.imageUrl;
|
|
752
747
|
}
|
|
753
748
|
if (screenshotBese64) {
|
|
754
749
|
obj.image = screenshotBese64;
|
|
@@ -874,9 +869,9 @@ const CustomerService = (props)=>{
|
|
|
874
869
|
let imageUrl = '';
|
|
875
870
|
if (citationContent.imageUrl) {
|
|
876
871
|
let base64 = await urlToBase64(citationContent.imageUrl);
|
|
872
|
+
console.log('base64', base64);
|
|
877
873
|
console.log('citationContent.imageUrl', citationContent.imageUrl);
|
|
878
|
-
sendData.image =
|
|
879
|
-
//imageUrl = citationContent.imageUrl;
|
|
874
|
+
sendData.image = base64;
|
|
880
875
|
imageUrl = base64;
|
|
881
876
|
}
|
|
882
877
|
if (screenshotBese64) {
|
|
@@ -2325,171 +2320,169 @@ const CustomerService = (props)=>{
|
|
|
2325
2320
|
}),
|
|
2326
2321
|
/*#__PURE__*/ _jsx("div", {
|
|
2327
2322
|
className: styles.main,
|
|
2328
|
-
children: /*#__PURE__*/
|
|
2323
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
2329
2324
|
className: styles.main_content,
|
|
2330
|
-
children:
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2325
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
2326
|
+
className: styles.main_content_flag,
|
|
2327
|
+
onMouseEnter: ()=>{
|
|
2328
|
+
const dom = document.getElementById(item.id);
|
|
2329
|
+
if (dom) {
|
|
2330
|
+
const con_h = document.getElementById('chat_content').clientHeight - 24; //滚动区域的高度
|
|
2331
|
+
const rectY = dom.getBoundingClientRect().y - 48;
|
|
2332
|
+
const h = dom.clientHeight + 24; //当前元素高度
|
|
2333
|
+
const topDom = dom.getElementsByClassName('operate_modal_showtop')[0];
|
|
2334
|
+
const bottomDom = dom.getElementsByClassName('operate_modal_showbottom')[0];
|
|
2335
|
+
if (topDom && bottomDom) {
|
|
2336
|
+
console.log(h, con_h, rectY);
|
|
2337
|
+
if (rectY > 0) {
|
|
2338
|
+
topDom.style.cssText = "";
|
|
2339
|
+
bottomDom.style.cssText = "visibility: hidden;";
|
|
2340
|
+
// 上下都能显示时,显示到下边
|
|
2341
|
+
if (h < con_h - rectY) {
|
|
2342
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
2343
|
+
bottomDom.style.cssText = "";
|
|
2344
|
+
}
|
|
2345
|
+
} else {
|
|
2346
|
+
// 上下都不显示
|
|
2347
|
+
if (h > con_h && h - con_h > Math.abs(rectY)) {
|
|
2348
|
+
console.log('rerererererer');
|
|
2349
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
2350
|
+
bottomDom.style.cssText = `top:${-(h + rectY - 51)}px`;
|
|
2351
2351
|
} else {
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
console.log('rerererererer');
|
|
2355
|
-
topDom.style.cssText = "visibility: hidden;";
|
|
2356
|
-
bottomDom.style.cssText = `top:${-(h + rectY - 51)}px`;
|
|
2357
|
-
} else {
|
|
2358
|
-
topDom.style.cssText = "visibility: hidden;";
|
|
2359
|
-
bottomDom.style.cssText = "";
|
|
2360
|
-
}
|
|
2352
|
+
topDom.style.cssText = "visibility: hidden;";
|
|
2353
|
+
bottomDom.style.cssText = "";
|
|
2361
2354
|
}
|
|
2362
2355
|
}
|
|
2363
2356
|
}
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2357
|
+
}
|
|
2358
|
+
},
|
|
2359
|
+
children: [
|
|
2360
|
+
/*#__PURE__*/ _jsx("div", {
|
|
2361
|
+
className: `${styles.operate_modal} operate_modal_showtop`,
|
|
2362
|
+
children: // 不是最后一行,
|
|
2363
|
+
historyMessageList.length - 1 != i && renderOperateBtn(item, isAiChatWindow, i)
|
|
2364
|
+
}),
|
|
2365
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
2366
|
+
className: styles.content,
|
|
2367
|
+
children: [
|
|
2368
|
+
item.message != 'AI助手繁忙,请稍后再提问或' && /*#__PURE__*/ _jsx("p", {
|
|
2369
|
+
dangerouslySetInnerHTML: {
|
|
2370
|
+
__html: message
|
|
2371
|
+
},
|
|
2372
|
+
className: styles.content_child
|
|
2373
|
+
}),
|
|
2374
|
+
item.message == 'AI助手繁忙,请稍后再提问或' && /*#__PURE__*/ _jsxs("p", {
|
|
2375
|
+
children: [
|
|
2376
|
+
"AI助手繁忙,请稍后再提问或",
|
|
2377
|
+
/*#__PURE__*/ _jsx("span", {
|
|
2378
|
+
className: styles.find_teacher_con,
|
|
2379
|
+
onClick: ()=>{
|
|
2380
|
+
let extraInfo = historyMessageList[i - 1].extraInfo;
|
|
2381
|
+
let url = '';
|
|
2382
|
+
if (extraInfo && JSON.parse(extraInfo).length > 0 && JSON.parse(extraInfo)[0].key == "imageUrl" && JSON.parse(extraInfo)[0].value) {
|
|
2383
|
+
url = JSON.parse(extraInfo)[0].value;
|
|
2384
|
+
}
|
|
2385
|
+
setProblem({
|
|
2386
|
+
question: historyMessageList[i - 1].message,
|
|
2387
|
+
url
|
|
2388
|
+
});
|
|
2389
|
+
setShowTeacherList(true);
|
|
2390
|
+
},
|
|
2391
|
+
children: "召唤老师回答"
|
|
2392
|
+
})
|
|
2393
|
+
]
|
|
2394
|
+
}),
|
|
2395
|
+
!item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
2396
|
+
className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ''}`,
|
|
2397
|
+
children: [
|
|
2398
|
+
/*#__PURE__*/ _jsx("img", {
|
|
2399
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
2400
|
+
}),
|
|
2401
|
+
/*#__PURE__*/ _jsx("div", {
|
|
2402
|
+
className: styles.mask_zoom,
|
|
2403
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
2385
2404
|
onClick: ()=>{
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
url = JSON.parse(extraInfo)[0].value;
|
|
2390
|
-
}
|
|
2391
|
-
setProblem({
|
|
2392
|
-
question: historyMessageList[i - 1].message,
|
|
2393
|
-
url
|
|
2394
|
-
});
|
|
2395
|
-
setShowTeacherList(true);
|
|
2396
|
-
},
|
|
2397
|
-
children: "召唤老师回答"
|
|
2405
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
2406
|
+
setVisible(true);
|
|
2407
|
+
}
|
|
2398
2408
|
})
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
/*#__PURE__*/ _jsx("
|
|
2408
|
-
|
|
2409
|
-
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
2410
|
-
onClick: ()=>{
|
|
2411
|
-
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
2412
|
-
setVisible(true);
|
|
2413
|
-
}
|
|
2414
|
-
})
|
|
2409
|
+
})
|
|
2410
|
+
]
|
|
2411
|
+
}),
|
|
2412
|
+
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", {
|
|
2413
|
+
className: `${styles.association_problem} ${item.message == '抱歉,我暂时无法回答这样的问题。' ? styles.association_problem_flag : ''}`,
|
|
2414
|
+
children: [
|
|
2415
|
+
item.message == '抱歉,我暂时无法回答这样的问题。' && /*#__PURE__*/ _jsx("li", {
|
|
2416
|
+
className: styles.related_issues_flag,
|
|
2417
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
2418
|
+
children: "相关问题"
|
|
2415
2419
|
})
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2420
|
+
}),
|
|
2421
|
+
JSON.parse(item.extraInfo).map((list, index)=>{
|
|
2422
|
+
return /*#__PURE__*/ _jsx("li", {
|
|
2423
|
+
onClick: ()=>{
|
|
2424
|
+
sendMessage(list, 1);
|
|
2425
|
+
setBottomRecommendationQuestions([]);
|
|
2426
|
+
resettingBottomHei();
|
|
2427
|
+
},
|
|
2428
|
+
children: item.message == '抱歉,我暂时无法回答这样的问题。' ? list.question : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
2429
|
+
children: [
|
|
2430
|
+
JSON.parse(item.extraInfo).length > 1 ? index + 1 + '.' : '',
|
|
2431
|
+
list.question
|
|
2432
|
+
]
|
|
2425
2433
|
})
|
|
2426
|
-
})
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2434
|
+
}, i + "_" + index + "_" + list.value);
|
|
2435
|
+
})
|
|
2436
|
+
]
|
|
2437
|
+
}),
|
|
2438
|
+
//findTeacher//是否在召唤老师过程中,是否是最后一条消息
|
|
2439
|
+
!item.findTeacher && historyMessageList.length - 1 == i && item.id != "123456" && item.id != '123456_date' && renderLastOperateBtn(item, isAiChatWindow, i)
|
|
2440
|
+
]
|
|
2441
|
+
}),
|
|
2442
|
+
//引用消息
|
|
2443
|
+
item.quotedMessage && /*#__PURE__*/ _jsxs("div", {
|
|
2444
|
+
className: styles.citation_content,
|
|
2445
|
+
children: [
|
|
2446
|
+
getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
2447
|
+
overlayClassName: styles.popover_main_content,
|
|
2448
|
+
title: item.quotedMessage,
|
|
2449
|
+
placement: "rightTop",
|
|
2450
|
+
children: /*#__PURE__*/ _jsxs("p", {
|
|
2451
|
+
className: styles.text_exceed,
|
|
2452
|
+
children: [
|
|
2453
|
+
item.quotedMessage,
|
|
2454
|
+
/*#__PURE__*/ _jsx(RightOutlined, {})
|
|
2442
2455
|
]
|
|
2443
|
-
})
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
className: `${styles.operate_modal} ${styles.bottom} operate_modal_showbottom`,
|
|
2450
|
-
children: // 不是最后一行,
|
|
2451
|
-
renderOperateBtn(item, isAiChatWindow, i)
|
|
2452
|
-
})
|
|
2453
|
-
]
|
|
2454
|
-
}),
|
|
2455
|
-
//引用消息
|
|
2456
|
-
item.quotedMessage && /*#__PURE__*/ _jsxs("div", {
|
|
2457
|
-
className: styles.citation_content,
|
|
2458
|
-
children: [
|
|
2459
|
-
getByteLen(item.quotedMessage) > 120 ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
2460
|
-
overlayClassName: styles.popover_main_content,
|
|
2461
|
-
title: item.quotedMessage,
|
|
2462
|
-
placement: "rightTop",
|
|
2463
|
-
children: /*#__PURE__*/ _jsxs("p", {
|
|
2464
|
-
className: styles.text_exceed,
|
|
2456
|
+
})
|
|
2457
|
+
}) : /*#__PURE__*/ _jsx("p", {
|
|
2458
|
+
children: item.quotedMessage
|
|
2459
|
+
}),
|
|
2460
|
+
item.quotedMessage && item.extraInfo && JSON.parse(item.extraInfo).length > 0 && JSON.parse(item.extraInfo)[0].key == "imageUrl" && /*#__PURE__*/ _jsxs("p", {
|
|
2461
|
+
className: `${styles.img_con} ${showType == 2 || showType == 4 ? styles.img_con2 : ''}`,
|
|
2465
2462
|
children: [
|
|
2466
|
-
|
|
2467
|
-
|
|
2463
|
+
/*#__PURE__*/ _jsx("img", {
|
|
2464
|
+
src: JSON.parse(item.extraInfo)[0].value
|
|
2465
|
+
}),
|
|
2466
|
+
/*#__PURE__*/ _jsx("div", {
|
|
2467
|
+
className: styles.mask_zoom,
|
|
2468
|
+
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
2469
|
+
onClick: ()=>{
|
|
2470
|
+
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
2471
|
+
setVisible(true);
|
|
2472
|
+
}
|
|
2473
|
+
})
|
|
2474
|
+
})
|
|
2468
2475
|
]
|
|
2469
2476
|
})
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
/*#__PURE__*/ _jsx("div", {
|
|
2480
|
-
className: styles.mask_zoom,
|
|
2481
|
-
children: /*#__PURE__*/ _jsx(ZoomInOutlined, {
|
|
2482
|
-
onClick: ()=>{
|
|
2483
|
-
setViewBase64(JSON.parse(item.extraInfo)[0].value);
|
|
2484
|
-
setVisible(true);
|
|
2485
|
-
}
|
|
2486
|
-
})
|
|
2487
|
-
})
|
|
2488
|
-
]
|
|
2489
|
-
})
|
|
2490
|
-
]
|
|
2491
|
-
})
|
|
2492
|
-
]
|
|
2477
|
+
]
|
|
2478
|
+
}),
|
|
2479
|
+
historyMessageList.length - 1 !== i && /*#__PURE__*/ _jsx("div", {
|
|
2480
|
+
className: `${styles.operate_modal} ${styles.bottom} operate_modal_showbottom`,
|
|
2481
|
+
children: // 不是最后一行,
|
|
2482
|
+
renderOperateBtn(item, isAiChatWindow, i)
|
|
2483
|
+
})
|
|
2484
|
+
]
|
|
2485
|
+
})
|
|
2493
2486
|
})
|
|
2494
2487
|
})
|
|
2495
2488
|
]
|
|
@@ -164,7 +164,8 @@ var urlToBase64 = function(url) {
|
|
|
164
164
|
return new Promise(function(resolve) {
|
|
165
165
|
var image = new Image();
|
|
166
166
|
// 先设置图片跨域属性
|
|
167
|
-
image.crossOrigin =
|
|
167
|
+
// image.crossOrigin = 'Anonymous'
|
|
168
|
+
image.setAttribute("crossOrigin", "Anonymous"); // 解决控制台跨域报错的问题
|
|
168
169
|
// 再给image赋值src属性,先后顺序不能颠倒
|
|
169
170
|
image.src = url;
|
|
170
171
|
image.onload = function() {
|