@blocklet/pages-kit 0.2.355 → 0.2.357
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/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +3 -10
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +5 -2
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +4 -11
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +5 -2
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
|
|
14
14
|
import { Icon } from '@iconify/react';
|
|
15
|
-
import {
|
|
15
|
+
import { Box, Button, Dialog, DialogContent, DialogTitle, Stack, Typography, alpha } from '@mui/material';
|
|
16
16
|
import { useMemo, useState } from 'react';
|
|
17
17
|
import { RelativeTime } from '../../../../arcblock/ux';
|
|
18
18
|
import { useLocaleContext } from '../../../../locale';
|
|
@@ -37,16 +37,9 @@ export default function PhotoGalleryItem() {
|
|
|
37
37
|
const { message } = useCurrentMessage();
|
|
38
38
|
const [openDialog, setOpenDialog] = useState(false);
|
|
39
39
|
const objects = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) !== null && _b !== void 0 ? _b : [];
|
|
40
|
-
const images = objects.flatMap((i) => { var _a
|
|
41
|
-
if (!images.length && message.error)
|
|
42
|
-
|
|
43
|
-
aspectRatio: 1,
|
|
44
|
-
bgcolor: 'grey.50',
|
|
45
|
-
borderRadius: 1,
|
|
46
|
-
overflow: 'hidden',
|
|
47
|
-
wordBreak: 'break-word',
|
|
48
|
-
}, children: _jsx(Alert, { severity: "error", sx: { bgcolor: 'transparent' }, children: message.error.message }) }));
|
|
49
|
-
}
|
|
40
|
+
const images = objects.flatMap((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[RuntimeOutputVariable.images]) !== null && _a !== void 0 ? _a : []; });
|
|
41
|
+
if (!images.length && message.error)
|
|
42
|
+
throw message.error;
|
|
50
43
|
return images.map(({ url }, index) => {
|
|
51
44
|
var _a;
|
|
52
45
|
return (_jsxs(Box, { sx: {
|
|
@@ -19,11 +19,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { SubscriptionErrorType } from '@blocklet/ai-kit/api';
|
|
22
23
|
import { Icon } from '@iconify/react';
|
|
23
24
|
import { Box, Typography } from '@mui/material';
|
|
24
25
|
import { memo, useCallback, useState } from 'react';
|
|
25
26
|
import CustomComponentRenderer from '../../../../../../components/CustomComponentRenderer';
|
|
26
27
|
import { useLocaleContext } from '../../../../../locale';
|
|
28
|
+
import { AgentErrorView } from '../../../components/AgentErrorBoundary';
|
|
27
29
|
import LoadingButton from '../../../components/LoadingButton';
|
|
28
30
|
import { useCurrentAgent } from '../../../contexts/CurrentAgent';
|
|
29
31
|
import { useRuntimeState } from '../../../state/runtime';
|
|
@@ -33,6 +35,7 @@ import { AIRunningLoading } from './Loading';
|
|
|
33
35
|
import TransparentTooltip from './TransparentTooltip';
|
|
34
36
|
const codeField = 'code';
|
|
35
37
|
function RetryComponent({ message, tip }) {
|
|
38
|
+
var _a;
|
|
36
39
|
const { t } = useLocaleContext();
|
|
37
40
|
const { execute } = useRuntimeState();
|
|
38
41
|
const { aid } = useCurrentAgent();
|
|
@@ -50,14 +53,14 @@ function RetryComponent({ message, tip }) {
|
|
|
50
53
|
}, children: [_jsx(Box, { component: Icon, icon: "unjs:automd", sx: {
|
|
51
54
|
mt: 6,
|
|
52
55
|
fontSize: 120,
|
|
53
|
-
} }), _jsxs(Typography, { variant: "h6", sx: {
|
|
56
|
+
} }), ((_a = message === null || message === void 0 ? void 0 : message.error) === null || _a === void 0 ? void 0 : _a.type) === SubscriptionErrorType.UNSUBSCRIBED ? (_jsx(Box, { width: "100%", children: _jsx(AgentErrorView, { error: message.error }) })) : (_jsxs(Typography, { variant: "h6", sx: {
|
|
54
57
|
display: 'flex',
|
|
55
58
|
alignItems: 'center',
|
|
56
59
|
}, children: [tip || t('v0.retryTip'), _jsx(TransparentTooltip, { arrow: true, placement: "top", title: _jsx(MessageErrorView, { error: (message === null || message === void 0 ? void 0 : message.error) || new Error('Code syntax errors'), sx: {
|
|
57
60
|
mr: 0,
|
|
58
61
|
} }), children: _jsx(Box, { component: Icon, icon: "akar-icons:info", sx: {
|
|
59
62
|
ml: 1,
|
|
60
|
-
} }) })] }), _jsx(LoadingButton, { variant: "contained", loading: loading, color: "primary", onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
} }) })] })), _jsx(LoadingButton, { variant: "contained", loading: loading, color: "primary", onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
61
64
|
setLoading(true);
|
|
62
65
|
try {
|
|
63
66
|
const { inputs } = message || {};
|