@blocklet/pages-kit 0.2.289 → 0.2.291
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/LICENSE +13 -0
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +15 -3
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +6 -9
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +6 -0
- package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageActions.js +39 -8
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +4 -10
- package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +52 -40
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +39 -20
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +35 -1
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +9 -47
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +1 -9
- package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +35 -7
- package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +31 -4
- package/lib/cjs/builtin/async/ai-runtime/index.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +10 -0
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +15 -3
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +6 -9
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +6 -0
- package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageActions.js +40 -9
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +4 -10
- package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +53 -41
- package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +34 -15
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +12 -1
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +10 -48
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.js +2 -10
- package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +36 -8
- package/lib/esm/builtin/async/ai-runtime/hooks/header.js +33 -6
- package/lib/esm/builtin/async/ai-runtime/index.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +10 -0
- package/lib/types/builtin/async/ai-runtime/api/assistant.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +2 -1
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +5 -4
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +5 -2
- package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +2 -1
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +10 -0
- package/package.json +18 -20
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2018-2020 ArcBlock
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
@@ -30,7 +30,7 @@ const material_1 = require("@mui/material");
|
|
|
30
30
|
const react_2 = require("react");
|
|
31
31
|
const LoadingButton_1 = __importDefault(require("./LoadingButton"));
|
|
32
32
|
function ActionButton(_a) {
|
|
33
|
-
var { tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset } = _a, props = __rest(_a, ["tip", "tipSucceed", "title", "titleSucceed", "icon", "iconSucceed", "autoReset"]);
|
|
33
|
+
var { tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement = 'top' } = _a, props = __rest(_a, ["tip", "tipSucceed", "title", "titleSucceed", "icon", "iconSucceed", "autoReset", "placement"]);
|
|
34
34
|
const [copied, setCopied] = (0, react_2.useState)(false);
|
|
35
35
|
const [error, setError] = (0, react_2.useState)();
|
|
36
36
|
const timer = (0, react_2.useRef)();
|
|
@@ -48,7 +48,7 @@ function ActionButton(_a) {
|
|
|
48
48
|
const realIcon = copied ? iconSucceed : icon;
|
|
49
49
|
const toolTipTitleText = error ? (0, jsx_runtime_1.jsx)(material_1.Box, { color: "error", children: error.message }) : (copied && tipSucceed) || tip;
|
|
50
50
|
const buttonText = copied ? titleSucceed : title;
|
|
51
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: toolTipTitleText, disableInteractive: true, placement:
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: toolTipTitleText, disableInteractive: true, placement: placement, onClose: onClose, onOpen: onOpen, children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, Object.assign({ startIcon: realIcon && (typeof realIcon === 'string' ? (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: realIcon }) : realIcon), loadingPosition: realIcon ? 'start' : undefined }, props, { onClick: (e) => __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
if (!props.onClick)
|
|
53
53
|
return;
|
|
54
54
|
try {
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
15
|
const icons_material_1 = require("@mui/icons-material");
|
|
5
16
|
const material_1 = require("@mui/material");
|
|
6
17
|
const react_1 = require("react");
|
|
7
|
-
function MenuButton(
|
|
18
|
+
function MenuButton(_a) {
|
|
19
|
+
var { sx, menus, children, MenuProps } = _a, restProps = __rest(_a, ["sx", "menus", "children", "MenuProps"]);
|
|
8
20
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
9
21
|
const open = Boolean(anchorEl);
|
|
10
22
|
const handleClick = (event) => {
|
|
@@ -13,7 +25,7 @@ function MenuButton({ sx, menus, children }) {
|
|
|
13
25
|
const handleClose = () => {
|
|
14
26
|
setAnchorEl(null);
|
|
15
27
|
};
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: sx, children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleClick, children: children || (0, jsx_runtime_1.jsx)(icons_material_1.MoreHoriz, {}) }), (0, jsx_runtime_1.jsx)(material_1.Menu, { disableScrollLock: true, MenuListProps: {
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: sx, children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleClick }, restProps, { children: children || (0, jsx_runtime_1.jsx)(icons_material_1.MoreHoriz, {}) })), (0, jsx_runtime_1.jsx)(material_1.Menu, Object.assign({ disableScrollLock: true, MenuListProps: {
|
|
17
29
|
sx: {
|
|
18
30
|
p: 0.5,
|
|
19
31
|
'.MuiMenuItem-root': {
|
|
@@ -38,6 +50,6 @@ function MenuButton({ sx, menus, children }) {
|
|
|
38
50
|
}, transformOrigin: {
|
|
39
51
|
vertical: 'top',
|
|
40
52
|
horizontal: 'right',
|
|
41
|
-
}, open: open, onClick: handleClose, onClose: handleClose, children: typeof menus === 'function' ? menus() : menus })] }));
|
|
53
|
+
}, open: open, onClick: handleClose, onClose: handleClose }, MenuProps, { children: typeof menus === 'function' ? menus() : menus }))] }));
|
|
42
54
|
}
|
|
43
55
|
exports.default = MenuButton;
|
|
@@ -39,13 +39,14 @@ function SocialShare(props) {
|
|
|
39
39
|
if (type === 'buttons') {
|
|
40
40
|
return (0, jsx_runtime_1.jsx)(SocialShareButtons, Object.assign({}, restProps));
|
|
41
41
|
}
|
|
42
|
+
// @ts-ignore
|
|
42
43
|
return (0, jsx_runtime_1.jsx)(SocialShareMenu, Object.assign({}, restProps));
|
|
43
44
|
}, [type, restProps]);
|
|
44
45
|
return ((0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { translations: locales_1.translations, locale: locale, fallbackLocale: "en", children: renderContent() }));
|
|
45
46
|
}
|
|
46
47
|
exports.default = SocialShare;
|
|
47
48
|
function SocialShareMenu(_a) {
|
|
48
|
-
var { url = getFormattedUrl(window.location.href), content } = _a, restProps = __rest(_a, ["url", "content"]);
|
|
49
|
+
var { url = getFormattedUrl(window.location.href), content, children = (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:share" }), MenuProps, disableCopyLink = false } = _a, restProps = __rest(_a, ["url", "content", "children", "MenuProps", "disableCopyLink"]);
|
|
49
50
|
const theme = (0, material_1.useTheme)();
|
|
50
51
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
51
52
|
const itemIconSx = {
|
|
@@ -72,21 +73,17 @@ function SocialShareMenu(_a) {
|
|
|
72
73
|
borderRadius: '6px',
|
|
73
74
|
},
|
|
74
75
|
};
|
|
75
|
-
|
|
76
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
77
|
-
return (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: () => (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:share" }) }, restProps));
|
|
78
|
-
};
|
|
79
|
-
return ((0, jsx_runtime_1.jsx)(MenuButton_1.default, { menus: [
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(MenuButton_1.default, Object.assign({ MenuProps: MenuProps, menus: [
|
|
80
77
|
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.TwitterShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.XIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToX') })] }) }, "shareOnX"),
|
|
81
78
|
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.TelegramShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.TelegramIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToTelegram') })] }) }, "shareOnTelegram"),
|
|
82
79
|
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.RedditShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.RedditIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToReddit') })] }) }, "shareOnReddit"),
|
|
83
80
|
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.WeiboShareButton, url: url, title: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.WeiboIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToWeibo') })] }) }, "shareOnWeibo"),
|
|
84
81
|
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.FacebookShareButton, url: url, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.FacebookIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToFacebook') })] }) }, "shareOnFacebook"),
|
|
85
82
|
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: react_share_1.LinkedinShareButton, url: url, summary: content, sx: buttonSx, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_share_1.LinkedinIcon, sx: itemIconSx, round: true }, iconProps)), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.shareToLinkedin') })] }) }, "shareOnLinkedin"),
|
|
86
|
-
(0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "div", sx: buttonSx, onClick: () => {
|
|
83
|
+
!disableCopyLink && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "div", sx: buttonSx, onClick: () => {
|
|
87
84
|
window.navigator.clipboard.writeText(url);
|
|
88
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: itemIconSx, round: true, children: (0, jsx_runtime_1.jsx)(react_1.Icon,
|
|
89
|
-
], children:
|
|
85
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: itemIconSx, round: true }, iconProps, { children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:link" }) })), (0, jsx_runtime_1.jsx)("span", { children: t('socialShare.copyLink') })] }) }, "copyToClipboard")),
|
|
86
|
+
].filter(Boolean) }, restProps, { children: children })));
|
|
90
87
|
}
|
|
91
88
|
exports.SocialShareMenu = SocialShareMenu;
|
|
92
89
|
function SocialShareButtons(_a) {
|
|
@@ -188,6 +188,12 @@ function ThemeProvider({ children, template, transparentHeaderBg, }) {
|
|
|
188
188
|
zIndex: -1,
|
|
189
189
|
},
|
|
190
190
|
},
|
|
191
|
+
'.white-tooltip .MuiTooltip-tooltip': {
|
|
192
|
+
background: 'white !important',
|
|
193
|
+
boxShadow: '0px 4px 8px 0px rgba(3, 7, 18, 0.08)',
|
|
194
|
+
border: '1px solid rgba(229, 231, 235, 1)',
|
|
195
|
+
padding: 4,
|
|
196
|
+
},
|
|
191
197
|
} }), children] }));
|
|
192
198
|
}
|
|
193
199
|
exports.default = ThemeProvider;
|
|
@@ -84,6 +84,6 @@ function ParameterForm(_a) {
|
|
|
84
84
|
transform: `rotateX(${expand ? '180deg' : '0deg'})`,
|
|
85
85
|
transition: 'transform .3s ease-in-out',
|
|
86
86
|
} }) }) }), (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: expand, orientation: "vertical", sx: { maxHeight: '40vh', overflowY: 'auto' }, children: (0, jsx_runtime_1.jsx)(ParameterFormFields_1.default, { autoFocus: !sessionId, disabled: disabled, readOnly: readOnly, parameters: parameters, form: form, sx: { pb: 2, px: 2 } }) })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { px: 2, children: !hideSubmit &&
|
|
87
|
-
(isChat ? ((0, jsx_runtime_1.jsx)(QuestionField_1.default, { sessionId: sessionId, showSettingButton: !!sessionId, assistant: assistant, disabled: disabled, submitButtonTitle: submitButtonTitle, readOnly: readOnly, isSubmitting: isSubmitting, form: form, autoFocus: !!sessionId })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-generation-bar", direction: "row", alignItems: "center", justifyContent: "flex-end", gap: 2, children: [sessionId && (0, jsx_runtime_1.jsx)(SettingButton_1.default, { form: form, sessionId: sessionId }), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1 }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: submitButtonTitle, disableInteractive: true, placement: "top", children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { disabled: disabled, type: "submit", variant: "contained", color: "secondary", loading: form.formState.isSubmitting || isSubmitting, children: submitButtonTitle || t('
|
|
87
|
+
(isChat ? ((0, jsx_runtime_1.jsx)(QuestionField_1.default, { sessionId: sessionId, showSettingButton: !!sessionId, assistant: assistant, disabled: disabled, submitButtonTitle: submitButtonTitle || t('send'), readOnly: readOnly, isSubmitting: isSubmitting, form: form, autoFocus: !!sessionId })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-generation-bar", direction: "row", alignItems: "center", justifyContent: "flex-end", gap: 2, children: [sessionId && (0, jsx_runtime_1.jsx)(SettingButton_1.default, { form: form, sessionId: sessionId }), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1 }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: submitButtonTitle, disableInteractive: true, placement: "top", children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { disabled: disabled, type: "submit", variant: "contained", color: "secondary", loading: form.formState.isSubmitting || isSubmitting, children: submitButtonTitle || t('send') }) }) })] }))) })] }));
|
|
88
88
|
}
|
|
89
89
|
exports.default = ParameterForm;
|
|
@@ -15,24 +15,55 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
15
15
|
const material_1 = require("@mui/material");
|
|
16
16
|
const locale_1 = require("../../../../locale");
|
|
17
17
|
const ActionButton_1 = require("../ActionButton");
|
|
18
|
+
const SocialShare_1 = require("../SocialShare");
|
|
18
19
|
function MessageActions(_a) {
|
|
19
20
|
var { content } = _a, props = __rest(_a, ["content"]);
|
|
20
21
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
21
22
|
const commonActionButtonsSx = {
|
|
22
23
|
border: '0px !important',
|
|
24
|
+
borderRadius: '4px !important',
|
|
23
25
|
minWidth: '32px',
|
|
24
26
|
color: 'rgba(75, 85, 99, 1)',
|
|
25
27
|
'.MuiButton-startIcon': {
|
|
26
28
|
marginRight: '0px !important',
|
|
27
29
|
},
|
|
28
30
|
};
|
|
29
|
-
return ((0, jsx_runtime_1.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "column", gap: 0.5 }, props, { children: [(0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { autoReset: true, size: "small", variant: "outlined", placement: "right",
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
color: "black", tip: t('copyToClipboard'),
|
|
34
|
+
// title={t('copy')}
|
|
35
|
+
// titleSucceed={t('copied')}
|
|
36
|
+
icon: "tabler:copy", iconSucceed: "tabler:copy-check-filled", sx: Object.assign({}, commonActionButtonsSx), onClick: () => {
|
|
37
|
+
window.navigator.clipboard.writeText(content);
|
|
38
|
+
} }), (0, jsx_runtime_1.jsx)(SocialShare_1.SocialShareMenu, { content: content, disableCopyLink: true, size: "small", disableRipple: true, MenuProps: {
|
|
39
|
+
anchorOrigin: {
|
|
40
|
+
vertical: 'center',
|
|
41
|
+
horizontal: 'right',
|
|
42
|
+
},
|
|
43
|
+
transformOrigin: {
|
|
44
|
+
vertical: 'top',
|
|
45
|
+
horizontal: 'left',
|
|
46
|
+
},
|
|
47
|
+
slotProps: {
|
|
48
|
+
paper: {
|
|
49
|
+
sx: {
|
|
50
|
+
ml: 1.5,
|
|
51
|
+
mt: -2,
|
|
52
|
+
border: 1,
|
|
53
|
+
borderColor: 'divider',
|
|
54
|
+
boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
sx: {
|
|
59
|
+
zIndex: 9999,
|
|
60
|
+
},
|
|
61
|
+
}, sx: {
|
|
62
|
+
'.MuiIconButton-root': {
|
|
63
|
+
p: 0,
|
|
64
|
+
},
|
|
65
|
+
}, children: (0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { autoReset: true, size: "small", variant: "outlined", placement: "right",
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
color: "black", tip: t('socialShare.title'), icon: "tabler:share", iconSucceed: "tabler:share", sx: Object.assign({}, commonActionButtonsSx) }) })] })));
|
|
37
68
|
}
|
|
38
69
|
exports.default = MessageActions;
|
|
@@ -13,17 +13,11 @@ function MessageErrorView({ assistantId, assistant, error, }) {
|
|
|
13
13
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
14
14
|
const { subscribeLink } = (0, subscribe_1.useSubscribeLink)({ assistantId });
|
|
15
15
|
if (error.type === 'InvalidSubscriptionError') {
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { className: "ai-chat-message-error", children: [(0, jsx_runtime_1.jsx)(material_1.Box, {
|
|
17
|
-
bgcolor: 'grey.100',
|
|
18
|
-
p: 1.5,
|
|
19
|
-
borderRadius: 1,
|
|
20
|
-
}, children: (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { children: t('requireNewSubscription', {
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { className: "ai-chat-message-error", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { className: "message-response", children: (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { children: t('requireNewSubscription', {
|
|
21
17
|
price: (_b = (_a = assistant.release) === null || _a === void 0 ? void 0 : _a.payment) === null || _b === void 0 ? void 0 : _b.price,
|
|
22
|
-
}) }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 1, children: subscribeLink ? (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
borderRadius: 1,
|
|
26
|
-
}, children: t('thanksForSubscription') })) })] }));
|
|
18
|
+
}) }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 1, children: subscribeLink ? (
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "black", href: subscribeLink, children: t('subscribeNow') })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "message-response", children: t('thanksForSubscription') })) })] }));
|
|
27
21
|
}
|
|
28
22
|
return ((0, jsx_runtime_1.jsx)(material_1.Alert, { className: "ai-chat-message-error", severity: "error", children: (error.type === 'ReachMaxRoundLimitError' && ((_c = assistant === null || assistant === void 0 ? void 0 : assistant.release) === null || _c === void 0 ? void 0 : _c.reachMaxRoundLimitTip)) || error.message }));
|
|
29
23
|
}
|
|
@@ -40,37 +40,31 @@ const MessageErrorView_1 = __importDefault(require("./MessageErrorView"));
|
|
|
40
40
|
function MessageItemView({ assistantId, assistant, message, hideAvatar, }) {
|
|
41
41
|
var _a, _b;
|
|
42
42
|
const showUserMessage = ((_a = assistant.release) === null || _a === void 0 ? void 0 : _a.template) !== 'form' && !!((_b = message.parameters) === null || _b === void 0 ? void 0 : _b.question);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
const commonMessageSx = {
|
|
44
|
+
position: 'relative',
|
|
45
|
+
borderRadius: 1,
|
|
46
|
+
py: 1,
|
|
47
|
+
px: 2,
|
|
48
|
+
mt: 0.5,
|
|
49
|
+
// without logo width
|
|
50
|
+
maxWidth: 'calc(100% - 40px)',
|
|
51
|
+
};
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-message-item", gap: 2.5, overflow: "hidden",
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
sx: {
|
|
55
|
+
'.message-question': Object.assign(Object.assign(Object.assign({}, commonMessageSx), (!hideAvatar
|
|
56
|
+
? {
|
|
57
|
+
borderTopRightRadius: '2px',
|
|
58
|
+
}
|
|
59
|
+
: {})), { borderTopRightRadius: !hideAvatar && '2px', backgroundColor: 'rgba(239, 246, 255, 1)' }),
|
|
60
|
+
'.message-response': Object.assign(Object.assign(Object.assign({}, commonMessageSx), (!hideAvatar
|
|
61
|
+
? {
|
|
62
|
+
borderTopLeftRadius: '2px',
|
|
63
|
+
}
|
|
64
|
+
: {})), { backgroundColor: 'rgba(229, 231, 235, 1)' }),
|
|
51
65
|
}, children: [showUserMessage && (0, jsx_runtime_1.jsx)(UserMessage, { message: message }), (0, jsx_runtime_1.jsx)(AgentMessage, { assistantId: assistantId, assistant: assistant, message: message, hideAvatar: hideAvatar })] }));
|
|
52
66
|
}
|
|
53
67
|
exports.default = MessageItemView;
|
|
54
|
-
const commonMessageSx = {
|
|
55
|
-
position: 'relative',
|
|
56
|
-
borderRadius: 1,
|
|
57
|
-
py: 1,
|
|
58
|
-
px: 2,
|
|
59
|
-
mt: 0.5,
|
|
60
|
-
// without logo width
|
|
61
|
-
maxWidth: 'calc(100% - 40px)',
|
|
62
|
-
'.message-actions': {
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
top: 0,
|
|
65
|
-
right: -40,
|
|
66
|
-
background: 'white',
|
|
67
|
-
border: 1,
|
|
68
|
-
borderRadius: 1,
|
|
69
|
-
borderColor: 'grey.300',
|
|
70
|
-
opacity: 0,
|
|
71
|
-
transition: 'opacity 0.2s',
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
68
|
function UserMessage({ message }) {
|
|
75
69
|
var _a, _b, _c, _d;
|
|
76
70
|
const { session: authSession } = (0, session_1.useSessionContext)();
|
|
@@ -86,21 +80,39 @@ function UserMessage({ message }) {
|
|
|
86
80
|
}, children: [(0, jsx_runtime_1.jsxs)(MessageUserName, { children: [(_c = authSession.user) === null || _c === void 0 ? void 0 : _c.fullName, (0, jsx_runtime_1.jsx)(MessageTime, { time: message.createdAt })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { className: "message-question", sx: { whiteSpace: 'pre-wrap', wordBreak: 'break-word', textAlign: 'left' }, children: (_d = message.parameters) === null || _d === void 0 ? void 0 : _d.question })] })] }));
|
|
87
81
|
}
|
|
88
82
|
function AgentMessage({ assistantId, assistant, message, hideAvatar, }) {
|
|
89
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
83
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
90
84
|
const showMainMessage = !!(((_a = message.result) === null || _a === void 0 ? void 0 : _a.content) || ((_c = (_b = message.result) === null || _b === void 0 ? void 0 : _b.messages) === null || _c === void 0 ? void 0 : _c.length));
|
|
91
85
|
const isMessageLoading = (message.loading || !message.result) && !message.error;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
const theme = (0, material_1.useTheme)();
|
|
87
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('sm'));
|
|
88
|
+
const isFormTemplate = ((_d = assistant.release) === null || _d === void 0 ? void 0 : _d.template) === 'form';
|
|
89
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "ai-chat-message-ai", direction: "row", gap: 1.5, children: [!hideAvatar && ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(ux_1.Avatar, { size: 40, did: (_e = globalThis.blocklet) === null || _e === void 0 ? void 0 : _e.appId, variant: "circle", shape: "circle", src: (_f = assistant.release) === null || _f === void 0 ? void 0 : _f.logo }) })), (0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, overflow: "hidden", children: [!hideAvatar && ((0, jsx_runtime_1.jsxs)(MessageUserName, { children: [((_g = assistant.release) === null || _g === void 0 ? void 0 : _g.title) || assistant.name, (0, jsx_runtime_1.jsx)(MessageTime, { time: message.createdAt })] })), (0, jsx_runtime_1.jsxs)(react_1.default.Suspense, { children: [showMainMessage ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({}, (isFormTemplate && {
|
|
90
|
+
open: true,
|
|
91
|
+
}), { placement: "right-start", PopperProps: {
|
|
92
|
+
className: 'white-tooltip',
|
|
93
|
+
}, slotProps: {
|
|
94
|
+
popper: {
|
|
95
|
+
modifiers: [
|
|
96
|
+
{
|
|
97
|
+
name: 'offset',
|
|
98
|
+
options: {
|
|
99
|
+
offset: [-3, isMobile ? (!hideAvatar ? -18 : -8) : -6],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
}, title: !isMessageLoading && ((_h = message.result) === null || _h === void 0 ? void 0 : _h.content) && (0, jsx_runtime_1.jsx)(MessageActions_1.default, { content: message.result.content }), children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 1, className: "message-response", children: [(_k = (_j = message.result) === null || _j === void 0 ? void 0 : _j.messages) === null || _k === void 0 ? void 0 : _k.map((childMsg, index) => {
|
|
105
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
106
|
+
return ((_a = childMsg.result) === null || _a === void 0 ? void 0 : _a.content) ? ((0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { className: isMessageLoading &&
|
|
107
|
+
!((_b = message.result) === null || _b === void 0 ? void 0 : _b.content) &&
|
|
108
|
+
!((_d = (_c = message.result) === null || _c === void 0 ? void 0 : _c.images) === null || _d === void 0 ? void 0 : _d.length) &&
|
|
109
|
+
message.result.messages.length - 1 === index
|
|
110
|
+
? 'writing'
|
|
111
|
+
: '', sx: childMsg.respondAs === 'systemMessage' ? { color: 'text.secondary' } : {}, children: (_e = childMsg.result) === null || _e === void 0 ? void 0 : _e.content }, childMsg.taskId)) : ((_g = (_f = childMsg.result) === null || _f === void 0 ? void 0 : _f.images) === null || _g === void 0 ? void 0 : _g.length) ? ((0, jsx_runtime_1.jsx)(image_preview_1.default, { itemWidth: 100, spacing: 1, dataSource: childMsg.result.images.map((i) => ({ src: i.url })) }, childMsg.taskId)) : null;
|
|
112
|
+
}), ((_l = message.result) === null || _l === void 0 ? void 0 : _l.content) && ((0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { className: isMessageLoading ? 'writing' : '', children: message.result.content }))] }) }))) : (isMessageLoading && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", height: 24 + 8 + 8,
|
|
101
113
|
// only response with loading
|
|
102
|
-
className: "message-response" }))), !!((
|
|
103
|
-
((
|
|
114
|
+
className: "message-response" }))), !!((_o = (_m = message.result) === null || _m === void 0 ? void 0 : _m.objects) === null || _o === void 0 ? void 0 : _o.length) &&
|
|
115
|
+
((_q = (_p = message.result) === null || _p === void 0 ? void 0 : _p.objects) === null || _q === void 0 ? void 0 : _q.map((object) => ((0, jsx_runtime_1.jsx)(common_1.MessageMetadataRenderer, { object: object.data }, object.taskId)))), message.error && (0, jsx_runtime_1.jsx)(MessageErrorView_1.default, { assistantId: assistantId, assistant: assistant, error: message.error })] })] })] }));
|
|
104
116
|
}
|
|
105
117
|
function MessageUserName({ children }) {
|
|
106
118
|
return ((0, jsx_runtime_1.jsx)(material_1.Typography, { component: "div", noWrap: true, sx: {
|
|
@@ -16,7 +16,7 @@ const PoweredBy_1 = __importDefault(require("../PoweredBy"));
|
|
|
16
16
|
const ScrollView_1 = require("../ScrollView");
|
|
17
17
|
const InitialForm_1 = require("./InitialForm");
|
|
18
18
|
function RuntimeChatSession({ page }) {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f
|
|
19
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20
20
|
const [session, state] = (0, session_1.useSessionState)({ sessionId: page.sessionId, required: true });
|
|
21
21
|
const [assistant] = (0, assistant_1.useAssistantState)({ assistantId: page.assistantId });
|
|
22
22
|
const lastMessage = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.slice(-1)[0];
|
|
@@ -47,6 +47,6 @@ function RuntimeChatSession({ page }) {
|
|
|
47
47
|
bottom: 0,
|
|
48
48
|
// 从上透明到白色 0.72 的径向渐变
|
|
49
49
|
background: (theme) => `linear-gradient(180deg, ${(0, material_1.alpha)(theme.palette.background.default, 0.1)}, ${(0, material_1.alpha)(theme.palette.background.default, 1)} 16px)`,
|
|
50
|
-
}, children: [(0, jsx_runtime_1.jsx)(ParameterForm_1.default, { sessionId: page.sessionId, defaultValues: lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.parameters, assistant: assistant, onSubmit: onSubmit, isSubmitting: state.running
|
|
50
|
+
}, children: [(0, jsx_runtime_1.jsx)(ParameterForm_1.default, { sessionId: page.sessionId, defaultValues: lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.parameters, assistant: assistant, onSubmit: onSubmit, isSubmitting: state.running }), (0, jsx_runtime_1.jsx)(PoweredBy_1.default, { assistantId: page.assistantId, sx: { my: 0.5, px: 2 } })] })] }));
|
|
51
51
|
}
|
|
52
52
|
exports.default = RuntimeChatSession;
|
|
@@ -24,11 +24,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
const react_1 = require("@iconify/react");
|
|
27
28
|
const material_1 = require("@mui/material");
|
|
28
|
-
const
|
|
29
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
30
|
+
const react_2 = require("react");
|
|
29
31
|
const react_hook_form_1 = require("react-hook-form");
|
|
30
32
|
const locale_1 = require("../../../../locale");
|
|
31
|
-
const material_2 = require("../../../../mui/material");
|
|
32
33
|
const session_1 = require("../../../../session");
|
|
33
34
|
const session_2 = require("../../api/session");
|
|
34
35
|
const assistant_1 = require("../../state/assistant");
|
|
@@ -40,8 +41,14 @@ function RuntimeFormForms(_a) {
|
|
|
40
41
|
var _b, _c, _d;
|
|
41
42
|
var { page } = _a, props = __rest(_a, ["page"]);
|
|
42
43
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
44
|
+
const theme = (0, material_1.useTheme)();
|
|
45
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('sm'));
|
|
43
46
|
const [agent] = (0, assistant_1.useAssistantState)({ assistantId: page.assistantId });
|
|
44
|
-
const
|
|
47
|
+
const spacing = {
|
|
48
|
+
md: 2.5,
|
|
49
|
+
xs: 2,
|
|
50
|
+
};
|
|
51
|
+
const lastParameters = (0, react_2.useMemo)(() => {
|
|
45
52
|
var _a;
|
|
46
53
|
if (page.sessionId) {
|
|
47
54
|
const { session, messages = [] } = (0, session_3.createSessionState)({ sessionId: page.sessionId }).getState();
|
|
@@ -50,7 +57,7 @@ function RuntimeFormForms(_a) {
|
|
|
50
57
|
}
|
|
51
58
|
return undefined;
|
|
52
59
|
}, [page.sessionId]);
|
|
53
|
-
const defaultForm = (0,
|
|
60
|
+
const defaultForm = (0, react_2.useMemo)(() => {
|
|
54
61
|
var _a, _b;
|
|
55
62
|
return Object.fromEntries((_b = (_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.map((parameter) => [
|
|
56
63
|
parameter.key,
|
|
@@ -58,10 +65,11 @@ function RuntimeFormForms(_a) {
|
|
|
58
65
|
])) !== null && _b !== void 0 ? _b : []);
|
|
59
66
|
}, [agent.parameters, lastParameters]);
|
|
60
67
|
const form = (0, react_hook_form_1.useForm)({ defaultValues: defaultForm });
|
|
61
|
-
const [error, setError] = (0,
|
|
68
|
+
const [error, setError] = (0, react_2.useState)();
|
|
69
|
+
const [expand, setExpand] = (0, react_2.useState)(false);
|
|
62
70
|
const { session } = (0, session_1.useSessionContext)();
|
|
63
|
-
const [submitting, setSubmitting] = (0,
|
|
64
|
-
(0,
|
|
71
|
+
const [submitting, setSubmitting] = (0, react_2.useState)(false);
|
|
72
|
+
(0, react_2.useEffect)(() => {
|
|
65
73
|
form.reset(defaultForm);
|
|
66
74
|
}, [defaultForm]);
|
|
67
75
|
const onSubmit = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -94,27 +102,38 @@ function RuntimeFormForms(_a) {
|
|
|
94
102
|
}
|
|
95
103
|
});
|
|
96
104
|
const handleSubmit = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
var _e;
|
|
97
106
|
e.preventDefault();
|
|
98
107
|
if (!session.user) {
|
|
99
108
|
yield new Promise((resolve) => {
|
|
100
109
|
session.login(() => resolve());
|
|
101
110
|
});
|
|
102
111
|
}
|
|
112
|
+
(_e = agent.parameters) === null || _e === void 0 ? void 0 : _e.some((parameter) => {
|
|
113
|
+
if (parameter.required && (0, isEmpty_1.default)(form.getValues(parameter.key))) {
|
|
114
|
+
setExpand(true);
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
});
|
|
119
|
+
// focus the first error field
|
|
120
|
+
form.trigger();
|
|
103
121
|
return form.handleSubmit(onSubmit)(e);
|
|
104
122
|
});
|
|
105
123
|
const openerMessage = (_b = agent.release) === null || _b === void 0 ? void 0 : _b.openerMessage;
|
|
106
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ component: "form" }, props, { onSubmit: handleSubmit, children: [isMobile && ((0, jsx_runtime_1.jsx)(material_1.Button, { sx: { minWidth: 0, px: 4, py: 0, opacity: 0.7, color: 'text.secondary' }, onClick: () => setExpand(!expand), children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: react_1.Icon, icon: "tabler:chevron-compact-up", sx: {
|
|
125
|
+
fontSize: 24,
|
|
126
|
+
transform: `rotateX(${expand ? '180deg' : '0deg'})`,
|
|
127
|
+
transition: 'transform .3s ease-in-out',
|
|
128
|
+
} }) })), (0, jsx_runtime_1.jsx)(material_1.Collapse, { in: expand || !isMobile, orientation: "vertical", sx: {
|
|
129
|
+
maxHeight: isMobile ? undefined : '40vh',
|
|
130
|
+
overflowY: 'auto',
|
|
131
|
+
}, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 2, children: [openerMessage && (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { color: 'text.secondary', px: spacing }, children: openerMessage }), (0, jsx_runtime_1.jsx)(ParameterFormFields_1.default, { parameters: agent.parameters, form: form, sx: { pb: 2, px: spacing } })] }) }), (0, jsx_runtime_1.jsx)(react_2.Suspense, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 2, sx: {
|
|
132
|
+
px: spacing,
|
|
133
|
+
}, children: [error && (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", children: error.message }), (0, jsx_runtime_1.jsx)(RuntimeFormSubmit_1.default, { page: page, type: "submit", variant: "contained", fullWidth: true, loading: submitting,
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
color: "black", sx: {
|
|
136
|
+
height: 40,
|
|
137
|
+
}, children: ((_d = (_c = agent.release) === null || _c === void 0 ? void 0 : _c.submitButton) === null || _d === void 0 ? void 0 : _d.title) || t('send') })] }) })] })));
|
|
119
138
|
}
|
|
120
139
|
exports.default = RuntimeFormForms;
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
26
|
var t = {};
|
|
4
27
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -13,10 +36,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
38
|
const material_1 = require("@mui/material");
|
|
39
|
+
const react_wrap_balancer_1 = __importStar(require("react-wrap-balancer"));
|
|
16
40
|
const ux_1 = require("../../../../arcblock/ux");
|
|
17
41
|
function RuntimeFormHeader(_a) {
|
|
18
42
|
var _b, _c, _d;
|
|
19
43
|
var { agent } = _a, props = __rest(_a, ["agent"]);
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction:
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: {
|
|
45
|
+
md: 'row',
|
|
46
|
+
xs: 'column',
|
|
47
|
+
}, justifyContent: "space-between", alignItems: "center", gap: 2 }, props, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: ux_1.Avatar, size: 120, src: (_b = agent.release) === null || _b === void 0 ? void 0 : _b.logo, did: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appId, borderRadius: 1 }) }), (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.Provider, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 1, sx: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
lineHeight: '28px',
|
|
50
|
+
textAlign: {
|
|
51
|
+
md: 'left',
|
|
52
|
+
xs: 'center',
|
|
53
|
+
},
|
|
54
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h5", sx: { fontSize: 18, fontWeight: 600 }, children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: ((_c = agent.release) === null || _c === void 0 ? void 0 : _c.title) || agent.name }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: 16, color: 'rgba(75, 85, 99, 1)' }, children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: ((_d = agent.release) === null || _d === void 0 ? void 0 : _d.description) || agent.description }) })] }) })] })));
|
|
21
55
|
}
|
|
22
56
|
exports.default = RuntimeFormHeader;
|