@blocklet/pages-kit 0.2.351 → 0.2.352
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/components/AgentErrorBoundary.js +5 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +2 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +2 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +5 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +2 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +2 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/tsconfig.json +2 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SubscriptionErrorType } from '@blocklet/ai-kit/api';
|
|
3
|
+
import { SubscribeErrorAlert } from '@blocklet/ai-kit/components';
|
|
2
4
|
import { Alert, Button, Stack, alertClasses } from '@mui/material';
|
|
3
5
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
6
|
import { useLocaleContext } from '../../../locale';
|
|
@@ -12,6 +14,9 @@ export function AgentErrorView({ error }) {
|
|
|
12
14
|
if (error.type === 'MissingSecretError') {
|
|
13
15
|
return _jsx(MissingSecretErrorView, {});
|
|
14
16
|
}
|
|
17
|
+
if (error.type === SubscriptionErrorType.UNSUBSCRIBED) {
|
|
18
|
+
return _jsx(SubscribeErrorAlert, { error: error });
|
|
19
|
+
}
|
|
15
20
|
return _jsx(Alert, { severity: "error", children: String(error === null || error === void 0 ? void 0 : error.message) });
|
|
16
21
|
}
|
|
17
22
|
function MissingSecretErrorView() {
|
|
@@ -16,6 +16,7 @@ import { Suspense, memo, useRef } from 'react';
|
|
|
16
16
|
import Balancer from 'react-wrap-balancer';
|
|
17
17
|
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
18
18
|
import { useLocaleContext } from '../../../../locale';
|
|
19
|
+
import { AgentErrorView } from '../../components/AgentErrorBoundary';
|
|
19
20
|
import SimpleHeader from '../../components/Header/SimpleHeader';
|
|
20
21
|
import LoadingButton from '../../components/LoadingButton';
|
|
21
22
|
import { useActiveAgent } from '../../contexts/ActiveAgent';
|
|
@@ -55,5 +56,5 @@ const OutputItemView = memo(({ message }) => {
|
|
|
55
56
|
const { appearanceOutput } = useAppearances({ agentId: message.agentId });
|
|
56
57
|
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
57
58
|
return null;
|
|
58
|
-
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties }) }) }) }, message.id));
|
|
59
|
+
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }) }) }, message.id));
|
|
59
60
|
});
|
|
@@ -31,7 +31,7 @@ const MessageView = memo(({ message }) => {
|
|
|
31
31
|
const { hideAgentAvatar, hideUserInputs } = (_b = useComponentPreferences()) !== null && _b !== void 0 ? _b : {};
|
|
32
32
|
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
33
33
|
return null;
|
|
34
|
-
const agentMessage = (_jsx(MessageBodyContainer, { messageRole: "assistant", children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }) }));
|
|
34
|
+
const agentMessage = (_jsx(MessageBodyContainer, { messageRole: "assistant", children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }));
|
|
35
35
|
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsxs(Stack, { gap: 2, children: [!hideUserInputs && (_jsx(Box, { children: _jsx(UserInfo, { name: (_c = authSession.user) === null || _c === void 0 ? void 0 : _c.fullName, did: (_d = authSession.user) === null || _d === void 0 ? void 0 : _d.did, avatar: (_e = authSession.user) === null || _e === void 0 ? void 0 : _e.avatar, time: message.createdAt, reverse: true, alignItems: "flex-start", UserNameProps: { sx: { color: hasBg ? 'white' : undefined } }, children: _jsx(Stack, { sx: { alignItems: 'flex-end' }, children: _jsx(MessageBodyContainer, { messageRole: "user", children: _jsx(UserMessageView, {}) }) }) }) })), _jsx(Box, { children: !hideAgentAvatar ? (_jsx(UserInfo, { name: profile.name, did: (_f = globalThis.blocklet) === null || _f === void 0 ? void 0 : _f.appId, avatar: profile.avatar, time: message.createdAt, alignItems: "flex-start", UserNameProps: { sx: { color: hasBg ? 'white' : undefined } }, children: agentMessage })) : (agentMessage) })] }) }) }));
|
|
36
36
|
});
|
|
37
37
|
export default MessageView;
|
|
@@ -43,5 +43,5 @@ const OutputItemView = memo(({ message }) => {
|
|
|
43
43
|
const { appearanceOutput } = useAppearances({ agentId: message.agentId });
|
|
44
44
|
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
45
45
|
return null;
|
|
46
|
-
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }) }) }) }));
|
|
46
|
+
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }) }) }));
|
|
47
47
|
});
|
|
@@ -16,6 +16,7 @@ import { Box, Button, Chip, Container, IconButton, Stack, ThemeProvider, Tooltip
|
|
|
16
16
|
import { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
17
|
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
18
18
|
import { useLocaleContext } from '../../../../locale';
|
|
19
|
+
import { AgentErrorView } from '../../components/AgentErrorBoundary';
|
|
19
20
|
import { useActiveAgent } from '../../contexts/ActiveAgent';
|
|
20
21
|
import CurrentAgentProvider from '../../contexts/CurrentAgent';
|
|
21
22
|
import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
@@ -292,5 +293,5 @@ function AgentOutputRender({ message }) {
|
|
|
292
293
|
const { appearanceOutput } = useAppearances();
|
|
293
294
|
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId) || !message)
|
|
294
295
|
return null;
|
|
295
|
-
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties }) }) }) }));
|
|
296
|
+
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }) }) }));
|
|
296
297
|
}
|