@blocklet/pages-kit 0.2.345 → 0.2.346

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.
@@ -113,7 +113,7 @@ function AgentMessage({ message, hideAvatar }) {
113
113
  p: 0.25,
114
114
  } })), children: _jsx(Stack, { gap: 1, className: "message-response", children: ((_d = message.outputs) === null || _d === void 0 ? void 0 : _d.content) && (_jsx(MarkdownRenderer, { className: isMessageLoading ? 'writing' : '', children: message.outputs.content })) }) })) : (isMessageLoading && (_jsx(Skeleton, { variant: "rectangular", height: 24 + 8 + 8,
115
115
  // only response with loading
116
- className: "message-response" }))), (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f.map((object) => (_jsx(MessageMetadataRenderer, { object: object.data }, object.taskId))), message.error && _jsx(MessageErrorView, { error: message.error })] })] })] }));
116
+ className: "message-response" }))), (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f.map((object, index) => _jsx(MessageMetadataRenderer, { object: object }, index)), message.error && _jsx(MessageErrorView, { error: message.error })] })] })] }));
117
117
  }
118
118
  export function MessageItemWrapper(_a) {
119
119
  var _b;
@@ -37,7 +37,7 @@ 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; return (_a = i.data[RuntimeOutputVariable.images]) !== null && _a !== void 0 ? _a : []; });
40
+ const images = objects.flatMap((i) => { var _a, _b; return (_b = (_a = i.data) === null || _a === void 0 ? void 0 : _a[RuntimeOutputVariable.images]) !== null && _b !== void 0 ? _b : []; });
41
41
  if (!images.length && message.error) {
42
42
  return (_jsx(Stack, { alignItems: "center", justifyContent: "center", sx: {
43
43
  aspectRatio: 1,
@@ -225,7 +225,7 @@ export default function V0Output() {
225
225
  overflowY: 'auto',
226
226
  scrollbarWidth: 'thin',
227
227
  scrollbarColor: 'grey transparent',
228
- }, propertiesValueMap: propertiesValueMap }) }), objects === null || objects === void 0 ? void 0 : objects.map((item, index) => _jsx(MessageMetadataRenderer, { object: item.data }, index)), !isMessageLoading && ((_b = message.outputs) === null || _b === void 0 ? void 0 : _b.content) && (_jsx(ShareActions, { direction: "row", justifyContent: "flex-end", sx: { mt: 2 } })), _jsxs(Suspense, { fallback: _jsx(Loading, {}), children: [_jsx(Drawer, { anchor: isMobile ? 'bottom' : 'right', open: !!code, onClose: onCloseCode, children: _jsxs(Box, { sx: Object.assign({ p: 2, pt: 0 }, (isMobile ? { maxHeight: '70vh' } : { maxWidth: '70vw' })), children: [_jsxs(Box, { sx: {
228
+ }, propertiesValueMap: propertiesValueMap }) }), objects === null || objects === void 0 ? void 0 : objects.map((item, index) => _jsx(MessageMetadataRenderer, { object: item }, index)), !isMessageLoading && ((_b = message.outputs) === null || _b === void 0 ? void 0 : _b.content) && (_jsx(ShareActions, { direction: "row", justifyContent: "flex-end", sx: { mt: 2 } })), _jsxs(Suspense, { fallback: _jsx(Loading, {}), children: [_jsx(Drawer, { anchor: isMobile ? 'bottom' : 'right', open: !!code, onClose: onCloseCode, children: _jsxs(Box, { sx: Object.assign({ p: 2, pt: 0 }, (isMobile ? { maxHeight: '70vh' } : { maxWidth: '70vw' })), children: [_jsxs(Box, { sx: {
229
229
  py: 2,
230
230
  position: 'sticky',
231
231
  top: 0,
@@ -7,17 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- var __rest = (this && this.__rest) || function (s, e) {
11
- var t = {};
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
- t[p] = s[p];
14
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
- t[p[i]] = s[p[i]];
18
- }
19
- return t;
20
- };
21
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
11
  import Empty from '@arcblock/ux/lib/Empty';
23
12
  import RelativeTime from '@arcblock/ux/lib/RelativeTime';
@@ -291,19 +280,17 @@ function V0DetailRender() {
291
280
  backgroundColor: 'background.block',
292
281
  flex: 1,
293
282
  maxWidth: isMobile ? '100%' : `calc(100% - ${sliderWidth}px - 16px)`,
294
- }, children: _jsx(AgentOutputRender, { message: currentMessage }) })] }));
283
+ }, children: currentMessage && _jsx(AgentOutputRender, { message: currentMessage }) })] }));
295
284
  }
296
- function AgentInputRender(_a) {
297
- var props = __rest(_a, []);
285
+ function AgentInputRender() {
298
286
  const { appearanceInput } = useAppearances();
299
287
  if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
300
288
  return null;
301
- return (_jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProperties, props: props }) }));
289
+ return (_jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProperties }) }));
302
290
  }
303
- function AgentOutputRender(_a) {
304
- var { message } = _a, props = __rest(_a, ["message"]);
291
+ function AgentOutputRender({ message }) {
305
292
  const { appearanceOutput } = useAppearances();
306
293
  if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId) || !message)
307
294
  return null;
308
- return (_jsx(CurrentAgentProvider, { agentId: message.assistantId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, props: props }) }) }) }));
295
+ return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties }) }) }) }));
309
296
  }
@@ -127,11 +127,11 @@ export function CodeRenderByMessage({ zoom, message, minHeight = 200, sx, proper
127
127
  return _jsx(RetryComponent, { message: message });
128
128
  }
129
129
  return (_d = (_c = message === null || message === void 0 ? void 0 : message.outputs) === null || _c === void 0 ? void 0 : _c.objects) === null || _d === void 0 ? void 0 : _d.map((item) => {
130
- var _a, _b, _c;
130
+ var _a, _b;
131
131
  const { taskId } = item;
132
132
  // @ts-ignore
133
- const code = (_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a[codeField];
134
- return (_jsx(CodePreviewMemo, { componentId: `code-preview-${taskId}`, code: code, propertiesValue: ((_b = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _b === void 0 ? void 0 : _b[locale]) || ((_c = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _c === void 0 ? void 0 : _c.en) || {}, message: message }, item.taskId));
133
+ const code = item === null || item === void 0 ? void 0 : item[codeField];
134
+ return (_jsx(CodePreviewMemo, { componentId: `code-preview-${taskId}`, code: code, propertiesValue: ((_a = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _a === void 0 ? void 0 : _a[locale]) || ((_b = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _b === void 0 ? void 0 : _b.en) || {}, message: message }, item.taskId));
135
135
  });
136
136
  // eslint-disable-next-line react-hooks/exhaustive-deps
137
137
  }, [isMessageLoading, (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects, propertiesValueMap, locale]);
@@ -141,7 +141,7 @@ export function CodeRenderByMessage({ zoom, message, minHeight = 200, sx, proper
141
141
  }
142
142
  export const CodeRenderByMessageMemo = memo(CodeRenderByMessage);
143
143
  export function getCurrentCodeByTaskId(message, taskId) {
144
- var _a, _b, _c, _d;
144
+ var _a, _b, _c;
145
145
  // @ts-ignore
146
- return (_d = (_c = (_b = (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((item) => item.taskId === taskId)) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d[codeField];
146
+ return (_c = (_b = (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((item) => item.taskId === taskId)) === null || _c === void 0 ? void 0 : _c[codeField];
147
147
  }