@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.
@@ -43,16 +43,9 @@ function PhotoGalleryItem() {
43
43
  const { message } = (0, CurrentMessage_1.useCurrentMessage)();
44
44
  const [openDialog, setOpenDialog] = (0, react_2.useState)(false);
45
45
  const objects = (_b = (_a = message.outputs) === null || _a === void 0 ? void 0 : _a.objects) !== null && _b !== void 0 ? _b : [];
46
- const images = objects.flatMap((i) => { var _a, _b; return (_b = (_a = i.data) === null || _a === void 0 ? void 0 : _a[types_1.RuntimeOutputVariable.images]) !== null && _b !== void 0 ? _b : []; });
47
- if (!images.length && message.error) {
48
- return ((0, jsx_runtime_1.jsx)(material_1.Stack, { alignItems: "center", justifyContent: "center", sx: {
49
- aspectRatio: 1,
50
- bgcolor: 'grey.50',
51
- borderRadius: 1,
52
- overflow: 'hidden',
53
- wordBreak: 'break-word',
54
- }, children: (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", sx: { bgcolor: 'transparent' }, children: message.error.message }) }));
55
- }
46
+ const images = objects.flatMap((i) => { var _a; return (_a = i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.images]) !== null && _a !== void 0 ? _a : []; });
47
+ if (!images.length && message.error)
48
+ throw message.error;
56
49
  return images.map(({ url }, index) => {
57
50
  var _a;
58
51
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
@@ -28,11 +28,13 @@ exports.default = CodePreview;
28
28
  exports.CodeRenderByMessage = CodeRenderByMessage;
29
29
  exports.getCurrentCodeByTaskId = getCurrentCodeByTaskId;
30
30
  const jsx_runtime_1 = require("react/jsx-runtime");
31
+ const api_1 = require("@blocklet/ai-kit/api");
31
32
  const react_1 = require("@iconify/react");
32
33
  const material_1 = require("@mui/material");
33
34
  const react_2 = require("react");
34
35
  const CustomComponentRenderer_1 = __importDefault(require("../../../../../../components/CustomComponentRenderer"));
35
36
  const locale_1 = require("../../../../../locale");
37
+ const AgentErrorBoundary_1 = require("../../../components/AgentErrorBoundary");
36
38
  const LoadingButton_1 = __importDefault(require("../../../components/LoadingButton"));
37
39
  const CurrentAgent_1 = require("../../../contexts/CurrentAgent");
38
40
  const runtime_1 = require("../../../state/runtime");
@@ -42,6 +44,7 @@ const Loading_1 = require("./Loading");
42
44
  const TransparentTooltip_1 = __importDefault(require("./TransparentTooltip"));
43
45
  const codeField = 'code';
44
46
  function RetryComponent({ message, tip }) {
47
+ var _a;
45
48
  const { t } = (0, locale_1.useLocaleContext)();
46
49
  const { execute } = (0, runtime_1.useRuntimeState)();
47
50
  const { aid } = (0, CurrentAgent_1.useCurrentAgent)();
@@ -59,14 +62,14 @@ function RetryComponent({ message, tip }) {
59
62
  }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: react_1.Icon, icon: "unjs:automd", sx: {
60
63
  mt: 6,
61
64
  fontSize: 120,
62
- } }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "h6", sx: {
65
+ } }), ((_a = message === null || message === void 0 ? void 0 : message.error) === null || _a === void 0 ? void 0 : _a.type) === api_1.SubscriptionErrorType.UNSUBSCRIBED ? ((0, jsx_runtime_1.jsx)(material_1.Box, { width: "100%", children: (0, jsx_runtime_1.jsx)(AgentErrorBoundary_1.AgentErrorView, { error: message.error }) })) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "h6", sx: {
63
66
  display: 'flex',
64
67
  alignItems: 'center',
65
68
  }, children: [tip || t('v0.retryTip'), (0, jsx_runtime_1.jsx)(TransparentTooltip_1.default, { arrow: true, placement: "top", title: (0, jsx_runtime_1.jsx)(MessageErrorView_1.default, { error: (message === null || message === void 0 ? void 0 : message.error) || new Error('Code syntax errors'), sx: {
66
69
  mr: 0,
67
70
  } }), children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: react_1.Icon, icon: "akar-icons:info", sx: {
68
71
  ml: 1,
69
- } }) })] }), (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { variant: "contained", loading: loading, color: "primary", onClick: () => __awaiter(this, void 0, void 0, function* () {
72
+ } }) })] })), (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { variant: "contained", loading: loading, color: "primary", onClick: () => __awaiter(this, void 0, void 0, function* () {
70
73
  setLoading(true);
71
74
  try {
72
75
  const { inputs } = message || {};