whyuzeim 1.1.89 → 1.1.91
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/CodeMsg/index.d.ts +1 -0
- package/cjs/HighlyCustomChat/CodeMsg/index.js +6 -2
- package/cjs/HighlyCustomChat/index.d.ts +1 -0
- package/cjs/HighlyCustomChat/index.js +1 -0
- package/es/HighlyCustomChat/CodeMsg/index.d.ts +1 -0
- package/es/HighlyCustomChat/CodeMsg/index.js +7 -3
- package/es/HighlyCustomChat/index.d.ts +1 -0
- package/es/HighlyCustomChat/index.js +1 -0
- package/package.json +1 -1
|
@@ -14,12 +14,16 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
14
14
|
var msg = props.msg,
|
|
15
15
|
isMySelf = props.isMySelf,
|
|
16
16
|
avatar = props.avatar,
|
|
17
|
-
onApply = props.onApply
|
|
17
|
+
onApply = props.onApply,
|
|
18
|
+
onGenerateSuccess = props.onGenerateSuccess;
|
|
18
19
|
var _useState = React.useState("idle"),
|
|
19
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20
21
|
copyStatus = _useState2[0],
|
|
21
22
|
setCopyStatus = _useState2[1];
|
|
22
23
|
var codeType = ((_msg$customExts = msg.customExts) === null || _msg$customExts === void 0 ? void 0 : _msg$customExts.code_type) || "python";
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
onGenerateSuccess && onGenerateSuccess();
|
|
26
|
+
}, [onGenerateSuccess]);
|
|
23
27
|
if (!((_msg$customExts2 = msg.customExts) !== null && _msg$customExts2 !== void 0 && _msg$customExts2.code)) {
|
|
24
28
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
25
29
|
}
|
|
@@ -98,7 +102,7 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
98
102
|
onApply && onApply(msg.customExts.code);
|
|
99
103
|
!onApply && copyToClipboard();
|
|
100
104
|
},
|
|
101
|
-
className: "
|
|
105
|
+
className: "codeMsg-apply-btnflex items-center h-6 px-2 py-1 bg-white rounded text-black/90 text-[10px] font-normal"
|
|
102
106
|
}, onApply ? 'Apply' : copyStatus === "copied" ? "Copied!" : "Copy")), /*#__PURE__*/React.createElement("div", {
|
|
103
107
|
className: "flex-1 gap-2 flex flex-col justify-between h-full overflow-hidden mt-2"
|
|
104
108
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -16,6 +16,7 @@ export interface IHighlyCustomChat {
|
|
|
16
16
|
sendMessageSuccessCallback?: (msg: ChatSDK.MessageBody, extInfo?: any) => void;
|
|
17
17
|
onLoginSuccess?: () => void;
|
|
18
18
|
onApply?: (code: string) => void;
|
|
19
|
+
onGenerateSuccess?: () => void;
|
|
19
20
|
onReportClick?: (report: AIReportMessageExts) => void;
|
|
20
21
|
}
|
|
21
22
|
declare const HighlyCustomChat: React.FC<IHighlyCustomChat>;
|
|
@@ -224,6 +224,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
224
224
|
} else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_coding") {
|
|
225
225
|
return /*#__PURE__*/React.createElement(index$1, {
|
|
226
226
|
onApply: props.onApply,
|
|
227
|
+
onGenerateSuccess: props.onGenerateSuccess,
|
|
227
228
|
msg: msg,
|
|
228
229
|
isMySelf: isMySelf,
|
|
229
230
|
avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
2
2
|
import _setTimeout from '@babel/runtime-corejs3/core-js-stable/set-timeout';
|
|
3
|
-
import React, { useState } from 'react';
|
|
3
|
+
import React, { useState, useEffect } from 'react';
|
|
4
4
|
import { BaseMessage } from 'agora-chat-uikit';
|
|
5
5
|
import hljs from 'highlight.js';
|
|
6
6
|
import 'highlight.js/styles/night-owl.css';
|
|
@@ -12,12 +12,16 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
12
12
|
var msg = props.msg,
|
|
13
13
|
isMySelf = props.isMySelf,
|
|
14
14
|
avatar = props.avatar,
|
|
15
|
-
onApply = props.onApply
|
|
15
|
+
onApply = props.onApply,
|
|
16
|
+
onGenerateSuccess = props.onGenerateSuccess;
|
|
16
17
|
var _useState = useState("idle"),
|
|
17
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
19
|
copyStatus = _useState2[0],
|
|
19
20
|
setCopyStatus = _useState2[1];
|
|
20
21
|
var codeType = ((_msg$customExts = msg.customExts) === null || _msg$customExts === void 0 ? void 0 : _msg$customExts.code_type) || "python";
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
onGenerateSuccess && onGenerateSuccess();
|
|
24
|
+
}, [onGenerateSuccess]);
|
|
21
25
|
if (!((_msg$customExts2 = msg.customExts) !== null && _msg$customExts2 !== void 0 && _msg$customExts2.code)) {
|
|
22
26
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
23
27
|
}
|
|
@@ -96,7 +100,7 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
96
100
|
onApply && onApply(msg.customExts.code);
|
|
97
101
|
!onApply && copyToClipboard();
|
|
98
102
|
},
|
|
99
|
-
className: "
|
|
103
|
+
className: "codeMsg-apply-btnflex items-center h-6 px-2 py-1 bg-white rounded text-black/90 text-[10px] font-normal"
|
|
100
104
|
}, onApply ? 'Apply' : copyStatus === "copied" ? "Copied!" : "Copy")), /*#__PURE__*/React.createElement("div", {
|
|
101
105
|
className: "flex-1 gap-2 flex flex-col justify-between h-full overflow-hidden mt-2"
|
|
102
106
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -16,6 +16,7 @@ export interface IHighlyCustomChat {
|
|
|
16
16
|
sendMessageSuccessCallback?: (msg: ChatSDK.MessageBody, extInfo?: any) => void;
|
|
17
17
|
onLoginSuccess?: () => void;
|
|
18
18
|
onApply?: (code: string) => void;
|
|
19
|
+
onGenerateSuccess?: () => void;
|
|
19
20
|
onReportClick?: (report: AIReportMessageExts) => void;
|
|
20
21
|
}
|
|
21
22
|
declare const HighlyCustomChat: React.FC<IHighlyCustomChat>;
|
|
@@ -222,6 +222,7 @@ var HighlyCustomChat = function HighlyCustomChat(props) {
|
|
|
222
222
|
} else if (msg.type === "custom" && (msg === null || msg === void 0 ? void 0 : msg.customEvent) === "custom_coding") {
|
|
223
223
|
return /*#__PURE__*/React.createElement(CodeMsg, {
|
|
224
224
|
onApply: props.onApply,
|
|
225
|
+
onGenerateSuccess: props.onGenerateSuccess,
|
|
225
226
|
msg: msg,
|
|
226
227
|
isMySelf: isMySelf,
|
|
227
228
|
avatar: !isMySelf ? /*#__PURE__*/React.createElement("img", {
|