whyuzeim 1.1.53 → 1.1.55
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/cjs/HighlyCustomChat/index.js +36 -20
- package/es/HighlyCustomChat/index.js +36 -20
- package/package.json +7 -3
|
@@ -425,7 +425,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
425
425
|
}, [getHeaderInfo, initConversation, props.conversationId]);
|
|
426
426
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
427
427
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text, extInfo) {
|
|
428
|
-
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
428
|
+
var txtMessage, cuiScrollList, cuiScrollListWrap, existingLoader, htmlString, template, node;
|
|
429
429
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
430
430
|
while (1) switch (_context2.prev = _context2.next) {
|
|
431
431
|
case 0:
|
|
@@ -447,19 +447,26 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
447
447
|
return agoraChatUikit.rootStore.messageStore.sendMessage(txtMessage);
|
|
448
448
|
case 6:
|
|
449
449
|
if (isAgent) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
450
|
+
try {
|
|
451
|
+
cuiScrollList = document.querySelector(".cui-scrollList div");
|
|
452
|
+
cuiScrollListWrap = document.querySelector(".cui-scrollList"); // 确保不存在现有的加载指示器,防止重复添加
|
|
453
|
+
existingLoader = document.querySelector("#agent-generating-loader");
|
|
454
|
+
if (cuiScrollList && !existingLoader) {
|
|
455
|
+
htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\"></span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
|
|
456
|
+
template = document.createElement('template');
|
|
457
|
+
template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
|
|
458
|
+
node = template.content.firstChild;
|
|
459
|
+
if (node) {
|
|
460
|
+
cuiScrollList.appendChild(node);
|
|
461
|
+
if (cuiScrollListWrap) {
|
|
462
|
+
cuiScrollListWrap.scrollTo({
|
|
463
|
+
top: 1000000000
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
462
467
|
}
|
|
468
|
+
} catch (error) {
|
|
469
|
+
console.error("Error adding generating loader:", error);
|
|
463
470
|
}
|
|
464
471
|
}
|
|
465
472
|
afterSendMsg(txtMessage, extInfo);
|
|
@@ -496,13 +503,22 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
496
503
|
};
|
|
497
504
|
}();
|
|
498
505
|
React.useEffect(function () {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
+
try {
|
|
507
|
+
var _conversationList$fin;
|
|
508
|
+
var cuiScrollList = document.querySelector(".cui-scrollList div");
|
|
509
|
+
var generatingLoader = document.querySelector("#agent-generating-loader");
|
|
510
|
+
// 确保元素存在且需要移除loader
|
|
511
|
+
if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
|
|
512
|
+
return item.conversationId === props.conversationId;
|
|
513
|
+
})) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== props.conversationId) {
|
|
514
|
+
// 使用contains方法安全地检查父子关系
|
|
515
|
+
if (cuiScrollList.contains(generatingLoader)) {
|
|
516
|
+
generatingLoader.remove(); // 更安全的移除方法
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
} catch (error) {
|
|
520
|
+
// 捕获并记录任何DOM操作错误,防止应用崩溃
|
|
521
|
+
console.error("Error handling generating loader:", error);
|
|
506
522
|
}
|
|
507
523
|
}, [conversationList, props.conversationId]);
|
|
508
524
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -423,7 +423,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
423
423
|
}, [getHeaderInfo, initConversation, props.conversationId]);
|
|
424
424
|
var handleSendMessage = /*#__PURE__*/function () {
|
|
425
425
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text, extInfo) {
|
|
426
|
-
var txtMessage, cuiScrollList, cuiScrollListWrap, htmlString, template, node;
|
|
426
|
+
var txtMessage, cuiScrollList, cuiScrollListWrap, existingLoader, htmlString, template, node;
|
|
427
427
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
428
428
|
while (1) switch (_context2.prev = _context2.next) {
|
|
429
429
|
case 0:
|
|
@@ -445,19 +445,26 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
445
445
|
return rootStore.messageStore.sendMessage(txtMessage);
|
|
446
446
|
case 6:
|
|
447
447
|
if (isAgent) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
448
|
+
try {
|
|
449
|
+
cuiScrollList = document.querySelector(".cui-scrollList div");
|
|
450
|
+
cuiScrollListWrap = document.querySelector(".cui-scrollList"); // 确保不存在现有的加载指示器,防止重复添加
|
|
451
|
+
existingLoader = document.querySelector("#agent-generating-loader");
|
|
452
|
+
if (cuiScrollList && !existingLoader) {
|
|
453
|
+
htmlString = "<div id=\"agent-generating-loader\" class=\"cui-messageList-msgItem\"><div><div class=\"thread-container\"><div id=\"1393207307050949578\" class=\"cui-message-base cui-message-base-left cui-message-base-hasAvatar cui-message-base-secondly cui-message-base-square cui-message-base-dark\"><img src=\"/icon/im/avatar_default.svg\" class=\"w-[48px] h-[48px] rounded-full overflow-hidden object-fit\"><div class=\"cui-message-base-box\"><div class=\"cui-message-base-info\"></div><div class=\"cui-message-base-body\"><div class=\"cui-message-base-content\" style=\"background: var(--im-msg-bubble-color-left); border-radius: 9px; padding: 10px 12px; color: var(--im-msg-bubble-font-color);\"><div style=\"display:flex;align-items:center\"><div class=\"generating-loader-wrap\"><div class=\"generating-loader\"></div></div><span class=\"cui-message-text\">Generating</span></div></div><div class=\"cui-message-base-time-and-status-box\"><span class=\"cui-message-status cui-message-status-icon\"></span><span class=\"cui-message-base-time\"></span></div></div></div></div></div></div><div class=\"cui-modal-root\"><div tabindex=\"-1\" class=\"cui-modal-wrap modify-message-modal\" style=\"display: none;\"></div></div></div>";
|
|
454
|
+
template = document.createElement('template');
|
|
455
|
+
template.innerHTML = _trimInstanceProperty(htmlString).call(htmlString);
|
|
456
|
+
node = template.content.firstChild;
|
|
457
|
+
if (node) {
|
|
458
|
+
cuiScrollList.appendChild(node);
|
|
459
|
+
if (cuiScrollListWrap) {
|
|
460
|
+
cuiScrollListWrap.scrollTo({
|
|
461
|
+
top: 1000000000
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
460
465
|
}
|
|
466
|
+
} catch (error) {
|
|
467
|
+
console.error("Error adding generating loader:", error);
|
|
461
468
|
}
|
|
462
469
|
}
|
|
463
470
|
afterSendMsg(txtMessage, extInfo);
|
|
@@ -494,13 +501,22 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
494
501
|
};
|
|
495
502
|
}();
|
|
496
503
|
useEffect(function () {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
+
try {
|
|
505
|
+
var _conversationList$fin;
|
|
506
|
+
var cuiScrollList = document.querySelector(".cui-scrollList div");
|
|
507
|
+
var generatingLoader = document.querySelector("#agent-generating-loader");
|
|
508
|
+
// 确保元素存在且需要移除loader
|
|
509
|
+
if (cuiScrollList && generatingLoader && ((_conversationList$fin = _findInstanceProperty(conversationList).call(conversationList, function (item) {
|
|
510
|
+
return item.conversationId === props.conversationId;
|
|
511
|
+
})) === null || _conversationList$fin === void 0 || (_conversationList$fin = _conversationList$fin.lastMessage) === null || _conversationList$fin === void 0 ? void 0 : _conversationList$fin.to) !== props.conversationId) {
|
|
512
|
+
// 使用contains方法安全地检查父子关系
|
|
513
|
+
if (cuiScrollList.contains(generatingLoader)) {
|
|
514
|
+
generatingLoader.remove(); // 更安全的移除方法
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
} catch (error) {
|
|
518
|
+
// 捕获并记录任何DOM操作错误,防止应用崩溃
|
|
519
|
+
console.error("Error handling generating loader:", error);
|
|
504
520
|
}
|
|
505
521
|
}, [conversationList, props.conversationId]);
|
|
506
522
|
return /*#__PURE__*/React.createElement("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whyuzeim",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.55",
|
|
4
4
|
"description": "im componenets",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
"classnames": ">=2.5.1",
|
|
28
28
|
"use-debounce": ">=10.0.4",
|
|
29
29
|
"@babel/runtime-corejs3": ">=7.26.9",
|
|
30
|
-
"react-infinite-scroll-component": ">=6.1.0"
|
|
30
|
+
"react-infinite-scroll-component": ">=6.1.0",
|
|
31
|
+
"highlight.js": ">=11.0.0",
|
|
32
|
+
"copy-to-clipboard": ">=3.0.0"
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
35
|
"react": "^16.3.1",
|
|
@@ -40,6 +42,8 @@
|
|
|
40
42
|
"use-debounce": "^10.0.4",
|
|
41
43
|
"@babel/runtime-corejs3": "^7.26.9",
|
|
42
44
|
"react-infinite-scroll-component": "^6.1.0",
|
|
43
|
-
"lodash": "^4.17.21"
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"highlight.js": "^11.11.1",
|
|
47
|
+
"copy-to-clipboard": "^3.3.3"
|
|
44
48
|
}
|
|
45
49
|
}
|