@blocklet/pages-kit 0.2.382 → 0.2.384
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/GoogleSearch/GoogleSearchRelatedQuestionsView.js +2 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +26 -5
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +1 -1
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +6 -2
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +2 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +3 -5
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +1 -1
- package/lib/esm/builtin/async/ai-runtime/state/session.js +6 -2
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -44,6 +44,8 @@ function GoogleSearchRelatedView({ output, outputValue, onlyLastMessage, }) {
|
|
|
44
44
|
return undefined;
|
|
45
45
|
return result.value;
|
|
46
46
|
}, [outputValue]);
|
|
47
|
+
if (message === null || message === void 0 ? void 0 : message.loading)
|
|
48
|
+
return null;
|
|
47
49
|
if ((!isLastMessage && onlyLastMessage) || !((_b = result === null || result === void 0 ? void 0 : result.related_questions) === null || _b === void 0 ? void 0 : _b.length))
|
|
48
50
|
return null;
|
|
49
51
|
return ((0, jsx_runtime_1.jsx)(OutputFieldContainer_1.default, { output: output, children: (0, jsx_runtime_1.jsx)(material_1.List, { dense: true, disablePadding: true, children: result.related_questions.map((item) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemButton, { sx: { py: 1, px: 2 }, onClick: () => __awaiter(this, void 0, void 0, function* () {
|
package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js
CHANGED
|
@@ -37,7 +37,7 @@ function GoogleSearchSourcesView({ output, outputValue }) {
|
|
|
37
37
|
const itemsToShow = showAll
|
|
38
38
|
? [...((searchResult === null || searchResult === void 0 ? void 0 : searchResult.organic_results) || [])]
|
|
39
39
|
: [...((searchResult === null || searchResult === void 0 ? void 0 : searchResult.organic_results) || [])].slice(0, (list === null || list === void 0 ? void 0 : list.length) > 3 ? 2 : 3);
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(OutputFieldContainer_1.default, { output: output, children: (0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 1.5, children: [message.loading && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) })] })), (0, jsx_runtime_1.jsx)(react_transition_group_1.TransitionGroup, { component: null, children: itemsToShow.map((item) => ((0, jsx_runtime_1.jsx)(react_transition_group_1.CSSTransition, { timeout: 500, classNames: "item", children: (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemView, { item: item }) }) }, item.link))) }), !showAll && list.length > 3 && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(MoreItemView, { list: list, onMore: handleToggle }) }))] }) }));
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(OutputFieldContainer_1.default, { output: output, children: (0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 1.5, children: [message.loading && !list.length && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemSkeleton, {}) })] })), (0, jsx_runtime_1.jsx)(react_transition_group_1.TransitionGroup, { component: null, children: itemsToShow.map((item) => ((0, jsx_runtime_1.jsx)(react_transition_group_1.CSSTransition, { timeout: 500, classNames: "item", children: (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(ItemView, { item: item }) }) }, item.link))) }), !showAll && list.length > 3 && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, sm: 4, md: 4, children: (0, jsx_runtime_1.jsx)(MoreItemView, { list: list, onMore: handleToggle }) }))] }) }));
|
|
41
41
|
}
|
|
42
42
|
function ItemView({ item }) {
|
|
43
43
|
var _a;
|
|
@@ -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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -9,7 +32,7 @@ const types_1 = require("@blocklet/ai-runtime/types");
|
|
|
9
32
|
const material_1 = require("@mui/material");
|
|
10
33
|
const react_1 = require("react");
|
|
11
34
|
const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
|
|
12
|
-
const AgentErrorBoundary_1 =
|
|
35
|
+
const AgentErrorBoundary_1 = __importStar(require("../../components/AgentErrorBoundary"));
|
|
13
36
|
const constants_1 = require("../../constants");
|
|
14
37
|
const ComponentPreferences_1 = require("../../contexts/ComponentPreferences");
|
|
15
38
|
const CurrentAgent_1 = require("../../contexts/CurrentAgent");
|
|
@@ -25,8 +48,6 @@ function SimpleOutput() {
|
|
|
25
48
|
const preferences = (0, ComponentPreferences_1.useComponentPreferences)();
|
|
26
49
|
const CustomComponentActionsComponent = preferences === null || preferences === void 0 ? void 0 : preferences.customOutputActionsComponent;
|
|
27
50
|
const { message } = (0, CurrentMessage_1.useCurrentMessage)();
|
|
28
|
-
if (message.error)
|
|
29
|
-
throw message.error;
|
|
30
51
|
const { agent } = (0, CurrentAgent_1.useCurrentAgent)();
|
|
31
52
|
const outputs = (0, react_1.useMemo)(() => {
|
|
32
53
|
var _a;
|
|
@@ -42,7 +63,7 @@ function SimpleOutput() {
|
|
|
42
63
|
const value = output.name === types_1.RuntimeOutputVariable.text
|
|
43
64
|
? ((_a = message.outputs) === null || _a === void 0 ? void 0 : _a.content) ||
|
|
44
65
|
((_d = (_c = (_b = message.outputs) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.find((i) => i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.text])) === null || _d === void 0 ? void 0 : _d[types_1.RuntimeOutputVariable.text])
|
|
45
|
-
: (_g = (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f[
|
|
66
|
+
: (_g = (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f.find((i) => i === null || i === void 0 ? void 0 : i[output.name])) === null || _g === void 0 ? void 0 : _g[output.name];
|
|
46
67
|
return ((0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { instanceId: output.id, componentId: output.appearance.componentId, properties: output.appearance.componentProperties, props: Object.assign({ output, outputValue: value, writing: output.name === types_1.RuntimeOutputVariable.text && message.loading }, (((_h = output === null || output === void 0 ? void 0 : output.appearance) === null || _h === void 0 ? void 0 : _h.componentProps) || {})) }, output.id));
|
|
47
|
-
}), CustomComponentActionsComponent && ((0, jsx_runtime_1.jsx)(AgentErrorBoundary_1.default, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentActionsComponent, {}) }) }))] }));
|
|
68
|
+
}), message.error && (0, jsx_runtime_1.jsx)(AgentErrorBoundary_1.AgentErrorView, { error: message.error }), CustomComponentActionsComponent && ((0, jsx_runtime_1.jsx)(AgentErrorBoundary_1.default, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentActionsComponent, {}) }) }))] }));
|
|
48
69
|
}
|
|
@@ -154,5 +154,5 @@ function CodeRenderByMessage({ zoom, message, minHeight = 200, sx, propertiesVal
|
|
|
154
154
|
exports.CodeRenderByMessageMemo = (0, react_2.memo)(CodeRenderByMessage);
|
|
155
155
|
function getCurrentCodeByTaskId(message) {
|
|
156
156
|
var _a, _b, _c;
|
|
157
|
-
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[
|
|
157
|
+
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((i) => i === null || i === void 0 ? void 0 : i[codeField])) === null || _c === void 0 ? void 0 : _c[codeField];
|
|
158
158
|
}
|
|
@@ -336,11 +336,15 @@ const createSessionState = ({ aid }) => {
|
|
|
336
336
|
}
|
|
337
337
|
catch (error) {
|
|
338
338
|
set((state) => {
|
|
339
|
-
var _a;
|
|
339
|
+
var _a, _b;
|
|
340
340
|
const s = (_a = state.sessionMap) === null || _a === void 0 ? void 0 : _a[sessionId];
|
|
341
341
|
if (!s)
|
|
342
342
|
return;
|
|
343
|
-
s.
|
|
343
|
+
const msg = message ? (_b = s.messages) === null || _b === void 0 ? void 0 : _b.findLast((i) => i.id === message.id) : undefined;
|
|
344
|
+
if (msg)
|
|
345
|
+
msg.error = error;
|
|
346
|
+
else
|
|
347
|
+
s.error = error;
|
|
344
348
|
});
|
|
345
349
|
}
|
|
346
350
|
finally {
|